Skip to content

Commit aa0f60e

Browse files
feat: improvements to inputs and region validation (#182)
# Pull Request ## Issues #124 ## Description This PR adds a few improvements: - The regions and availability zones are now retrieved dynamically. - The PowerShell module supports overriding the bootstrap terraform.tfvars file as one method of supplying values for hidden variables. - The PowerShell module supports supplying hidden bootstrap variables via the inputs config file, for example resource names can now be supplied there. - The override.tfvars file is now in json format, so we can support complex data types. e2e test run: https://github.com/Azure/accelerator-bootstrap-modules/actions/runs/10734976021 ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent 795dcbb commit aa0f60e

28 files changed

+414
-188
lines changed

.github/linters/.markdown-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ MD004: false # ul-style - Unordered list style
2222
MD007:
2323
indent: 2 # ul-indent - Unordered list indentation
2424
MD013:
25-
line_length: 500 # line-length - Line length
25+
line_length: 600 # line-length - Line length
2626
MD026:
2727
punctuation: ".,;:!。,;:" # no-trailing-punctuation - Trailing punctuation in heading
2828
MD029: false # ol-prefix - Ordered list item prefix

CONTRIBUTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ Example folder structure:
4848
┗ 📂acc
4949
┣ 📂bicep
5050
┃ ┣ 📂config
51-
┃ ┃ ┣ 📜inputs-azuredevops.yaml # ./docs/wiki/examples/powershell-inputs/inputs-azure-devops-bicep.yaml
52-
┃ ┃ ┣ 📜inputs-github.yaml # ./docs/wiki/examples/powershell-inputs/inputs-github-bicep.yaml
53-
┃ ┃ ┗ 📜inputs-local.yaml # ./docs/wiki/examples/powershell-inputs/inputs-local-bicep.yaml
51+
┃ ┃ ┣ 📜inputs-azuredevops.yaml # ./docs/wiki/examples/powershell-inputs/inputs-azure-devops-bicep-complete.yaml
52+
┃ ┃ ┣ 📜inputs-github.yaml # ./docs/wiki/examples/powershell-inputs/inputs-github-bicep-complete.yaml
53+
┃ ┃ ┗ 📜inputs-local.yaml # ./docs/wiki/examples/powershell-inputs/inputs-local-bicep-complete.yaml
5454
┃ ┗ 📂output
5555
┃ ┣ 📂azuredevops
5656
┃ ┣ 📂github
5757
┃ ┗ 📂local
5858
┗ 📂terraform
5959
┣ 📂config
60-
┃ ┣ 📜inputs-azuredevops.yaml # ./docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform.yaml
61-
┃ ┣ 📜inputs-github.yaml # ./docs/wiki/examples/powershell-inputs/inputs-github-terraform.yaml
62-
┃ ┗ 📜inputs-local.yaml # ./docs/wiki/examples/powershell-inputs/inputs-local-terraform.yaml
60+
┃ ┣ 📜inputs-azuredevops.yaml # ./docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform-complete.yaml
61+
┃ ┣ 📜inputs-github.yaml # ./docs/wiki/examples/powershell-inputs/inputs-github-terraform-complete.yaml
62+
┃ ┗ 📜inputs-local.yaml # ./docs/wiki/examples/powershell-inputs/inputs-local-terraform-complete.yaml
6363
┗ 📂output
6464
┣ 📂azuredevops
6565
┣ 📂github
@@ -94,12 +94,12 @@ cd /
9494
9595
$exampleFolder = "$targetFolder/code/ALZ-PowerShell-Module/docs/wiki/examples/powershell-inputs"
9696
97-
Copy-Item -Path "$exampleFolder/inputs-azure-devops-bicep.yaml" -Destination "$bicepConfigFolder/inputs-azuredevops.yaml" -Force
98-
Copy-Item -Path "$exampleFolder/inputs-github-bicep.yaml" -Destination "$bicepConfigFolder/inputs-github.yaml" -Force
99-
Copy-Item -Path "$exampleFolder/inputs-local-bicep.yaml" -Destination "$bicepConfigFolder/inputs-local.yaml" -Force
100-
Copy-Item -Path "$exampleFolder/inputs-azure-devops-terraform.yaml" -Destination "$terraformConfigFolder/inputs-azuredevops.yaml" -Force
101-
Copy-Item -Path "$exampleFolder/inputs-github-terraform.yaml" -Destination "$terraformConfigFolder/inputs-github.yaml" -Force
102-
Copy-Item -Path "$exampleFolder/inputs-local-terraform.yaml" -Destination "$terraformConfigFolder/inputs-local.yaml" -Force
97+
Copy-Item -Path "$exampleFolder/inputs-azure-devops-bicep-complete.yaml" -Destination "$bicepConfigFolder/inputs-azuredevops.yaml" -Force
98+
Copy-Item -Path "$exampleFolder/inputs-github-bicep-complete.yaml" -Destination "$bicepConfigFolder/inputs-github.yaml" -Force
99+
Copy-Item -Path "$exampleFolder/inputs-local-bicep-complete.yaml" -Destination "$bicepConfigFolder/inputs-local.yaml" -Force
100+
Copy-Item -Path "$exampleFolder/inputs-azure-devops-terraform-complete.yaml" -Destination "$terraformConfigFolder/inputs-azuredevops.yaml" -Force
101+
Copy-Item -Path "$exampleFolder/inputs-github-terraform-complete.yaml" -Destination "$terraformConfigFolder/inputs-github.yaml" -Force
102+
Copy-Item -Path "$exampleFolder/inputs-local-terraform-complete.yaml" -Destination "$terraformConfigFolder/inputs-local.yaml" -Force
103103
104104
```
105105

docs/wiki/Frequently-Asked-Questions.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,51 @@ This article answers frequently asked questions relating to the Azure landing zo
99

1010
### How do I use my own naming convention for the resources that are deployed?
1111

12-
Follow these steps to customise the resource names:
12+
You can add any hidden variables to your inputs file, including the `resource_names` map. This map is used to set the names of the resources that are deployed. You can find the default values in the `terraform.tfvars` file in the bootstrap module.
1313

14-
1. At step 2.2 of the quickstart, you will run the `Deploy-Accelerator` command to start the user input process.
15-
1. Once the prompt appears for the first question open the relevant bootstrap `terraform.tfvars` file:
16-
1. Azure DevOps: `./bootstrap/v#.#.#/alz/azuredevops/terraform.tfvars`
17-
1. GitHub: `./bootstrap/v#.#.#/alz/github/terraform.tfvars`
18-
1. Look for the variable called `resource_names`.
19-
1. Update this map to have the names you desire and save it.
20-
1. Continue with the user input as normal.
14+
For example adding this to the end of your inputs file and updating to your standard:
2115

22-
You'll now get the names you specified instead of the default ones.
16+
```yaml
17+
# Extra Inputs
18+
resource_names:
19+
resource_group_state: "rg-{{service_name}}-{{environment_name}}-state-{{azure_location}}-{{postfix_number}}-test"
20+
resource_group_identity: "rg-{{service_name}}-{{environment_name}}-identity-{{azure_location}}-{{postfix_number}}"
21+
resource_group_agents: "rg-{{service_name}}-{{environment_name}}-agents-{{azure_location}}-{{postfix_number}}"
22+
resource_group_network: "rg-{{service_name}}-{{environment_name}}-network-{{azure_location}}-{{postfix_number}}"
23+
user_assigned_managed_identity_plan: "id-{{service_name}}-{{environment_name}}-{{azure_location}}-plan-{{postfix_number}}"
24+
user_assigned_managed_identity_apply: "id-{{service_name}}-{{environment_name}}-{{azure_location}}-apply-{{postfix_number}}"
25+
user_assigned_managed_identity_federated_credentials_plan: "id-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}-plan"
26+
user_assigned_managed_identity_federated_credentials_apply: "id-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}-apply"
27+
storage_account: "sto{{service_name_short}}{{environment_name_short}}{{azure_location_short}}{{postfix_number}}{{random_string}}"
28+
storage_container: "{{environment_name}}-tfstate"
29+
container_instance_01: "aci-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}"
30+
container_instance_02: "aci-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number_plus_1}}"
31+
container_instance_managed_identity: "id-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}-aci"
32+
agent_01: "agent-{{service_name}}-{{environment_name}}-{{postfix_number}}"
33+
agent_02: "agent-{{service_name}}-{{environment_name}}-{{postfix_number_plus_1}}"
34+
version_control_system_repository: "{{service_name}}-{{environment_name}}"
35+
version_control_system_repository_templates: "{{service_name}}-{{environment_name}}-templates"
36+
version_control_system_service_connection_plan: "sc-{{service_name}}-{{environment_name}}-plan"
37+
version_control_system_service_connection_apply: "sc-{{service_name}}-{{environment_name}}-apply"
38+
version_control_system_environment_plan: "{{service_name}}-{{environment_name}}-plan"
39+
version_control_system_environment_apply: "{{service_name}}-{{environment_name}}-apply"
40+
version_control_system_variable_group: "{{service_name}}-{{environment_name}}"
41+
version_control_system_agent_pool: "{{service_name}}-{{environment_name}}"
42+
version_control_system_group: "{{service_name}}-{{environment_name}}-approvers"
43+
version_control_system_pipeline_name_ci: "01 Azure Landing Zones Continuous Integration"
44+
version_control_system_pipeline_name_cd: "02 Azure Landing Zones Continuous Delivery"
45+
virtual_network: "vnet-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}"
46+
public_ip: "pip-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}"
47+
nat_gateway: "nat-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}"
48+
subnet_container_instances: "subnet-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}-aci"
49+
subnet_private_endpoints: "subnet-{{service_name}}-{{environment_name}}-{{azure_location}}-{{postfix_number}}-pe"
50+
storage_account_private_endpoint: "pe-{{service_name}}-{{environment_name}}-{{azure_location}}-sto-{{postfix_number}}"
51+
container_registry: "acr{{service_name}}{{environment_name}}{{azure_location_short}}{{postfix_number}}{{random_string}}"
52+
container_registry_private_endpoint: "pe-{{service_name}}-{{environment_name}}-{{azure_location}}-acr-{{postfix_number}}"
53+
container_image_name: "azure-devops-agent"
54+
```
55+
56+
Alternatively, you can take a copy of the `terraform.tfvars` file from the bootstrap module, update it and supply it via the `-bootstrapTfVarsOverridePath` parameter as an absolute path.
2357

2458
## Questions about bootstrap clean up
2559

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
5959
| `use_self_hosted_agents` | `true` | This controls if you want to deploy self-hosted agents. This will default to `true`. |
6060
| `use_private_networking` | `true` | This controls whether private networking is deployed for your self-hosted agents and storage account. This only applies if you have `use_self_hosted_agents` set to `true`. This defaults to `true`. |
6161
| `allow_storage_access_from_my_ip` | `false` | This is not relecant to Bicep and we'll remove the need to specify it later, leave it set to `false`. |
62-
| `apply_approvers` | `<email-address-list>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is a comma-separated list like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty string `""` to disable approvals. |
62+
| `apply_approvers` | `<email-address>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is an array of strings like `["abc@xyz.com", "def@xyz.com", "ghi@xyz.com"]`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty array `[]` to disable approvals. Note if supplying via the user interface, use a comma separated string like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. |
6363
| `create_branch_policies` | `true` | This controls whether to create branch policies for the repository. This defaults to `true`. |
6464
6565
1. Now head over to your chosen starter module documentation to get the specific inputs for that module. Come back here when you are done.
@@ -137,7 +137,7 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
137137
| `use_self_hosted_agents` | `true` | This controls if you want to deploy self-hosted agents. This will default to `true`. |
138138
| `use_private_networking` | `true` | This controls whether private networking is deployed for your self-hosted agents and storage account. This only applies if you have `use_self_hosted_agents` set to `true`. This defaults to `true`. |
139139
| `allow_storage_access_from_my_ip` | `false` | This controls whether to allow access to the storage account from your IP address. This is only needed for trouble shooting. This only applies if you have `use_private_networking` set to `true`. This defaults to `false`. |
140-
| `apply_approvers` | `<email-address-list>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is a comma-separated list like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty string `""` to disable approvals. |
140+
| `apply_approvers` | `<email-address>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is an array of strings like `["abc@xyz.com", "def@xyz.com", "ghi@xyz.com"]`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty array `[]` to disable approvals. Note if supplying via the user interface, use a comma separated string like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. |
141141
| `create_branch_policies` | `true` | This controls whether to create branch policies for the repository. This defaults to `true`. |
142142
143143
1. Now head over to your chosen starter module documentation to get the specific inputs for that module. Come back here when you are done.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
5353
| `use_self_hosted_agents` | `true` | This controls if you want to deploy self-hosted agents. This will default to `true`. |
5454
| `use_private_networking` | `true` | This controls whether private networking is deployed for your self-hosted agents and storage account. This only applies if you have `use_self_hosted_agents` set to `true`. This defaults to `true`. |
5555
| `allow_storage_access_from_my_ip` | `false` | This is not relevant to Bicep and we'll remove the need to specify it later, leave it set to `false`. |
56-
| `apply_approvers` | `<email-address-list>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is a comma-separated list like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty string `""` to disable approvals. |
56+
| `apply_approvers` | `<email-address>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is an array of strings like `["abc@xyz.com", "def@xyz.com", "ghi@xyz.com"]`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty array `[]` to disable approvals. Note if supplying via the user interface, use a comma separated string like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. |
5757
| `create_branch_policies` | `true` | This controls whether to create branch policies for the repository. This defaults to `true`. |
5858
5959
1. Now head over to your chosen starter module documentation to get the specific inputs for that module. Come back here when you are done.
@@ -124,7 +124,7 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,
124124
| `use_self_hosted_agents` | `true` | This controls if you want to deploy self-hosted agents. This will default to `true`. |
125125
| `use_private_networking` | `true` | This controls whether private networking is deployed for your self-hosted agents and storage account. This only applies if you have `use_self_hosted_agents` set to `true`. This defaults to `true`. |
126126
| `allow_storage_access_from_my_ip` | `false` | This controls whether to allow access to the storage account from your IP address. This is only needed for trouble shooting. This only applies if you have `use_private_networking` set to `true`. This defaults to `false`. |
127-
| `apply_approvers` | `<email-address-list>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is a comma-separated list like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty string `""` to disable approvals. |
127+
| `apply_approvers` | `<email-address>` | This is a list of service principal names (SPN) of people you wish to be in the group that approves apply of the Azure landing zone module. This is an array of strings like `["abc@xyz.com", "def@xyz.com", "ghi@xyz.com"]`. You may need to check what the SPN is prior to filling this out as it can vary based on identity provider. Use empty array `[]` to disable approvals. Note if supplying via the user interface, use a comma separated string like `abc@xyz.com,def@xyz.com,ghi@xyz.com`. |
128128
| `create_branch_policies` | `true` | This controls whether to create branch policies for the repository. This defaults to `true`. |
129129
130130
1. Now head over to your chosen starter module documentation to get the specific inputs for that module. Come back here when you are done.

docs/wiki/examples/powershell-inputs/inputs-azure-devops-bicep-complete.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ azure_devops_project_name: "<azure-devops-project-name>"
3030
use_self_hosted_agents: "true"
3131
use_private_networking: "true"
3232
allow_storage_access_from_my_ip: "false"
33-
apply_approvers: "<email-address-list>"
33+
apply_approvers: ["<email-address>"]
3434
create_branch_policies: "true"
3535

3636
# Complete Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform-basic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ azure_devops_project_name: "<azure-devops-project-name>"
3030
use_self_hosted_agents: "true"
3131
use_private_networking: "true"
3232
allow_storage_access_from_my_ip: "false"
33-
apply_approvers: "<email-address-list>"
33+
apply_approvers: ["<email-address>"]
3434
create_branch_policies: "true"
3535

3636
# Basic Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform-complete-vnext.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ azure_devops_project_name: "<azure-devops-project-name>"
3030
use_self_hosted_agents: "true"
3131
use_private_networking: "true"
3232
allow_storage_access_from_my_ip: "false"
33-
apply_approvers: "<email-address-list>"
33+
apply_approvers: ["<email-address>"]
3434
create_branch_policies: "true"
3535

3636
# Complete vNext Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform-complete.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ azure_devops_project_name: "<azure-devops-project-name>"
3030
use_self_hosted_agents: "true"
3131
use_private_networking: "true"
3232
allow_storage_access_from_my_ip: "false"
33-
apply_approvers: "<email-address-list>"
33+
apply_approvers: ["<email-address>"]
3434
create_branch_policies: "true"
3535

3636
# Complete Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-azure-devops-terraform-hubnetworking.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ azure_devops_project_name: "<azure-devops-project-name>"
3030
use_self_hosted_agents: "true"
3131
use_private_networking: "true"
3232
allow_storage_access_from_my_ip: "false"
33-
apply_approvers: "<email-address-list>"
33+
apply_approvers: ["<email-address>"]
3434
create_branch_policies: "true"
3535

3636
# Hub Networking Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-github-bicep-complete.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ postfix_number: "1"
2727
use_self_hosted_runners: "true"
2828
use_private_networking: "true"
2929
allow_storage_access_from_my_ip: "false"
30-
apply_approvers: "<email-address-list>"
30+
apply_approvers: ["<email-address>"]
3131
create_branch_policies: "true"
3232

3333
# Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-github-terraform-basic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ postfix_number: "1"
2727
use_self_hosted_runners: "true"
2828
use_private_networking: "true"
2929
allow_storage_access_from_my_ip: "false"
30-
apply_approvers: "<email-address-list>"
30+
apply_approvers: ["<email-address>"]
3131
create_branch_policies: "true"
3232

3333
# Basic Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-github-terraform-complete-vnext.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ postfix_number: "1"
2727
use_self_hosted_runners: "true"
2828
use_private_networking: "true"
2929
allow_storage_access_from_my_ip: "false"
30-
apply_approvers: "<email-address-list>"
30+
apply_approvers: ["<email-address>"]
3131
create_branch_policies: "true"
3232

3333
# Complete vNext Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-github-terraform-complete.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ postfix_number: "1"
2727
use_self_hosted_runners: "true"
2828
use_private_networking: "true"
2929
allow_storage_access_from_my_ip: "false"
30-
apply_approvers: "<email-address-list>"
30+
apply_approvers: ["<email-address>"]
3131
create_branch_policies: "true"
3232

3333
# Complete Starter Module Specific Variables

docs/wiki/examples/powershell-inputs/inputs-github-terraform-hubnetworking.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ postfix_number: "1"
2727
use_self_hosted_runners: "true"
2828
use_private_networking: "true"
2929
allow_storage_access_from_my_ip: "false"
30-
apply_approvers: "<email-address-list>"
30+
apply_approvers: ["<email-address>"]
3131
create_branch_policies: "true"
3232

3333
# Hub Networking Starter Module Specific Variables

0 commit comments

Comments
 (0)