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"{ description ="an example of a number variable in terraform"type=numberdefault=2} list# 列表为字符串 ...
在Terraform中,可以使用传入的变量为map进行设置。首先,在Terraform配置文件中定义一个变量,类型为map。例如: ``` variable "my_map" { type = ...
variable "map_example" { description = "An example of a map in Terraform" type = "map" default = { key1 = "value1" key2 = "value2" key3 = "value3" } } # 如果不指定类型,默认是字符串 variable "server_port" { description = "The port the server will use for HTTP requests" }...
variable vpcflow_policy { type = string default = <<EOF accept tag.env == \"test\" drop \"*\" EOF } resource "alicloud_log_audit" "example" { display_name = "tf-audit-test" aliuid = "1234***" variable_map = { "vpc_flow_enabled" = "true", "vpc_flow_ttl" = "7", "vp...
In this example, a local variable called customer_info is declared. This variable is of type map and contains as string values several key-value pairs. The customer_info map includes the following key-value pairs: first_name: The value is set to the value of the input variable var.first_...
resource "example_resource" "example" { property1 = local.my_map_variable["key1"] property2 = local.my_map_variable["key2"] } 在上述示例中,我们定义了一个名为my_map_variable的局部变量,并将其设置为一个包含两个键值对的map。然后,我们在资源配置中使用局部变量my_map_variable来设置资源的属性...
resource "alicloud_log_audit" "example" { display_name = "tf-audit-test" aliuid = "1379186349***" variable_map = { "actiontrail_enabled" = "true", "actiontrail_ttl" = "180" } } 多账号采集 您可以通过自定义鉴权管理模式(中心账号为普通账号)或资源目录管理模式(中心账号必须为管理账号或者...
variable_map = { "actiontrail_enabled" = "true", "actiontrail_ttl" = "180" } multi_account = ["1257918632***", "1324567349***"] } 资源目录管理模式(自定义方式) resource "alicloud_log_audit" "example" { display_name = "tf-audit-test" ali...
variable "users" { type = map(object({ is_admin = bool })) } locals { admin_users = { for name, user in var.users : name => user if user.is_admin } regular_users = { for name, user in var.users : name => user if !user.is_admin } } ...
Example 4: Using your own bucket If you already have an S3 bucket that you want to use, you can provide e.g. bucket_override_name = "my-existing-s3-bucket" as a variable for this module. When bucket_override_name is provided, an S3 bucket is not automatically created for you. Note...