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

resource/schema: Add validation to prevent write-only attributes in sets and set based data #1095

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

SBGoods
Copy link
Contributor

@SBGoods SBGoods commented Feb 18, 2025

Write-only attributes when used with ephemeral data cannot be used within any set and set-based data due to limitations in Terraform Core. This PR adds validation to block write-only attributes from being used with sets, set nested attributes, and set nested blocks.

@SBGoods SBGoods requested review from a team as code owners February 18, 2025 22:53
@SBGoods SBGoods added this to the v1.14.0 milestone Feb 18, 2025
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
)

func TestContainsAllWriteOnlyChildAttributes(t *testing.T) {
t.Parallel()
tests := map[string]struct {
nestedAttr metaschema.NestedAttribute
Copy link
Member

Choose a reason for hiding this comment

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

😆 nice catch!

Copy link
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@SBGoods SBGoods merged commit ecd80f6 into main Feb 18, 2025
34 checks passed
@SBGoods SBGoods deleted the SBGoods/write-only-set-validation branch February 18, 2025 23:45
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