Skip to content

Incorrect "Provider produced inconsistent final plan" error, changing CreateThenDelete to DeleteThenCreate. #26180

@jbardin

Description

@jbardin

When a resource that is planned to be CreateThenDelete because of a forced created_before_destroy from another resource, but the create_before_destroy resource has no changes, the apply process is losing the CreateThenDelete portion of the plan.

For example:

resource "null_resource" "a" {
  triggers = {
    version = "1"
  }
}

resource "null_resource" "b" {
  depends_on = [null_resource.a]
  lifecycle {
    create_before_destroy = true
  }
}

Applying this once, and changing resource a's version will cause null_resource.a to produce an invalid plan:

Error: Provider produced inconsistent final plan

When expanding the plan for null_resource.a to include new values learned so
far during apply, provider "registry.terraform.io/hashicorp/null" changed the
planned action from CreateThenDelete to DeleteThenCreate.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

This is erroneously attributed to the provider, but there is nothing the provider can do to modify the plan action for individual resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmeda Terraform Core team member has reproduced this issuecoreexplaineda Terraform Core team member has described the root cause of this issue in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions