Skip to content

Commit 3a0c7a9

Browse files
committed
Update
1 parent 0c9e0d7 commit 3a0c7a9

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

.azuredevops/templates/steps/terraform-init-plan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ parameters:
4747
- name: TerraformInitCreateBackendStateFileName
4848
type: string
4949
values: [ "true", "false" ]
50-
default: "false"
50+
default: "true"
5151
displayName: 'Whether the script should attempt to make a state file based on stack name'
5252

5353
- name: TerraformInitExtraArgsJson

.azuredevops/workflows/steps/terraform-init-plan.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ parameters:
7272
default: "false"
7373
displayName: "Debug mode enabled"
7474

75-
- name: TerraformInitCreateBackendStateFileName
76-
type: string
77-
values: [ "true", "false" ]
78-
default: "true"
79-
displayName: 'Whether the script should attempt to make a state file based on stack name'
80-
8175
- name: TerraformInitExtraArgsJson
8276
type: string
8377
default: >
@@ -99,8 +93,8 @@ resources:
9993
- repository: githubTemplates
10094
type: github
10195
name: libre-devops/terraform-azure-azdo-pipeline-templates
102-
ref: main # or a tag like refs/tags/v1.0.0
103-
endpoint: libredevops # Service connection to GitHub
96+
ref: main
97+
endpoint: libredevops
10498

10599
pool: 'Default'
106100

@@ -111,7 +105,6 @@ steps:
111105
- template: .azuredevops/templates/steps/terraform-init-plan.yaml@githubTemplates # path in the external repo
112106
parameters:
113107
TerraformCodeLocation: ${{ parameters.TerraformCodeLocation }}
114-
TerraformInitCreateBackendStateFileName: ${{ parameters.TerraformInitCreateBackendStateFileName }}
115108
TerraformInitExtraArgsJson: ${{ parameters.TerraformInitExtraArgsJson }}
116109
TerraformPlanExtraArgsJson: ${{ parameters.TerraformPlanExtraArgsJson }}
117110
TerraformStackToRunJson: ${{ parameters.TerraformStackToRunJson }}

PowerShellModules/Terraform.psm1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ function Get-TerraformStackFolders
5353
throw "Code root not found: $CodeRoot"
5454
}
5555

56+
# Match folders like 0_rg or 0-rg
5657
$allDirs = Get-ChildItem -Path $CodeRoot -Directory |
57-
Where-Object { $_.Name -match '^\d+_.+' }
58+
Where-Object { $_.Name -match '^\d+[-_].+' }
5859

5960
if (-not $allDirs)
6061
{
@@ -67,10 +68,10 @@ function Get-TerraformStackFolders
6768
$stackLookup = @{ }
6869
foreach ($dir in $allDirs)
6970
{
70-
if ($dir.Name -match '^(?<order>\d+)_(?<name>.+)$')
71+
if ($dir.Name -match '^(?<order>\d+)[-_](?<name>.+)$')
7172
{
7273
$stackLookup[$matches.name.ToLower()] = @{
73-
Path = $dir.FullName
74+
Path = $dir.FullName
7475
Order = [int]$matches.order
7576
}
7677
}
@@ -127,6 +128,7 @@ function Get-TerraformStackFolders
127128
return $result
128129
}
129130

131+
130132
###############################################################################
131133
# Run `terraform init`
132134
###############################################################################

Run-AzTerraform.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ param (
55
[string]$RunTerraformApply = "false",
66
[string]$RunTerraformDestroy = "false",
77
[string]$TerraformInitExtraArgsJson = '[]',
8-
[string]$TerraformInitCreateBackendStateFileName = "false",
8+
[string]$TerraformInitCreateBackendStateFileName = "true",
99
[string]$TerraformPlanExtraArgsJson = '[]',
1010
[string]$TerraformPlanDestroyExtraArgsJson = '[]',
1111
[string]$TerraformApplyExtraArgsJson = '[]',

0 commit comments

Comments
 (0)