Skip to content

Commit 72bb5ed

Browse files
committed
update
1 parent 4f0d473 commit 72bb5ed

File tree

22 files changed

+1295
-57
lines changed

22 files changed

+1295
-57
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# azure-pipeline.yml
2+
# Reusable Terraform pipeline template leveraging Run-AzTerraform.ps1 and LibreDevOpsHelpers
3+
4+
parameters:
5+
- name: TerraformCodeLocation
6+
type: string
7+
default: 'terraform'
8+
displayName: 'Path to Terraform code'
9+
- name: TerraformStackToRun
10+
type: object
11+
default: ['all']
12+
displayName: 'Stacks to run'
13+
- name: TerraformWorkspace
14+
type: string
15+
default: 'dev'
16+
displayName: 'Terraform workspace'
17+
- name: RunTerraformInit
18+
type: string
19+
values:
20+
- "true"
21+
- "false"
22+
default: true
23+
displayName: 'Run terraform init'
24+
- name: RunTerraformPlan
25+
type: string
26+
values:
27+
- "true"
28+
- "false"
29+
default: true
30+
displayName: 'Run terraform plan'
31+
- name: RunTerraformPlanDestroy
32+
type: string
33+
values:
34+
- "true"
35+
- "false"
36+
default: true
37+
displayName: 'Run terraform plan -destroy'
38+
- name: RunTerraformApply
39+
type: string
40+
values:
41+
- "true"
42+
- "false"
43+
default: true
44+
displayName: 'Run terraform apply'
45+
- name: RunTerraformDestroy
46+
type: string
47+
values:
48+
- "true"
49+
- "false"
50+
default: true
51+
displayName: 'Run terraform destroy'
52+
- name: TerraformPlanExtraArgs
53+
type: object
54+
default: []
55+
displayName: 'Extra args for terraform plan'
56+
- name: TerraformPlanDestroyExtraArgs
57+
type: object
58+
default: []
59+
displayName: 'Extra args for terraform plan -destroy'
60+
- name: TerraformApplyExtraArgs
61+
type: object
62+
default: []
63+
displayName: 'Extra args for terraform apply'
64+
- name: TerraformDestroyExtraArgs
65+
type: object
66+
default: []
67+
displayName: 'Extra args for terraform destroy'
68+
- name: DebugMode
69+
type: string
70+
values:
71+
- "true"
72+
- "false"
73+
default: true
74+
displayName: 'Enable debug logging'
75+
- name: DeletePlanFiles
76+
type: string
77+
values:
78+
- "true"
79+
- "false"
80+
default: true
81+
displayName: 'Cleanup plan files after run'
82+
- name: TerraformVersion
83+
type: string
84+
default: 'latest'
85+
displayName: 'Terraform version'
86+
- name: RunCheckov
87+
type: string
88+
values:
89+
- "true"
90+
- "false"
91+
default: true
92+
displayName: 'Run Checkov scan'
93+
- name: CheckovSkipCheck
94+
type: string
95+
default: 'CKV2_AZURE_31'
96+
displayName: 'Comma-separated Checkov skip IDs'
97+
- name: CheckovSoftfail
98+
type: string
99+
values:
100+
- "true"
101+
- "false"
102+
default: true
103+
displayName: 'Soft-fail Checkov'
104+
- name: TerraformPlanFileName
105+
type: string
106+
default: 'tfplan.plan'
107+
displayName: 'Plan file name'
108+
- name: TerraformDestroyPlanFileName
109+
type: string
110+
default: 'tfplan-destroy.plan'
111+
displayName: 'Destroy plan file name'
112+
- name: CreateTerraformWorkspace
113+
type: boolean
114+
default: true
115+
displayName: 'Create/select Terraform workspace'
116+
- name: UseAzureClientSecretLogin
117+
type: boolean
118+
default: true
119+
displayName: 'Use Azure client-secret login'
120+
- name: UseAzureOidcLogin
121+
type: boolean
122+
default: false
123+
displayName: 'Use Azure OIDC login'
124+
- name: UseAzureUserLogin
125+
type: boolean
126+
default: false
127+
displayName: 'Use Azure user-device login'
128+
- name: UseAzureManagedIdentityLogin
129+
type: boolean
130+
default: false
131+
displayName: 'Use Azure managed identity login'
132+
- name: AzureServiceConnection
133+
type: string
134+
default: ''
135+
displayName: 'Azure DevOps service connection name'
136+
137+
stages:
138+
- stage: Terraform
139+
displayName: 'Terraform: init/plan/apply/destroy'
140+
jobs:
141+
- job: RunTerraform
142+
pool:
143+
vmImage: 'windows-latest'
144+
steps:
145+
- checkout: self
146+
147+
- task: UseDotNet@2
148+
displayName: 'Ensure PowerShell 7+ is available'
149+
inputs:
150+
packageType: 'sdk'
151+
version: '7.x'
152+
installationPath: $(Agent.ToolsDirectory)/dotnet
153+
154+
- task: PowerShell@2
155+
name: RunAzTerraform
156+
displayName: 'Run Terraform orchestration'
157+
inputs:
158+
pwsh: true
159+
failOnStderr: true
160+
script: |
161+
# Install module if not present
162+
if (-not (Get-Module -ListAvailable -Name LibreDevOpsHelpers)) {
163+
Install-Module -Name LibreDevOpsHelpers -Scope CurrentUser -Force
164+
}
165+
. "$(Build.SourcesDirectory)\Run-AzTerraform.ps1" `
166+
-TerraformCodeLocation ${{ parameters.TerraformCodeLocation }} `
167+
-TerraformStackToRun $([string]::Join(',', ${{ parameters.TerraformStackToRun }})) `
168+
-TerraformWorkspace ${{ parameters.TerraformWorkspace }} `
169+
-RunTerraformInit ${{ parameters.RunTerraformInit }} `
170+
-RunTerraformPlan ${{ parameters.RunTerraformPlan }} `
171+
-RunTerraformPlanDestroy ${{ parameters.RunTerraformPlanDestroy }} `
172+
-RunTerraformApply ${{ parameters.RunTerraformApply }} `
173+
-RunTerraformDestroy ${{ parameters.RunTerraformDestroy }} `
174+
-TerraformPlanExtraArgs ${{ parameters.TerraformPlanExtraArgs }} `
175+
-TerraformPlanDestroyExtraArgs ${{ parameters.TerraformPlanDestroyExtraArgs }} `
176+
-TerraformApplyExtraArgs ${{ parameters.TerraformApplyExtraArgs }} `
177+
-TerraformDestroyExtraArgs ${{ parameters.TerraformDestroyExtraArgs }} `
178+
-DebugMode ${{ parameters.DebugMode }} `
179+
-DeletePlanFiles ${{ parameters.DeletePlanFiles }} `
180+
-TerraformVersion ${{ parameters.TerraformVersion }} `
181+
-RunCheckov ${{ parameters.RunCheckov }} `
182+
-CheckovSkipCheck ${{ parameters.CheckovSkipCheck }} `
183+
-CheckovSoftfail ${{ parameters.CheckovSoftfail }} `
184+
-TerraformPlanFileName ${{ parameters.TerraformPlanFileName }} `
185+
-TerraformDestroyPlanFileName ${{ parameters.TerraformDestroyPlanFileName }} `
186+
-CreateTerraformWorkspace ${{ parameters.CreateTerraformWorkspace }} `
187+
-UseAzureClientSecretLogin ${{ parameters.UseAzureClientSecretLogin }} `
188+
-UseAzureOidcLogin ${{ parameters.UseAzureOidcLogin }} `
189+
-UseAzureUserLogin ${{ parameters.UseAzureUserLogin }} `
190+
-UseAzureManagedIdentityLogin ${{ parameters.UseAzureManagedIdentityLogin }} `
191+
-AzureServiceConnection '${{ parameters.AzureServiceConnection }}'
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: "Bug report \U0001F41B"
3+
about: Report errors or unexpected behaviour
4+
title: 'Bug Report'
5+
labels: 'needs triage :warning:'
6+
assignees: ''
7+
---
8+
9+
### Community Note
10+
11+
<!--- Please keep this note for the community --->
12+
13+
- Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
14+
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
15+
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
16+
17+
<!--- Thank you for keeping this note for the community --->
18+
19+
### Versions
20+
21+
<!-- Please tell us the versions of terraform, azure provider and this module you are using, to help us replicate the issue. -->
22+
23+
**terraform**:
24+
25+
**azure provider**:
26+
27+
**module**:
28+
29+
### Description
30+
31+
#### Describe the bug
32+
33+
<!-- A clear and concise description of what the bug is. -->
34+
35+
#### Steps to Reproduce
36+
37+
<!-- Please provide detailed steps for reproducing the issue. -->
38+
39+
1. step 1
40+
2. step 2
41+
3. you get it...
42+
43+
#### Screenshots
44+
45+
<!-- If applicable, add screenshots to help explain your problem. -->
46+
47+
#### Additional context
48+
49+
<!-- Add any other context about the problem here. -->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
blank_issues_enabled: false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: "Feature request \U0001F680"
3+
about: Suggest an idea for this project
4+
title: 'Feature Request'
5+
labels: 'needs triage :warning:'
6+
assignees: ''
7+
---
8+
9+
### Community Note
10+
11+
<!--- Please keep this note for the community --->
12+
13+
- Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
14+
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
15+
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
16+
17+
<!--- Thank you for keeping this note for the community --->
18+
19+
### Description
20+
21+
#### Is your feature request related to a problem?
22+
23+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
24+
25+
#### Describe the solution you'd like
26+
27+
<!-- A clear and concise description of what you want to happen. -->
28+
29+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
30+
31+
#### Additional context

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!-- markdownlint-disable first-line-h1 -->
2+
3+
<!-- Thank you for submitting a Pull Request. Please fill out the template below.-->
4+
## Overview/Summary
5+
6+
Replace this with a brief description of what this Pull Request fixes, changes, etc.
7+
8+
## This PR fixes/adds/changes/removes
9+
10+
1. *Replace me*
11+
2. *Replace me*
12+
3. *Replace me*
13+
14+
### Breaking Changes
15+
16+
1. *Replace me*
17+
2. *Replace me*
18+
19+
## Testing Evidence
20+
21+
Please provide any testing evidence to show that your Pull Request works/fixes as described and planned (include screenshots, if appropriate).
22+
23+
## As part of this Pull Request I have
24+
25+
- [ ] Checked for duplicate
26+
- [ ] Associated it with relevant
27+
- [ ] Ensured my code/branch is up-to-date with the latest changes in the `main`
28+
- [ ] Performed testing and provided evidence.
29+
- [ ] Updated relevant and associated documentation.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 'Run Docker - RHEL'
2+
3+
# Allow run manually
4+
on:
5+
schedule:
6+
- cron: '0 0 1 * *' # This will run at 00:00 on the 1st of every month
7+
workflow_dispatch:
8+
inputs:
9+
working_directory:
10+
type: string
11+
description: What working directory should be passed to the script
12+
default: "containers/rhel"
13+
docker_image_name:
14+
type: string
15+
description: 'Docker Image name?'
16+
default: "terraform-azure-azdo-pipeline-templates/rhel"
17+
enable_debug_mode:
18+
type: boolean
19+
description: 'Whether debug mode should be enable for within the script'
20+
default: true
21+
registry_url:
22+
type: string
23+
description: 'The URL of the container registry'
24+
default: ghcr.io
25+
docker_file_name:
26+
type: string
27+
description: 'Docker file name?'
28+
default: "Dockerfile"
29+
push_docker_image:
30+
type: string
31+
description: 'Push docker image?'
32+
default: 'true'
33+
34+
jobs:
35+
run-script:
36+
name: 'Run Script'
37+
runs-on: ubuntu-latest
38+
39+
defaults:
40+
run:
41+
shell: pwsh
42+
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- name: Build
47+
id: run-script
48+
shell: pwsh
49+
run: |
50+
$workingDirectory = Join-Path -Path "${{ github.workspace }}" -ChildPath "${{ inputs.working_directory }}"
51+
.\Run-Docker.ps1 `
52+
-WorkingDirectory $workingDirectory `
53+
-PushDockerImage ${{ inputs.push_docker_image }} `
54+
-DebugMode ${{ inputs.enable_debug_mode }} `
55+
-DockerImageName ${{ inputs.docker_image_name }} `
56+
-DockerFileName ${{ inputs.docker_file_name }} `
57+
-RegistryUsername ${{ secrets.RegistryUsername }} `
58+
-RegistryPassword ${{ secrets.RegistryPassword }} `
59+
-ImageOrg ${{ github.repository_owner }}

0 commit comments

Comments
 (0)