State Migration from Azure Blog to Terraform Cloud

Hi All,

I am having a real headache trying to migrate my state file from Azure Blob to TFC.

I am running terraform in an Azure Devops yaml pipeline, when the init task runs it completes fine and a state is shown in TFC, however when the plan runs, it returns that all resources are new and subsequently when running the apply it fails with the existing resource import message.

Where am I going wrong, i have tried all the switches that go with -init (migrate-state…….”

Pre Migrate Azure Backend: -
backend “azurerm” {
resource_group_name = “”
storage_account_name = “”
container_name = “”
key = “”
access_key = “”
}

Post Migrate Cloud Backend: -
cloud {
organization = “”
workspaces {
name = “”
}
token = “”
}

Pipeline Task: -

task: TerraformCLI@2
name: trfm_init
displayName: “trfm : init”
inputs:
command: ‘init’
workingDirectory: ‘$(System.DefaultWorkingDirectory)/terraform’
commandOptions: ‘-upgrade’

Any advise much appreciated

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.