-
Notifications
You must be signed in to change notification settings - Fork 96
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 Framework allows top-level schema attributes that conflict with Terraform meta-arguments #548
Conversation
…ma and to provider metaschema to prevent the use of reserved names for top-level attributes and blocks and invalid names for attributes and blocks at any level of nesting (#136)
50bf535
to
b13eb0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚀 Just little things to followup on.
attributes := nestedObject.GetAttributes() | ||
|
||
for k, v := range attributes { | ||
d := validateAttributeFieldName(path.AtName(k), k, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the nested attributes might be done using list, map, or set mode, we'll also need to account for adding those intermediate steps (AtListIndex, AtMapKey, AtSetValue) to the path. We're not looking at a real configuration though, so it's a little awkward to make it "correct", although Terraform likely won't show the source configuration matching the path information when it is returned by the GetProviderSchema RPC.
Let's create a followup issue, but we should likely try to fix up this path information and consider including it in the diagnostic details in case it is not in Terraform's output. Maybe we can use something like the zero-value (e.g. AtListIndex(0)
, AtMapKey("")
, AtSetValue(/* ? */)
) for describing those intermediate path steps for static validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocks := nestedObject.GetBlocks() | ||
|
||
for k, v := range blocks { | ||
d := validateBlockFieldName(path.AtName(k), k, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly for block pathing and block nesting modes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Brian Flad <[email protected]>
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes: #136
Once all references to
tfsdk.Schema
have been removed we can ammendfwschema/schema.go
: