3
votes

I have already created Azure virtual networks and resource groups manually. I am going to create a VM using Terraform and deploy it via Azure DevOps.My Terraform state file resides in an Azure Storage account. Currently, it is blank. I need to import the existing virtual network and resource groups into the state file. I am able to do the Terraform initialize, plan and apply using the release pipelines but I am not able to find a task in the release pipeline to import terraform. I can import using my VSCode, but I need to do this import using Azure DevOps.

Could someone let me know if that is possible? Thanks in advance

2

2 Answers

0
votes

This Azure Pipelines extension claims to support Terraform import: Terraform Tasks

0
votes

Can we run terraform import in Azure DevOps release pipeline

I am afraid there is no such out of box task to run terraform import in Azure DevOps release pipeline at this moment.

There is user voice about it on Developer Community:

Support for Terraform Import

It would be great if we are creating infrastructure via the Azure Portal to then be able to bring those resources into Terraform state management via a simple Terraform import task rather than attempting to call this in a PowerShell/Bash/Azure CLI script. Currently the Terraform task supports plan, init, apply etc. But not import

You could vote and add your comments for this feedback.