As already stated in the title, this blog post shows a simple way to move Terraform state between Azure Blob Storage containers.
Terraform version: Terraform v1.3.7
Azure Storage Account kind: StorageV2 (general purpose v2)
To perform the move, proceed as follows:
- Execute
terraform init
with the actual terraform backend configuration - Execute
terraform apply
with the actual terraform backend configuration to ensure there are no changes pending - Adjust terraform backend config so that it points to the new Azure Blob Storage container
This will create a new state blob in the target Azure Blob Storage container - Copy blob content from old state blob to the new state blob
The content can be copied and pasted using the blob edit view in the Azure portal - Execute
terraform init
- Execute
terraform plan
That’s it. Almost too easy.
Important: the approach described above was verified with a state consisting of exactly one blob.
Leave a Reply