【发布时间】:2022-01-18 04:57:39
【问题描述】:
我想以变量为条件提供资源(gcp vm 实例),例如:
resource "${var.param > 0 ? "google_compute_instance" : "null_resource"}" "cluster" {
# ...
}
但上述语法无效:
Error: Invalid resource type name
A name must start with a letter or underscore and may contain only letters, digits, underscores, and dashes.
Error: Invalid string literal
Template sequences are not allowed in this string. To include a literal "$", double it (as "$$") to escape it.
有没有办法做到这一点?理想情况下单独使用 terraform。
【问题讨论】:
标签: google-cloud-platform terraform terraform-provider-gcp