迭代组合的map是指在Terraform中可以使用map数据结构来定义一组键值对,其中键和值可以是任意类型的数据。通过使用map,可以轻松地定义和管理多个资源的配置。例如,可以使用map来定义多个虚拟机实例的配置,每个实例都有不同的属性和参数。 迭代组合的list是指在Terraform中可以使用list数据结构来定义一组有序的元素。通
> split(",","name,age,title") tolist([ "name", "age", "title", ]) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Collection 集合函数 Map 映射函数
transpose对Map的key和value进行换位: > transpose({"a" = ["1", "2"], "b" = ["2", "3"]}) tomap({ "1" = tolist([ "a", ]) "2" = tolist([ "a", "b", ]) "3" = tolist([ "b", ]) }) zipmap根据key和value的列表按一对一关系生成Map: > zipmap(["age", "name"...
-element(list, index) 根据index获取list中的元素 - list[index]根据index获取list中的元素 -flatten(list,list,list) 将多层list转换成单list -index(list, value) 返回value元素的index -length(list) 计算list的长度 -lookup(map,key,default) 检索map的key,不存在返口default -merge(map1,map2,map3) 合...
"1" = tolist([ "a", ]) "2" = tolist([ "a", "b", ]) "3" = tolist([ "b", ]) }) zipmap根据key和value的列表按一对一关系生成Map: > zipmap(["age", "name"], [18, "Larry Deng"]) { "age" = 18 "name" = "Larry Deng" ...
默认情况下,Terraform plan/apply 操作将检测云上资源的属性和本地资源块中 的差异,如果不一致将会调用更新或者重建操作来匹配配置.我们可以用 ignore_changes 来忽略某些参数不进行更新或重新.ignore_changes 的值可以是 属性的相对地址列表,对于 Map 和 List 类型,可以使用索引表示法引用,如 tags["Name"],list[0...
返回map中的所有key keys({a=1, b=2, c=3}) ["a", "b", "c"] length 获取列表、映射或是字符串的长度 length(["One", "Two", "Three"]) length({IT="A", CT="B"}) length("Hello, cloud!") 3 2 13 类型转化函数 表4 类型转化函数 函数名称 函数描述 样例 运行结果 toset 将列表...
除开String类型变量,Terraform还支持List和Map类型: List的定义: variable “cidrs” { type=“list” } List的赋值: cidrs=[ “10.0.0.0/16”, “10.1.0.0/16” ] Map的定义和赋值: variable “amis” { type = “map” default = { “us-east-1” = “ami-b374d5a5” ...
, {"Effect":"Allow","Action":["vpc:CreateVpc","vpc:DeleteVpc","vpc:CreateVSwitch","vpc:DeleteVSwitch"],"Resource":"*"}, {"Effect":"Allow","Action":["vpc:DescribeVpcAttribute","vpc:DescribeRouteTableList","vpc:DescribeVSwitchAttributes"],"Resource":"*"}, {"Effect":"Allow","Action...
id of the mysql instance", Required: true, }, "vip_data": schema.ListNestedAttribute{ Description: "The vip data of the mysql instance", Computed: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ "vip": schema.StringAttri...