I would like to use data item to get a single environment that already exists on my repo. However, the data "github_repository_environments" item returns a list [] rather than a map {} so i cant use name to get just the environment i want.
data "github_repository_environments" "deployment_environment" {
repository = data.github_repository.organization_reponame_repo.name
}
output "github_repository_environments_environments" {
value = data.github_repository_environments.deployment_environment.environments
}
output "github_repository_environments_environments_one" {
value = lookup(data.github_repository_environments.deployment_environment.environments, "envname", "na")
}
SDK Version
No response
API Version
No response
Relevant log output
Changes to Outputs:
+ github_repository_environments_environments = [
+ {
+ name = "dev"
+ node_id = "EN_xxx"
},
+ {
+ name = "prod"
+ node_id = "EN_xxx"
},
+ {
+ name = "test"
+ node_id = "EN_xxx"
},
]
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
╷
│ Error: Invalid function argument
│
│ on postman_github.tf line 21, in output "github_repository_environments_environments_one":
│ 21: value = lookup(data.github_repository_environments.deployment_environment.environments, "xxx", "na")
│ ├────────────────
│ │ while calling lookup(inputMap, key, default...)
│ │ data.github_repository_environments.deployment_environment.environments is list of object with 3 elements
│
│ Invalid value for "inputMap" parameter: lookup() requires a map as the first argument.
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the need
I would like to use data item to get a single environment that already exists on my repo. However, the data "github_repository_environments" item returns a list [] rather than a map {} so i cant use name to get just the environment i want.
SDK Version
No response
API Version
No response
Relevant log output
Code of Conduct