Skip to content

Terraform state push with -force flag does not work #26224

@saguziel

Description

@saguziel

Terraform Version

Terraform v0.13.2
+ provider registry.terraform.io/hashicorp/aws v3.4.0
+ provider registry.terraform.io/hashicorp/external v1.2.0
+ provider registry.terraform.io/hashicorp/kubernetes v1.12.0
+ provider registry.terraform.io/hashicorp/random v2.2.1
+ provider registry.terraform.io/hashicorp/template v2.1.2
+ provider registry.terraform.io/oktadeveloper/okta v3.4.1
+ provider registry.terraform.io/terraform-providers/okta v3.5.0

This is using the s3 backend

Expected Behavior

Running terraform state push -force should ignore serial check.

Actual Behavior

Running terraform state push -force <file> returns Failed to write state: cannot import state with serial 70 over newer state with serial 172, but as stated in the documentation Both of these safety checks can be disabled with the -force flag.

Steps to Reproduce

  1. Have existing terraform repo
  2. terraform state pull > $filename
  3. terraform apply (something that is NOT no-op)
  4. terraform state push $filename (gets rejected due to higher serial)
  5. terraform state push -force $filename (serial check should be ignored, but is not)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugduplicateissue closed because another issue already tracks this problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions