terraform-aws-tfstate-backend
terraform-aws-tfstate-backend copied to clipboard
Upgrading from <0.33.1 to >=0.33.1 requires state move for bucket
Describe the Bug
When upgrading from before version 0.33.1 to any version after 0.33.1:
count was added to the default bucket so a plan sees that the bucket does not exist and wants to remove it from state.
No where in the release notes or README does it mention needing to do a state move. Once you move the state to add an index a plan will show no changes needed:
terraform state mv module.tfstate-backend.aws_s3_bucket.default module.tfstate-backend.aws_s3_bucket.default[0]
Expected Behavior
A note in the 0.33.1 release about needing to perform the state move.
Steps to Reproduce
Steps to reproduce the behavior:
- Init a terraform project with
terraform-aws-tfstate-backendversion0.33.0 - Run terraform apply
- Change the
terraform-aws-tfstate-backendto version0.33.1 - Run terraform plan
- See error
Screenshots
N/A
Environment (please complete the following information):
Terraform v1.0.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.56.0
Additional Context
Add any other context about the problem here.
I thought newer versions of terraform correct for count logic added or subtracted from components as long as the count is either 1 or 0. Perhaps it is for a terraform version greater than 1.0.5?
Closing as fixed in Terraform v1.1. See note in Terraform documentation:
When you add
countto an existing resource that didn't use it, Terraform automatically proposes to move the original object to instance zero, unless you write an moved block explicitly mentioning that resource.