Replies: 6 comments 6 replies
-
|
Looking at how they build the docs at https://github.com/hashicorp/terraform-plugin-docs there's a |
Beta Was this translation helpful? Give feedback.
-
|
Great initiative to break this out (and nice to see you being active)! I've actually started some small work to improve the state of the script already. While I do think it would make sense to make a more robust solution, I also think that we could get a way better result with small changes to the existing solution. One problem not mentioned here is that some providers choose to restructure their code, and especially breaking some parts out to different files. |
Beta Was this translation helpful? Give feedback.
-
|
For the record, I looked into @starhawking's suggestion about the Using the sample Terraform configuration below... ...running {
"format_version": "0.1",
"provider_schemas": {
"registry.terraform.io/hashicorp/aws": {
"provider": {
"version": 0,
"block": {
[sic]
"aws_instance": {
"version": 1,
"block": {
"attributes": {
"ami": {
"type": "string",
"description_kind": "plain",
"required": true
},
"arn": {
"type": "string",
"description_kind": "plain",
"computed": true
},
"associate_public_ip_address": {
"type": "bool",
"description_kind": "plain",
"optional": true,
"computed": true
},
"availability_zone": {
"type": "string",
"description_kind": "plain",
"optional": true,
"computed": true
},
}This option could make the current approach of running regular expressions on Go source code obsolete. You can also do type checking and automatically generate documentation. I can see Terrascript 0.10 on the horizon. I am going to check out the Terraform Provider Registry next. It would be great if one could get a list of providers through the API. |
Beta Was this translation helpful? Give feedback.
-
|
It is possible to get a list of providers from the Terraform Provider Registry as shown below. One just has to iterate over the offset |
Beta Was this translation helpful? Give feedback.
-
|
So I am progressing nicely with re-writing For exmple, search for 'null' in the Terrafform Registry and there are four providers of that name (https://registry.terraform.io/search/providers?q=null). That's why Terraform introduced namespaces, which we would have to mirror accordingly. Ouch! Fortunately only a small number of providers are affected so we may get away without namespaces for now. |
Beta Was this translation helpful? Give feedback.
-
|
I am working on |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There have been some recent issues with the
tools/makecode.pyscript where it fails to build Python modules for some providers.I wanted to start a discussion around the question of how to improve
tools/makecode.pymore robust.The first problem with the script is that it does not actually implement a Go language parser for processing the Terraform
provider source code. Instead,
makecode.pyuses regular expression to extract the required data from the Go source files. This is rather brittle as it requires the Go code to be formatted in a specific way. It may be possible to work-around the problem by converting the Go source code into a "standardised" format using a source code formatter like GoFmtThe second problem is that
makecode.pymakes certain assumptions about the directory structure of the Terraform provider modules and the location of theprovider.gofile.Beta Was this translation helpful? Give feedback.
All reactions