This will enable users to leverage management group scoped service connections for azurerm backends. A new input has been added to specify the subscription id when using management group scope. Management group scoped service connections do not define a subscription id. Terraform requires the subscription id be defined and, the ensureBackend operations require the subscription id. Therefore, it must be provided when using management group scope.
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'terraform init'
inputs:
command: init
workingDirectory: $(terraform_templates_dir)
backendType: azurerm
# Specify a management group scoped service connection
backendServiceArm: 'env_test_mgmt'
# Define the target subscription that houses the terraform backend
backendAzureRmSubscriptionId: $(azure_subscription_id)
If ensureBackend is set, the subscription defined in backendAzureRmSubscriptionId will be used to determine in what subscription the resource group and storage account are created.
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'terraform init'
inputs:
command: init
workingDirectory: $(terraform_templates_dir)
backendType: azurerm
# Specify a management group scoped service connection
backendServiceArm: 'env_test_mgmt'
# Define the target subscription that houses the terraform backend
backendAzureRmSubscriptionId: $(azure_subscription_id)
ensureBackend: true
backendAzureRmResourceGroupName: 'my-backend-resource-group'
backendAzureRmResourceGroupLocation: eastus
backendAzureRmStorageAccountName: 'my-backend-storage-account'
backendAzureRmStorageAccountSku: Standard_RAGRS
backendAzureRmContainerName: 'my-backend-blob-container'
backendAzureRmKey: infrax.tfstate
Related #20
This will enable users to leverage management group scoped service connections for azurerm backends. A new input has been added to specify the subscription id when using management group scope. Management group scoped service connections do not define a subscription id. Terraform requires the subscription id be defined and, the
ensureBackend
operations require the subscription id. Therefore, it must be provided when using management group scope.If
ensureBackend
is set, the subscription defined inbackendAzureRmSubscriptionId
will be used to determine in what subscription the resource group and storage account are created.