-
Notifications
You must be signed in to change notification settings - Fork 232
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
SetNew does not work on nested fields #459
Comments
Hi, the referenced change 1e08e98#diff-5572654f34bded06e0d3e5eb9ed7d1bf does not really remove any capability to update nested fields, it only catches the error earlier. Before that change, an error was triggered in the field writer implementation.
|
Right, I see. I wonder what the recommended approach would be when this use-case is required |
This still doesn't work with the V2 of the SDK. |
Can anyone speak to whether this is a limitation in Terraform or in the SDK (or in protocol 5, which seems unlikely)? I'm wondering if porting to use a different plugin framework would help. |
Hi @joey-squid 👋 It very likely is only an issue with terraform-plugin-sdk (also where this specific error message is being generated). Terraform has some data consistency rules around plan modifications (e.g. you cannot change a configured value to a different planned value), but otherwise will let you fill in or update computed values regardless of whether it is under a nested block or not. Provider code based on terraform-plugin-framework performing plan modification should not run into this type of problem unless it is something disallowed by Terraform itself. |
SDK version
Use-cases
Currently, trying to set any nested (computed) field value in a
CustomizeDiff
function will fail due to a hardcodedfalse
value ond.checkKey()
inschema.ResourceDiff.SetNewComputed()
andschema.ResourceDiff.SetNew()
.This seems to have been changed in commit 1e08e98. Not entirely sure why this change was made, and in any case, the Elasticsearch property is a list, but not a computed one, so not even that would be possible to Get and Set.
My use case is having global values in resources which are used to override nested values.
Proposal
Make
SetNewComputed
andSetNew
able to set items on a list.The text was updated successfully, but these errors were encountered: