-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
[WIP] Add cli command to export provider/provisioner/resource schemas #3508
Conversation
This is a really interesting idea! Are there some standard formats this could support that would then allow its output to be used with existing tools to generate documentation? e.g. would it make sense for the JSON output to be JSON-schema compatible? I think there are a couple challenges here:
With all of that said, I really like the idea of Terraform's configuration model being more self-describing. In future it might make it easier to keep docs in sync with implementation, and in the further future it may allow more sophisticated tools for working with Terraform configurations, allowing automation or interactive configuration. I'm going to add the "thinking" tag to this, which is a marker that this change requires some philosophy as well as code. 😀 |
Don't know about any of such formats. :( Swagger maybe?
If plugin is old and terraform core is new, error message would be shown instead of json (afaik).
Well, since new model uses just maps, arrays and strings any change into new schema class would be still binary backward compatible. Situation is different with Schema struct which already present in Terraform code (and used only in plugins). But there's a lot things to think and discuss.
Yep, it's second usage of this feature that come into my mind. |
@VladRassokhin how's this coming? looks like it needs to be updated to work with master |
@josephholsten I'm rebasing it from time to time to update schemas in my IntelliJ plugin, but have no spare time to finish this feature at the moment. |
What is the status of this PR? Is this something that can be closed? There hasn't been activity in a while Thanks Paul |
Initial version Providers and resources JSON output only Fix tests: add Export function to MockResourceProvider
Export only modified values Export not all fields (omit fields about generating value, etc) Export nested schemas (when some value have own schema) Fixes after `go vet`
Fix tests: add Export function to MockResourceProvisioner
Minor Fix chef provisioner (change was lost during rebase)
Support only one resource schema
…tions' argument for 'schemas' command) Fix compilation Fix test compilation simplify functions schema
Useful for 'chef' since there's both provider and provisioner with that name.
Minor simplification
I am going to close this PR out - thanks for the work here. I haven't received any response about the status of the PR since June. If you still feel this is work you'd like to get merged in, please do open another PR Thanks again Paul |
I am going to close this PR out - thanks for the work here. I haven't received any response about the status of the PR since June. If you still feel this is work you'd like to get merged in, please do open another PR Thanks again Paul |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This feature allows to run command like
terraform schemas aws
and get json with information about required/optional properties of providers/provisioners/resources and their types. (and much more info)Originally it was required to add 'properties completion' and 'required properties inspection' features in IntelliJ HCL/Terraform plugin and I think it could be shared with community, so vim/emacs/etc users could use it.
Example of generated output for provisioner
local-exec
(terraform schemas -indent -json local-exec
) could be found here. There are other files for other providers/provisioners in the same directory, look around.Still some things should be done: