Skip to content

Commit 31c701e

Browse files
feat: multi input file support (Azure#214)
# Pull Request ## Description Support for multiple input files that get merged together. Docs updates for new version of complete-multi-region Terraform module. Associated PR for starter module: Azure/alz-terraform-accelerator#175 ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent 7f7a216 commit 31c701e

19 files changed

+714
-69
lines changed

Diff for: CONTRIBUTING.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ Copy-Item -Path "$exampleFolder/inputs-azure-devops-terraform-complete-multi-reg
101101
Copy-Item -Path "$exampleFolder/inputs-github-terraform-complete-multi-region.yaml" -Destination "$terraformConfigFolder/inputs-github.yaml" -Force
102102
Copy-Item -Path "$exampleFolder/inputs-local-terraform-complete-multi-region.yaml" -Destination "$terraformConfigFolder/inputs-local.yaml" -Force
103103
104+
$exampleFolder = "$targetFolder/code/ALZ-PowerShell-Module/docs/wiki/examples/starter-module-config/complete-multi-region"
105+
106+
Copy-Item -Path "$exampleFolder/config-hub-and-spoke-vnet-multi-region.yaml" -Destination "$terraformConfigFolder/config-hub-and-spoke-vnet-multi-region.yaml" -Force
107+
Copy-Item -Path "$exampleFolder/config-hub-and-spoke-vnet-single-region.yaml" -Destination "$terraformConfigFolder/config-hub-and-spoke-vnet-single-region.yaml" -Force
108+
Copy-Item -Path "$exampleFolder/config-virtual-wan-multi-region.yaml" -Destination "$terraformConfigFolder/config-virtual-wan-multi-region.yaml" -Force
109+
Copy-Item -Path "$exampleFolder/config-virtual-wan-single-region.yaml" -Destination "$terraformConfigFolder/config-virtual-wan-single-region.yaml" -Force
110+
104111
```
105112

106113
>IMPORTANT! - Now you'll need to update the input files with your settings for VCS, etc.
@@ -197,12 +204,14 @@ Deploy-Accelerator `
197204
-bootstrapModuleOverrideFolderPath "/$targetFolder/code/accelerator-bootstrap-modules" `
198205
-starterModuleOverrideFolderPath "/$targetFolder/code/alz-terraform-accelerator/templates" `
199206
-output "/$targetFolder/acc/terraform/output/azuredevops" `
200-
-inputs "/$targetFolder/acc/terraform/config/inputs-azuredevops.yaml" `
207+
-inputs "/$targetFolder/acc/terraform/config/inputs-azuredevops.yaml", "/$targetFolder/acc/terraform/config/config-hub-and-spoke-vnet-multi-region.yaml" `
201208
-verbose `
202209
-replaceFiles # This will replace the files in the output folder with the files in the bootstrap and starter modules, so any updates are taken into account
203210
204211
```
205212

213+
>NOTE: The `config-hub-and-spoke-vnet-multi-region.yaml` file is an example. You can use any of the other configuration files.
214+
206215
### Terraform GitHub
207216

208217
Run this from the VSCode terminal for the ALZ-PowerShell-Module repository:
@@ -221,12 +230,14 @@ Deploy-Accelerator `
221230
-bootstrapModuleOverrideFolderPath "/$targetFolder/code/accelerator-bootstrap-modules" `
222231
-starterModuleOverrideFolderPath "/$targetFolder/code/alz-terraform-accelerator/templates" `
223232
-output "/$targetFolder/acc/terraform/output/github" `
224-
-inputs "/$targetFolder/acc/terraform/config/inputs-github.yaml" `
233+
-inputs "/$targetFolder/acc/terraform/config/inputs-github.yaml", "/$targetFolder/acc/terraform/config/config-hub-and-spoke-vnet-multi-region.yaml" `
225234
-verbose `
226235
-replaceFiles # This will replace the files in the output folder with the files in the bootstrap and starter modules, so any updates are taken into account
227236
228237
```
229238

239+
>NOTE: The `config-hub-and-spoke-vnet-multi-region.yaml` file is an example. You can use any of the other configuration files.
240+
230241
### Terraform Local
231242

232243
Run this from the VSCode terminal for the ALZ-PowerShell-Module repository:
@@ -245,8 +256,10 @@ Deploy-Accelerator `
245256
-bootstrapModuleOverrideFolderPath "/$targetFolder/code/accelerator-bootstrap-modules" `
246257
-starterModuleOverrideFolderPath "/$targetFolder/code/alz-terraform-accelerator/templates" `
247258
-output "/$targetFolder/acc/terraform/output/local" `
248-
-inputs "/$targetFolder/acc/terraform/config/inputs-local.yaml" `
259+
-inputs "/$targetFolder/acc/terraform/config/inputs-local.yaml", "/$targetFolder/acc/terraform/config/config-hub-and-spoke-vnet-multi-region.yaml" `
249260
-verbose `
250261
-replaceFiles # This will replace the files in the output folder with the files in the bootstrap and starter modules, so any updates are taken into account
251262
252263
```
264+
265+
>NOTE: The `config-hub-and-spoke-vnet-multi-region.yaml` file is an example. You can use any of the other configuration files.

Diff for: docs/wiki/[User-Guide]-Quick-Start-Phase-2-Azure-DevOps.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
152152
- [Terraform Complete Starter Module][wiki_starter_module_terraform_complete]: Management groups, policies, hub networking with fully custom configuration.
153153
1. In your PowerShell Core (pwsh) terminal run the module:
154154
155+
>NOTE: The following examples include 2 input files. This is the recommended approach for the `complete_multi_region` starter module. However, all inputs can be combined into a single file if desired and other starter modules only require a single input file.
156+
155157
```pwsh
156158
# Windows (adjust the paths to match your setup)
157-
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml" -output "c:\accelerator\output"
159+
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml", "c:\accelerator\config\networking.yaml" -output "c:\accelerator\output"
158160
```
159161
160162
```pwsh
161163
# Linux/Mac (adjust the paths to match your setup)
162-
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml" -output "/accelerator/output"
164+
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml", "/accelerator/config/networking.yaml" -output "/accelerator/output"
163165
```
164166
165167
1. You will see a Terraform `init` and `apply` happen.

Diff for: docs/wiki/[User-Guide]-Quick-Start-Phase-2-GitHub.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,16 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
139139
- [Terraform Complete Starter Module][wiki_starter_module_terraform_complete]: Management groups, policies, hub networking with fully custom configuration.
140140
1. In your PowerShell Core (pwsh) terminal run the module:
141141
142+
>NOTE: The following examples include 2 input files. This is the recommended approach for the `complete_multi_region` starter module. However, all inputs can be combined into a single file if desired and other starter modules only require a single input file.
143+
142144
```pwsh
143145
# Windows (adjust the paths to match your setup)
144-
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml" -output "c:\accelerator\output"
146+
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml", "c:\accelerator\config\networking.yaml" -output "c:\accelerator\output"
147+
```
145148
149+
```pwsh
146150
# Linux/Mac (adjust the paths to match your setup)
147-
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml" -output "/accelerator/output"
151+
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml", "/accelerator/config/networking.yaml" -output "/accelerator/output"
148152
```
149153
150154
1. You will see a Terraform `init` and `apply` happen.

Diff for: docs/wiki/[User-Guide]-Quick-Start-Phase-2-Local.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,16 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
128128
- [Terraform Complete Starter Module][wiki_starter_module_terraform_complete]: Management groups, policies, hub networking with fully custom configuration.
129129
1. In your PowerShell Core (pwsh) terminal run the module:
130130
131+
>NOTE: The following examples include 2 input files. This is the recommended approach for the `complete_multi_region` starter module. However, all inputs can be combined into a single file if desired and other starter modules only require a single input file.
132+
131133
```pwsh
132134
# Windows (adjust the paths to match your setup)
133-
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml" -output "c:\accelerator\output"
135+
Deploy-Accelerator -inputs "c:\accelerator\config\inputs.yaml", "c:\accelerator\config\networking.yaml" -output "c:\accelerator\output"
134136
```
135137
136138
```pwsh
137139
# Linux/Mac (adjust the paths to match your setup)
138-
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml" -output "/accelerator/output"
140+
Deploy-Accelerator -inputs "/accelerator/config/inputs.yaml", "/accelerator/config/networking.yaml" -output "/accelerator/output"
139141
```
140142
141143
1. You will see a Terraform `init` and `apply` happen.

Diff for: docs/wiki/[User-Guide]-Quick-Start-Phase-3.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Follow the steps below to deploy the landing zone locally. If you want to hook i
3737

3838
#### 3.1.3.1 Bicep
3939

40+
The Bicep option outputs a `deploy-local.ps1` file that you can use to deploy the ALZ.
41+
42+
>NOTE: If you set the `grant_permissions_to_current_user` input to `false` in the bootstrap, you will need to set permissions on your management group and subscriptions before the commands will succeed.
43+
4044
1. Ensure you have the latest versions of the [AZ PowerShell Module](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell) and [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install) installed.
4145
1. Open a new PowerShell Core (pwsh) terminal or use the one you already have open.
4246
1. Navigate to the directory shown in the `module_output_directory_path` output from the bootstrap.
@@ -49,13 +53,16 @@ Follow the steps below to deploy the landing zone locally. If you want to hook i
4953

5054
#### 3.1.3.2 Terraform
5155

56+
The Terraform option outputs a `deploy-local.ps1` file that you can use to deploy the ALZ.
57+
58+
>NOTE: If you set the `grant_permissions_to_current_user` input to `false` in the bootstrap, you will need to set permissions on your management group, subscriptions and storage account before the commands will succeed.
59+
5260
1. Open a new PowerShell Core (pwsh) terminal or use the one you already have open.
5361
1. Navigate to the directory shown in the `module_output_directory_path` output from the bootstrap.
54-
1. If you choose to deploy the bootstrap resources in Azure, then you will need to navigate to the Azure Portal and find you storage account.
55-
1. Make note of the `Resource Group Name`, `Storage account name`and `Container Name` from the storage account.
56-
1. If you did not choose to deploy the bootstrap resources in Azure, type `terraform init` and hit enter.
57-
1. If you choose to deploy the bootstrap resources in Azure, type `terraform init -backend-config="resource_group_name=<Resource Group Name>" -backend-config="storage_account_name=<Storage account name>" -backend-config="container_name=<Container Name>" -backend-config="key=terraform.tfstate" -backend-config="use_azuread_auth=true"` , replacing the items in angle brackets and hit enter.
58-
1. Type `terraform plan -out=tfplan` and hit enter.
59-
1. Review the plan. Use `terraform show tfplan` to see the plan details.
60-
1. If you are happy with the plan, then type `terraform apply tfplan` and hit enter.
62+
1. (Optional) Ensure you are still logged in to Azure using `az login --tenant 00000000-0000-0000-0000-000000000000`.
63+
1. (Optional) Connect to your target subscription using `az account set --subscription 00000000-0000-0000-0000-000000000000`.
64+
1. (Optional) Examine the `./scripts/deploy-local.ps1` to understand what it is doing.
65+
1. Run `./scripts/deploy-local.ps1`.
66+
1. A plan will run and then you'll be prompted to check it and run the deploy.
67+
1. Type `yes` and hit enter to run the deploy.
6168
1. The ALZ will now be deployed, this may take some time.

0 commit comments

Comments
 (0)