Using the region passed as gh workflow input
This commit is contained in:
Родитель
df60e78fe6
Коммит
b2ecf7b292
|
@ -122,7 +122,7 @@ jobs:
|
|||
else
|
||||
./terraform init -upgrade
|
||||
fi
|
||||
eval ./terraform plan ${parameter_files} -var 'tags={repo_environment=\"$ENVIRONMENT\"}' -out tfdeployplan
|
||||
eval ./terraform plan ${parameter_files} -var 'tags={repo_environment=\"$ENVIRONMENT\"}' -var 'regions=[\"${{ github.event.inputs.REGION\"]' -out tfdeployplan
|
||||
|
||||
- name: Deploy Standalone
|
||||
if: ${{ github.event.inputs.DEPLOY == 'true' }}
|
||||
|
@ -171,7 +171,7 @@ jobs:
|
|||
parameter_files=$(find configuration -not -path "*launchpad*" | grep .tfvars | sed 's/.*/-var-file &/' | xargs)
|
||||
echo "parameter_files: ${parameter_files}"
|
||||
|
||||
eval ./terraform plan ${parameter_files} -var 'tags={repo_environment=\"$ENVIRONMENT\"}' -destroy -out tfdestroyplan
|
||||
eval ./terraform plan ${parameter_files} -var 'tags={repo_environment=\"$ENVIRONMENT\"}' -var 'regions=[\"${{ github.event.inputs.REGION\"]' -destroy -out tfdestroyplan
|
||||
|
||||
- name: Diagnostics purge
|
||||
if: ${{ github.event.inputs.DESTROY == 'true' }}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
locals {
|
||||
global_settings = length(var.regions) == 0 ? var.global_settings : {
|
||||
default_region = "region1"
|
||||
regions = { for region in var.regions : "region${index(var.regions, region) + 1}" => region }
|
||||
passthrough = true
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ module "caf" {
|
|||
providers = {
|
||||
azurerm.vhub = azurerm.vhub
|
||||
}
|
||||
global_settings = merge((var.override_prefix == "" ? {} : { prefix = var.override_prefix }), var.global_settings)
|
||||
global_settings = merge((var.override_prefix == "" ? {} : { prefix = var.override_prefix }), local.global_settings)
|
||||
logged_user_objectId = var.logged_user_objectId
|
||||
tags = var.tags
|
||||
resource_groups = var.resource_groups
|
||||
|
|
|
@ -6,11 +6,17 @@ variable "global_settings" {
|
|||
random_length = 4
|
||||
default_region = "region1"
|
||||
regions = {
|
||||
region1 = "southeastasia"
|
||||
region1 = "eastus"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "regions" {
|
||||
description = "global_settings Azure regions comma separated"
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "resource_groups" {
|
||||
default = {}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче