Skip to content

Terraform remote state push -force fails lineage check for S3 backend #25761

@ConnorGraham

Description

@ConnorGraham

Terraform Version

v0.12.29

Expected Behavior

The state should be pushed to the remote and forced over any existing state

Actual Behavior

$ tf state push -force B.tfstate
Failed to write state: cannot import state with lineage "c65f30fe-24db-19f7-43c8-bd29fb644be5" over unrelated state with lineage "bfeaceb5-75f6-5a22-5068-bc488243b268"

Steps to reproduce

I am using an s3 backend

terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    region = "us-east-1"
  }
}
terraform workspace new A || terraform workspace select A
terraform apply -auto-approve
terraform state pull > A.state

terraform workspace new B || terraform workspace select B
terraform apply -auto-approve
terraform state pull > B.state

terraform workspace select A
terraform state push -force B.state

References

#5663
#15674
#24916

Metadata

Metadata

Assignees

Labels

bugconfirmeda Terraform Core team member has reproduced this issuecore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions