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

all: Add acceptance tests for write-only attributes #293

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Jan 10, 2025

This PR is in draft as the target code for the tests are also in draft 👍🏻

This PR contains some tests for write-only attributes, which will be available in Terraform v1.11.0, and are actively being worked on in the provider SDKs:


The SDKv2 + Framework tests cover:

  • Retrieving write-only values and ensuring providers are unable to send write-only data back to Terraform
    • Trying to cover the different type/attribute combinations (blocks, nested, collections, etc.)
  • Performing validation and plan modification logic on write-only attributes

The Protocol (terraform-plugin-go) tests cover:

  • Testing Terraform's new data rules for write-only attributes in all RPCs that have state values returned
  • Testing Terraform's new data rules for write-only attributes when indicating the legacy type system (SDKv2) is used (only Plan + Apply)

Notes

  • There are a couple TODOs left in the PR that are waiting on fixes either in TF core or the WIP SDKv2/Framework PRs. I wrote the test assertion in the reverse to pop an error once those bugs are fixed 👍🏻

Comment on lines +14 to +17
github.com/hashicorp/terraform-plugin-go v0.25.1-0.20241217173851-dcf8f64dbfaa
github.com/hashicorp/terraform-plugin-mux v0.17.1-0.20241217174601-fdf2e5e009de
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.1-0.20250103201413-5f29273ad6f0
github.com/hashicorp/terraform-plugin-testing v1.11.1-0.20250102212914-99297ce85154
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update with released versions once available

github.com/hashicorp/go-memdb v1.3.4
github.com/hashicorp/terraform-json v0.24.0
github.com/hashicorp/terraform-plugin-framework v1.13.0
github.com/hashicorp/terraform-plugin-framework v1.13.1-0.20250102211725-428efefe5acc
Copy link
Member Author

@austinvalle austinvalle Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update with released version once available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants