Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Provider produced inconsistent final plan for local_file #57

Open
unladenSwallow opened this issue Jan 29, 2021 · 2 comments
Open

Comments

@unladenSwallow
Copy link

unladenSwallow commented Jan 29, 2021

Hi there,

Terraform Version

Currently upgrading to 0.13.0 before upgrading fully to latest (also tested on 0.14.2 with the same results)

We are upgrading from 0.10.7

Affected Resource(s)

Please list the resources as a list, for example:

  • local_file

Panic Output

Error: Provider produced inconsistent final plan

When expanding the plan for local_file.output2 to include new values learned
so far during apply, provider "registry.terraform.io/hashicorp/local" produced
an invalid new value for .content: was cty.StringVal("<a_number>") , but now
cty.StringVal("<a_number + 1>").


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

time="2021-01-29T20:00:51Z" level=fatal msg="Failed to execute a command" error="exit status 1"

Expected Behavior

Terraform plan should succeed because this is a local file.

Actual Behavior

Terraform plan failed due to a version being incremented by 1 in the local file.

Steps to Reproduce

We run this in a CI pipeline (Drone) using (jmcann/drone-terraform plugin)[https://github.com/jmccann/drone-terraform]
The step that runs right before this error occurs is:
$ terraform plan -out=plan.tfout -var env=dev -var service_name=dev -lock=true -lock-timeout=300s

Important Factoids

We do not run plan or apply locally, only in the CI pipeline. Because we are using the above plugin our configuration options are limited to what the plugin includes).

We are using the local file only to hold the most recent version of another provider we use in Terraform. It contains only this information.

We define it as shown:

resource "local_file" "local_file" {
  content  = "${fastly_service_v1.service.active_version}"
  filename = "<path>"
}

I have tried adding:

  lifecycle {
    ignore_changes = [content]
  }

but that did not fix it. So, I then tried to force it to create a new local file resource:

resource "local_file" "local_file2" {
  content  = "${fastly_service_v1.service.active_version}"
  filename = "<path>"

  lifecycle {
    ignore_changes = [content]
  }
}

but, it still compared against the old local_file and failed in the same way. I have also tried using the keyword all for ignore_changes. So far, I have not been able to find a workaround.

References

I could not find references to this in other issues but would be happy to be pointed to one if it exists.

@unladenSwallow
Copy link
Author

I should note that we did not see this error prior to updating to 0.13.0

@unladenSwallow
Copy link
Author

unladenSwallow commented Mar 4, 2021

update: I did eventually find a workaround by using a null_data_source as an intermediary value, forcing the plan not to attempt to read the local_file value. This is only a temporary fix, however, as null_data_source is depracated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants