-
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
helper/schema: Additional Go documentation for Resource and Schema types #912
Conversation
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 great, but I left some comments that could help clarify or enrich even further some passages.
Awesome stuff.
helper/schema/resource.go
Outdated
// The *ResourceData parameter contains the plan and state data for this | ||
// managed resource instance. The available data in the Get* methods is the | ||
// the proposed state, which is the merged data of the practitioner | ||
// configuration and any CustomizeDiff field logic. The SetId method must |
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.
How would you feel about having the part The SetId method must be called...
on it's own paragraph, instead of being part of this one?
It's just so to highlight it prominently.
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.
Sounds good, I'll do that here and below.
|
||
// When Deprecated is set, this attribute is deprecated. | ||
// ExactlyOneOf is a set of attribute paths, including this attribute, |
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.
... including this attribute, ...
Will Terraform error if one sets the ExactlyOneOf
inconsistently across the involved attributes? Will it notice if one omits the current attribute?
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.
Will Terraform error
AtLeastOneOf
, ConflictsWith
, ExactlyOneOf
, and RequiredWith
are SDK-only validation implementations.
if one sets the ExactlyOneOf inconsistently across the involved attributes
Inconsistent ExactlyOneOf
implementations across attributes will result in the superset "winning". For example,
"attr1": {
ExactlyOneOf: []string{"attr1", "attr2", "attr3"}
},
"attr2": {
ExactlyOneOf: []string{"attr1", "attr2", "attr3"}
},
"attr3": {
ExactlyOneOf: []string{"attr2", "attr3"}
},
Will trigger the validation error from attr1 and attr2 if attr1 and attr3 are both configured.
Will it notice if one omits the current attribute?
"attr1": {
ExactlyOneOf: []string{"attr2", "attr3"}
},
"attr2": {
ExactlyOneOf: []string{"attr1", "attr3"}
},
"attr3": {
ExactlyOneOf: []string{"attr1", "attr2"}
},
Will trigger all three validation errors if any two are configured.
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 #467
Closes #601
Closes #705
Closes #735
This also spends some cycles fixing the Go documentation for struct fields to be aligned with each field individually, so pkg.go.dev and the Go language server can appropriately show the matching documentation.