terraform note
Ref: https://lonegunmanb.github.io/introduction-terraform/ 原始类型:
string number bool 复杂类型:
list(…) map(…) 键类型必须为string, 值类型任意。值声明方式:{“foo”: “bar”, “bar”: “baz”} {foo=“bar”, bar=“baz”} set(…) 结构化类型:
object(…) 对象是指一组由具有名称和类型的属性所构成的复合类型 tuple(…) 元组类似于list,是一组值的连续集合,但每个元素都有独立的类型,可以使用下标访问内部元素 any
null
object 的optional 成员,可以在objet类型中使用optional修饰属性
variable "with_optional_attribute" { type = object({ a = string # a required attribute b = optional(string) # an optional attribute c = optional(number, 127) # an optional attribute with default value }) } variable "buckets" { type = list(object({ name = string enabled = optional(bool, true) website = optional(object({ index_document = optional(string, "index.
Read more...