-
Notifications
You must be signed in to change notification settings - Fork 135
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
(TF-18290) Early validation for Terraform Stack files #1776
Conversation
98798d7
to
1ebed82
Compare
059eef6
to
7d4b95d
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.
Just two small questions – but it's looking good for all that I understand!
internal/features/stacks/decoder/validations/missing_required_attribute.go
Outdated
Show resolved
Hide resolved
7d4b95d
to
c053e17
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.
Nice draft! I left some thoughts
internal/features/stacks/decoder/validations/missing_required_attribute.go
Show resolved
Hide resolved
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.
This looks really good! Just a few small cleanup things mostly.
I'm fine with having just one decoder for didChange
events 👍 We might need to change that once we support references between stack and deployment files (for inputs) but that's for later!
internal/features/stacks/decoder/validations/missing_required_attribute.go
Show resolved
Hide resolved
fa30c00
to
625c109
Compare
This change enables early validation for Terraform Stacks in tfstack. hcl and tfdeploy.hcl files. Available validations: - Missing required attributes - Deprecated attributes - Deprecated blocks - Unexpected attributes - Unexpected blocks - Maximum number of blocks - Minimum number of blocks - Block labels length This adds a new job to validate the schema of the these files. The job is enqueued when the `EnableEnhancedValidation` option is set to true.
TODO: Revist checking Stack concepts in the static validators Other validators are more generic and can be applied to any block/attribute/etc, but this one is specific to the stack block types. I'm sure this could be done in a more generic way, but I'm not sure if it's worth it at the moment. The names of these blocks are used as identifiers in the stack and are used in the UI, so they have to be valid Terraform identifiers or else the stack will not be able to be created. This is a very basic check to ensure that the names are valid until we can do more advanced checks or use the cloud api. I tried adding this to the earlydecoder, but we do not seem to report the diagnostics there at all currently, so nothing was being reported. I'm not sure if that's a bug or intended.
625c109
to
d438014
Compare
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 issues. |
This change enables early validation for Terraform Stacks in tfstack. hcl and tfdeploy.hcl files.
Available validations:
This adds a new job to validate the schema of the these files. The job is enqueued when the
EnableEnhancedValidation
option is set to true.