-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Terraform cannot convert targeted plan to json output #23297
Comments
@cr-zlilaharon I have tried to reproduce this an I think I need a specific TF config in order to reproduce it. Here's what I've done, using terraform 0.12.17: I used a simple terraform config with one resource: provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "foo" {
ami = "ami-40d1f038" // Amazon linux HVM instance store
instance_type = "t2.micro"
} Then I ran a plan with terraform plan -target=aws_instance.foo -out plan.bin
terraform show -json plan.bin > plan.json
|
I'm seeing something similar but the error is |
I'm seeing one or the other of the following when running
Using:
|
@mpereira please note that the |
@bflad upgrading the Terraform AWS Provider to version 2.62.0 fixed the issue, thank you so much! |
Hi. I had the same problem and I realized after execute a
I hope It could help you |
Hi all, Based on the more recent comments about this error it seems like this problem could be caused when an argument is removed from a resource type schema in a provider. My theory -- not yet proven -- is that by running with If this is the cause, the solution is unfortunately likely to be a bit tricky. Terraform generally assumes that all existing resource instances will be updated to the latest schema as part of the refresh phase, and the A more tactical fix we could try is to have the |
worked for me |
In my case. I ran my plan while using this on my main.tf provider "aws" { then I removed version = " |
I observed this same error today using
I updated to |
When I hit this issue, it was related to attempting to get the JSON form of a plan that had been generated by a different version of a provider. Specifically, this was due to copying a plan saved by a CI server to my workstation which is admittedly a bit of an edge-case. Slightly confusingly, generating a non-JSON form of this plan worked correctly. |
after running into this same issue after clearing cache and lock file the |
Error Output
Failed to marshal plan to json: error marshaling prior state: unsupported attribute "purpose"
Expected Behavior
terraform should have parsed the default plan file to json output.
Actual Behavior
Failed to marshal plan to json: error marshaling prior state: unsupported attribute "purpose"
No json output generated
Steps to Reproduce
Additional Context
This is the full command I actually run:
Also, when planning without a -target, this works as expected.
This is my first issue , please let me know if I need to add anything else.
The text was updated successfully, but these errors were encountered: