-
Notifications
You must be signed in to change notification settings - Fork 99
Implement validation logic for "identityschema.ListAttribute" #1125
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
Conversation
4463c26 to
d92419d
Compare
austinvalle
left a comment
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.
Looking good 👍🏻 , I have some suggestions for the case switch + diagnostic messaging, but all the functionality looks correct!
7062e88 to
66ae7b6
Compare
…ure it is an allowed primitive
Co-authored-by: Austin Valle <[email protected]>
Co-authored-by: Austin Valle <[email protected]>
66ae7b6 to
49ed817
Compare
austinvalle
left a comment
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.
Just had one small adjustment to the error message, great work on this! 🙌🏻
Co-authored-by: Austin Valle <[email protected]>
Co-authored-by: Austin Valle <[email protected]>
Co-authored-by: Austin Valle <[email protected]>
Co-authored-by: Austin Valle <[email protected]>
Most of the “invalid” identity attribute types are simply not possible to create with Framework (without abusing custom types, which we can safely ignore imo) because we have a dedicated “identityschema” package: https://github.com/hashicorp/terraform-plugin-framework/tree/main/resource/identityschema
The lone validation we need to apply at runtime is checking the element type of the “identityschema.ListAttribute” since there is no restriction on what kind of “attr.Type” is provided. The only allowed element types are:
types.Bool
types.Int64, types.Int32, types.Float64, types.Float32, types.Number
types.String
The validation was done in the ValidateImplementation function which runs during GetResourceIdentitySchemas.
Added AttributeInvalidElementTypeDiag to give the error message and IsAllowedPrimitiveType to check to see if the element is an allowed type.