I have been writing some terraform and using Azure Devops to deploy the pipeline. However if I use a variable $(serviceconnection) for the service connection it fails with the following error:
There was a resource authorization issue: "The pipeline is not valid. Job DeployDev: Step TerraformCLI1 input backendServiceArm references service connection $(serviceconnection) which could not be found. The service connection does not exist or has not been authorized for use. I Have tried authorising it but no luck. Is there any workaround?
The task is a YAML task to use terraform as below :
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'Terraform Init'
inputs:
command: init
workingDirectory: $(Agent.BuildDirectory)/a/azuredirectory/terraform
backendType: azurerm
backendServiceArm: $(serviceconnection)
backendAzureRmResourceGroupName: $(ResourceGroupName)
backendAzureRmStorageAccountName: $(StorageAccountName)
backendAzureRmContainerName: $(ContainerName)
backendAzureRmKey: $(AzureRmKey)