You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently, the registry URL is hard-coded to registry.terraform.io.
With the advent of OpenTofu, more registries have popped up, including better support for internal/enterprise/corporate "private" registries. A user of this tool should be able to specify the preferred URL pattern to use for the registry.
How could terraform-docs help solve your problem?
The three most popular public registries (as of today's date) have the following URL patterns (arbitrarily picking version v5.65.0).
I propose that as a CLI flag and config file entry, a user should be able to provide a keyword to signify one of the popular public registries, or a Go-template URL pattern for a custom/private registry.
As an example, let's look at settings. We could add a new entry called registry-url, which would accept a string.
Reviewing When not to use Plain Scalars to understand which characters can be used at the beginning of a string value, unquoted, it looks like :<space> is unavailable, but :<nospace> should be valid.
We could use certain "short" strings as placeholders for well-known values, then fall back to Go-template values for custom URLs.
If a provider has a version constraint (e.g., ~> 4.60), then instead of always linking to the latest version, we should honor the version constraint when we create the registry links. Continuing to use hashicorp/aws as an example, the most appropriate version for the ~> 4.60 constraint is 4.67.0.
In my proposal above, where I mentioned .ProviderVersion as a Go-template variable, that variable would be set to 4.67.0 instead of latest.
Why? Many corporations have large numbers of apps in various states of maintenance, and may be using an older version of Terraform or Terraform Module or Terraform Provider until they have a chance to update. My previous company has in-use versions of Terraform 0.7 that just never got updated. Being able to provide accurate documentation for well-crafted projects should be possible, and always linking to latest is inaccurate.
The text was updated successfully, but these errors were encountered:
What problem are you facing?
Presently, the registry URL is hard-coded to
registry.terraform.io
.With the advent of OpenTofu, more registries have popped up, including better support for internal/enterprise/corporate "private" registries. A user of this tool should be able to specify the preferred URL pattern to use for the registry.
How could terraform-docs help solve your problem?
The three most popular public registries (as of today's date) have the following URL patterns (arbitrarily picking version
v5.65.0
).I propose that as a CLI flag and config file entry, a user should be able to provide a keyword to signify one of the popular public registries, or a Go-template URL pattern for a custom/private registry.
As an example, let's look at settings. We could add a new entry called
registry-url
, which would accept a string.Reviewing When not to use Plain Scalars to understand which characters can be used at the beginning of a string value, unquoted, it looks like
:<space>
is unavailable, but:<nospace>
should be valid.We could use certain "short" strings as placeholders for well-known values, then fall back to Go-template values for custom URLs.
:terraform:
:opentofu:
:library-tf:
https://registry.company.com/internal-registry/{{.Namespace}}/{{.Provider}}/{{.ProviderVersion}}/docs
The last of these would likely need to be quoted, which is reasonable.
Or if you'd prefer to simply require a quoted value, maybe a different meta-character would be preferred over
:
for readability. Perhaps@
?Just some ideas.
Related improvements
If a provider has a version constraint (e.g.,
~> 4.60
), then instead of always linking to thelatest
version, we should honor the version constraint when we create the registry links. Continuing to usehashicorp/aws
as an example, the most appropriate version for the~> 4.60
constraint is4.67.0
.In my proposal above, where I mentioned
.ProviderVersion
as a Go-template variable, that variable would be set to4.67.0
instead oflatest
.Why? Many corporations have large numbers of apps in various states of maintenance, and may be using an older version of Terraform or Terraform Module or Terraform Provider until they have a chance to update. My previous company has in-use versions of Terraform 0.7 that just never got updated. Being able to provide accurate documentation for well-crafted projects should be possible, and always linking to
latest
is inaccurate.The text was updated successfully, but these errors were encountered: