Azure DevOps Microsoft Terraform Task and Terraform 0.15 issue

If you are using the Microsoft Terraform task to deploy resources you may currently be seeing issues.  You will be impacted if you have not pinned the Terraform version using the Terraform installer task for your own Agent or the Azure DevOps hosted agents. The Azure DevOps hosted agents are starting to use version 0.15 of Terraform,  Hashicorp made a change to the way Terraform works as per this article;


They removed the prefix `arm_` the old names were previously deprecated but have been removed in Terraform v0.15.  This was done a while ago but the task has not been updated to accommodate the new values

Old                                  New
arm_client_id                  client_id
arm_client_secret          client_secret
arm_subscription_id      subscription_id
arm_tenant_id                 tenant_id

You may be seeing issues like this in your pipeline;


The Azure DevOps tasks is not yet supporting the new arguments. There is an open issue to update the task https://github.com/microsoft/azure-pipelines-extensions/pull/889 .  

Workaround


In the meantime if you use the Azure DevOps Terraform installer task to pin the Terraform version used on the Azure DevOps agent or your own agent you you can get round the issue for now by not using Terraform 0.15.  If you configure the Terraform installer task to anything up to 0.14.10 you should be ok;


- task: TerraformInstaller@0
inputs:
terraformVersion: '0.14.10'


If you want to use Terraform 0.15 urgently you will have need to use another method like the command line to deploy your resources and ensure your values are updated as per the below.

If you are not using the Microsoft Terraform task but are just using command line to deploy your resources you may still be affected if you are using the old arguments.  Review your deployment scripts to ensure these are using the latest arguments like below;

Old arguments;

terraform init 
-backend-config=arm_subscription_id=***
-backend-config=arm_tenant_id=*** 
-backend-config=arm_client_id=*** 
-backend-config=arm_client_secret=***

New arguments;

terraform init 
-backend-config=subscription_id=***
-backend-config=tenant_id=*** 
-backend-config=client_id=*** 
-backend-config=client_secret=***

I hope this helps you to get past these issues and continue with your deployments.

Comments

Popular posts from this blog

Working with WSL and AKS

Azure Kubernetes Service (AKS) and Managed Identities

Terraform Functions - Part 4 - Advanced count and conditional expressions