-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Remove resource state attributes that are no longer in the schema #25779
Conversation
While removal of attributes can be handled by providers through the UpgradeResourceState call, data sources may need to be evaluated before reading, and they have no upgrade path in the provider protocol. Strip out extra attributes during state decoding when they are no longer present in the schema, and there is no schema upgrade pending.
The validate command should work with the configuration, but when validate was run at the start of a plan or apply command the state was inserted in preparation for the next walk. This could lead to errors when the resource schemas had changes and the state could not be upgraded or decoded.
A number of tests had invalid configs or providers, but were never properly validated
Codecov Report
|
@@ -1,5 +1,5 @@ | |||
variable "foo" {} | |||
|
|||
resource "test_instance" "foo" { | |||
value = "${var.foo}" | |||
value = var.foo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice update
Is there any ETA on .13.1 release? Gasping for my TF stacks to work again 👍 |
Yes, please release a new version! |
So now, if I import some resource that was created in other way and possibly modified, I have no clue which attributes were set to which values? If I destroy it and recreate it with Terraform then this resource can have different attributes' values. That is not a bugfix, that is a breaking change and should be loudly advertised. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
While removal of attributes can be handled by providers through the
UpgradeResourceState call, data sources may need to be evaluated before
reading, and they have no upgrade path in the provider protocol.
Strip out extra attributes during state decoding when they are no longer
present in the schema, and there is no schema upgrade pending. If there
is a pending schema upgrade, let the provider handle it since it may want to
check for the removed attribute values.
Another option not explored here is declaring that providers must migrate
any attributes pending removal before they actually removed, which would
allow the possibility of making the decoder less strict and always strip out
unknown attributes (similar to
encoding/json
). Since we canhandle the case fully within core, it seems reasonable to let the decoder be
as strict as possible, though it might be useful to implement the functionality
upstream for other projects using zclconf.
The validate command should work only with the configuration, but when
validate was run at the start of a plan or apply command the state was
inserted in preparation for the next walk. This could lead to errors
when the resource schemas had changes and the state could not be
upgraded or decoded.
Fixes #25752