Terraform支持许多类型约束,包括string、number、bool、list、map、set、object、tuple和any。如果未指定类型,那么Terraform会设置默认约束类型为any。 还可以使用类型约束创建更复杂的对象和元组结构类型。 也可以通过环境变量来设置输入变量初始值。命名规范是TF_VAR_,其中是你要设置的输入变量的名称。 如果不想在每次运...
包含string、number、bool、list、map、set、object、tuple、any(默认约束类型为any) string# 字符串 variable"map_example"{ description ="an example of a map in terrform"type=map(string)default= { key1 ="value1"key2 ="value2"key3 ="value3"} } number# 数字 variable"number_example"{ descript...
data_disks { type = "SATA" size = "100" } data_disks { type = "SAS" size = "200" } `map(...)`: 包含多个`key: value`形式。在tf文件中的写法为 tags = { test = "test1" } `set(...)`:不具有任何辅助标识符或者索引的集合,集合中的元素值。 结构类型 `object(...)`:对象中的...
5. data结构设计我们看下最后一种资源的结构设计,首先还是先看下官方的接口定义:type DataSource interface { // Metadata should return the full name of the data source, such as // examplecloud_thing. Metadata(context.Context, MetadataRequest, *MetadataResponse) // Schema should return the sc...
variable "instance_amis" { type = map(string) default = { us-west-2 = "ami-0c55b159cbfafe1f0" us-east-1 = "ami-0d5d9d30148f1fce1" }} 对象用于表示具有多个字段的复杂数据结构。可以使用对象类型定义对象:variable "instance_config" { type = object({ name = string ...
我想让变量urlMaps成为可选的列表(object)。当我没有将urlMaps作为terraform.tfvars的输入时,我希望它发送一个空值。但这是下面提到的例外。如果不可能,是否有其他方法来实现这一点。 terraform.tfvars urlMaps = [ { hosts = ["example.com"] paths = ["/image"] ...
>.<资源名称 1> <资源类型>.<资源名称2> $ terraform state mv -state-out=../vpc_basic/terraform.tfstate huaweicloud_identity_user.user_example huaweicloud_identity_user.user_1 Move "huaweicloud_identity_user.user_example " to "huaweicloud_identity_user.user_1" Successfully moved 1 object(s)...
`map(...)`: 包含多个`key: value`形式。在tf文件中的写法为 tags={test="test1"} `set(...)`:不具有任何辅助标识符或者索引的集合,集合中的元素值。 结构类型 `object(...)`:对象中的每个元素可以有各自的类型,其语法可以表示为`{ <KEY> = <TYPE>, <KEY> = <TYPE>, ... }`。
(), }, }, "network_id": schema.StringAttribute{ Description: "The network 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[...
type = map(object({ zone_id = string name = string type = string alias_name = string alias_zone_id = string routing_policy = string })) default = { example-com = { zone_id = "YOUR_ZONE_ID" name = "www" type = "A"