I am trying to write a clear documentation/description of my terraform modules.
According to Hashicorp's doc, the description attribute will permit that, but I cannot find a way to describe an object type variable in details.
Here's more or less I want to do :
variable "sa_to_impersonate_info" {
type = object(
{
id = string
email = string
belonging_org_id = string
belonging_project_id = string
token_scopes = list(string)
token_lifetime = string
}
)
description = {
id : "an identifier for the resource with format projects/{{project}}/serviceAccounts/{{email}}"
email : "Email of the service account to impersonate"
belonging_org_id : "Organization ID where the service account belongs"
belonging_project_id : "Porject ID where the service account belongs"
token_scopes : "List of scopes affected by this service account impersonation"
token_lifetime : "Time the token will be active"
}
}
Run Code Online (Sandbox Code Playgroud)
For this format I get this error when I perform a terraform plan:
Error: Unsuitable value type
Run Code Online (Sandbox Code Playgroud)
您可以使用以下带有EOT分隔符的格式。
variable "sa_to_impersonate_info" {
type = object(
{
id = string
email = string
belonging_org_id = string
belonging_project_id = string
token_scopes = list(string)
token_lifetime = string
}
)
description = <<EOT
sa_to_impersonate_info = {
id : "an identifier for the resource with format projects/{{project}}/serviceAccounts/{{email}}"
email : "Email of the service account to impersonate"
belonging_org_id : "Organization ID where the service account belongs"
belonging_project_id : "Porject ID where the service account belongs"
token_scopes : "List of scopes affected by this service account impersonation"
token_lifetime : "Time the token will be active"
}
EOT
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11105 次 |
| 最近记录: |