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

CustomizeDiff functionality in framework #859

Closed
JakeNeyer opened this issue Oct 13, 2023 · 3 comments
Closed

CustomizeDiff functionality in framework #859

JakeNeyer opened this issue Oct 13, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@JakeNeyer
Copy link

Module version

github.com/hashicorp/terraform-plugin-framework v1.4.1

Use-cases

Perhaps this functionality already exists in the new framework under a different pattern. In which case, maybe all that is needed is a link to some documentation.

I'm currently working with an api (for better or worse) that will return masked values given a clear text value. For example, given api_key: foobar the response will contain api_key: ******. This lends issues when applying due to state inconsistencies as the framework returns something along the lines of .configuration.api_key: was cty.StringVal("foobar"), but now cty.StringVal("******"). I see that sdkv2 had the ability to handle such cases by customizing diffs. It would be useful if similar functional was exposed in the new framework.

Attempted Solutions

I attempted to completely omit the response values from state which kind of works. One of the consequences of doing so means that imports will be updated in-place on the next apply.

Proposal

Expose the ability to ignore inconsistent state on the schema.Attribute interface. Maybe this could surface as an option like Computed, Required, etc. (IgnoreInconsistent) or perhaps this functionality acts more closely to the CustomizeDiff functionality where it's a function attached to schema.Attribute similar to the planmodifiers.

References

N/A

@JakeNeyer JakeNeyer added the enhancement New feature or request label Oct 13, 2023
@bendbennett
Copy link
Contributor

Hi @JakeNeyer 👋

Sorry you ran into trouble here. There is information in the documentation relating to migrating a Terraform provider from SDKv2 to the plugin Framework, that covers switching from using a CustomizeDiff in SDKv2 to using Plan Modification in the Framework. Hopefully this will prove useful. If you have specific questions could I ask you to create a new topic on the Terraform Providers Discuss Forum, providing as much detail as is needed to reproduce any issues that you are running into. Thanks!

I'm going to close this as it doesn't seem that there is an issue with the Framework at this point.

@JakeNeyer
Copy link
Author

This is super helpful. Thanks kindly, @bendbennett!

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants