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

Fix Provider returned invalid result object after apply errors #1363

Merged
merged 26 commits into from
Jan 18, 2024

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Dec 11, 2023

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Fixes Provider returned invalid result object after apply errors on Create for numerous resources.
This error was caused by unknown values being present in state after the resource was successfully created. In particular, unknown values in SetNestedAttributes were not being populated from the resource's current (post-creation) state.

Closes #960.
Closes #1280.
Closes #1279.
Closes #1039.
Closes #811.
Closes #799.
Closes #719.
Closes #545.

@bflad
Copy link
Contributor

bflad commented Dec 13, 2023

Does the API 100% guarantee that all configured values are exactly preserved? If not, Terraform can/will start throwing data consistency errors if any planned value changes during apply.

@ewbankkit
Copy link
Contributor Author

Not it doesn't, and I discovered that pretty quickly when testing with IAM policy documents.
When I get time to get back to this I'm going to revert the "simplification" and look at the underlying unknown value copying problem.

@ewbankkit
Copy link
Contributor Author

The problem with unknown values not being populated in e.g. #960 is caused by the logic that copies current resource state to Terraform state being unable to match (and then overwrite) schema.SetNestedAttribute elements in the resource state (which contain no unknown values) with those in the Terraform state (which do contain unknown values).
It boils down to Data.TerraformValueAtTerraformPath calling tftypes.Value.ApplyTerraform5AttributePathStep calling tftypes.Value.deepEqual for a path step of type ElementKeyValue (i.e. a set element).

@ewbankkit ewbankkit changed the title Simplify setting unknown values after Create and Update Fixe Provider returned invalid result object after apply errors Jan 17, 2024
@ewbankkit ewbankkit changed the title Fixe Provider returned invalid result object after apply errors Fix Provider returned invalid result object after apply errors Jan 17, 2024
@ewbankkit ewbankkit added the bug label Jan 17, 2024
@ewbankkit ewbankkit merged commit ec85105 into main Jan 18, 2024
11 checks passed
@ewbankkit ewbankkit deleted the b-unknowns branch January 18, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment