-
Notifications
You must be signed in to change notification settings - Fork 563
Introduce variable validation output into markdown table output. #675
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
base: master
Are you sure you want to change the base?
Conversation
go.sum
Outdated
github.com/rquadling/terraform-config-inspect v0.0.0-20230303172622-9dd357c8a974 h1:iUSNgwjav+yZfRPSGUyywed1cvQdJPw8HaDRR1TMfw0= | ||
github.com/rquadling/terraform-config-inspect v0.0.0-20230303172622-9dd357c8a974/go.mod h1:l8HcFPm9cQh6Q0KSWoYPiePqMvRFenybP1CH2MjKdlg= |
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 comment posted yesterday for the upstream terraform-config-inspect
libraries support on validation, doesn't look promising
hashicorp/terraform-config-inspect#74 (comment)
would it make sense to use a fork?
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'd be happy to maintain a fork, but I'm not an expert in Terraform or Go, but with help I'm happy to learn.
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've asked if there is any other option of having enhancements being maintained as a community fork or branch.
For me, the biggest issue is about trust. I COULD create the lib, but my experience in Go is not good enough to know if I've introduced something that will cause problems upstream. Having the package within the Hashicorp domain would, I hope, get a greater number of eyes on it and so better reviews, etc.
Another option is to resurrect https://github.com/terraform-docs/terraform-config-inspect.
@@ -12,10 +12,12 @@ | |||
{{- if .Config.Settings.Type }} Type |{{ end }} | |||
{{- if .Config.Settings.Default }} Default |{{ end }} | |||
{{- if .Config.Settings.Required }} Required |{{ end }} | |||
{{- if .Config.Settings.Required }} Validation |{{ end }} |
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.
Shouldn't this be Config.Settings.Validation?
c738f8d
to
40ea1fb
Compare
Hey, that'd be really fancy to have! Any chance to get this merged? |
The main problem is that the changes to terraform-docs also requires a change to another Hashicorp library that they will NOT accept PRs on. So I cloned it. And made the changes. But GoLang is not my primary language and so I'm needing community support on the fork (make sure I've set it up properly and keeping it upto date, but also working out the "releases" thing as ... again ... GoLang is really not my primary language). Once the fork of the blocked Hashicorp library is accepted (it could be moved and re-instate the Terraform Docs fork that got abandoned a long time ago), then this PR makes more sense. For me, the BIG advantage is that, for me, 'validation/error messages' become part of the auto-generated documentation. It means any module a developer builds, that has validation, they automatically show the possible errors to their users. It means you really only have to write the documentation about validations once. In code. Where it will be used. No need to manually update a manual or another README. This really does make a lot of sense. I just don't know how to shout about it loud enough to get help in getting in it, nor do I know what I've missed that is more "project" oriented. So anyone reading this comment and has SOME time to spare, please review and help me move it forward! I know that there are currently conflicts, but this is on 2 files I really don't know how to handle, as like I said, in GoLang, I'm a newbie! So please help!! |
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
…from rquadling/terraform-config-inspet Signed-off-by: Richard Quadling <RQuadling@GMail.com>
These formats already have content filtering, so adding filtering for validations seemed appropriate Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
The tests already had a PrintDescriptions, so added PrintValidations, and PrintEverything Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Whilst the variable_with_no_validation is just a standard string, it made sense to have one just for the set of 0, 1, and many validations. Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Signed-off-by: Richard Quadling <RQuadling@GMail.com>
The updates here were generated by `make docs`. Signed-off-by: Richard Quadling <RQuadling@GMail.com>
This was all done by hand as I didn't work out how to automate the updates and have version control check for things being wrong or inconsistent. Signed-off-by: Richard Quadling <RQuadling@GMail.com>
Description of your changes
Work in progress fix for #674.
This currently makes output like
which renders as ...
=========================================
Inputs
string
""
string
""
string
var.variable_with_two_validations must start with 'magic'.
=========================================
If anyone can provide pointers on what I need to do next (where/how tests are put together, what else to update, etc).