-
Notifications
You must be signed in to change notification settings - Fork 401
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
Make CustomizableSchema work for Plugin Framework #3819
Make CustomizableSchema work for Plugin Framework #3819
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.
I think if it's possible to use a common interface, then we can remove lots of redundancy since we are doing the same operation for each attribute type in SetOptional, SetRequired, SetSensitive and SetDeprecated.
func (s *CustomizableSchemaPluginFramework) SetRequired(path ...string) *CustomizableSchemaPluginFramework { | ||
cb := func(a schema.Attribute) schema.Attribute { | ||
switch attr := a.(type) { | ||
case schema.SingleNestedAttribute: |
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 all types perform the same operation, it might be good if we can club them together using a common interface
} | ||
|
||
func (s *CustomizableSchemaPluginFramework) SetSensitive(path ...string) *CustomizableSchemaPluginFramework { | ||
cb := func(a schema.Attribute) schema.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.
same here
|
||
// Helper function for navigating through schema attributes, panics if path does not exist or invalid. | ||
func navigateSchema(s *schema.Attribute, path ...string) (schema.Attribute, error) { | ||
cs := s |
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.
using descriptive variable naming might be helpful in code readability.
1562784
into
terraform-plugin-framework
Changes
Tests
make test
run locallydocs/
folderinternal/acceptance