-
Notifications
You must be signed in to change notification settings - Fork 573
Description
What problem are you facing?
I want to be able to programatically determine the aliases needed for providers when I'm publishing a reusable terraform module. This would allow me to publish parsable documentation alongside my module so that I could prompt a user to supply the required providers when they want to deploy that module.
When I run terraform-docs json --show providers,requirements .
on this module:
module "submodule" {
providers = {
null.example-alias = null.example-alias
}
source = "./submodule"
}
terraform {
required_providers {
null = {
source = "hashicorp/null"
version = "3.2.3"
configuration_aliases = [null.example-alias]
}
}
}
provider "null" {
alias = "example-alias"
}
I'm given the following output:
{
"header": "",
"footer": "",
"inputs": [],
"modules": [],
"outputs": [],
"providers": [],
"requirements": [
{
"name": "null",
"version": "3.2.3"
}
],
"resources": []
}
This doesn't tell me anything about the alias "example-alias" that needs to be used for the null provider.
How could terraform-docs help solve your problem?
terraform-docs could help solve this problem by exposing the configuration_aliases
alongside the name and version information of each requirement.
If I was presented with this output:
{
"header": "",
"footer": "",
"inputs": [],
"modules": [],
"outputs": [],
"providers": [],
"requirements": [
{
"name": "null",
"version": "3.2.3",
"aliases": "null.example-alias"
}
],
"resources": []
}
Then I would know what aliases to prompt the users for when they wish to deploy a terraform module.