动态块Dynamic Block 动态块的作用是根据变量重复某一块配置。这在Terraform是会遇见的。 resource "aws_elastic_beanstalk_environment" "tfenvtest" { name = "tf-test-name" application = "${aws_elastic_beanstalk_application.tftest.name}" solution_stack_name = "64bit Amazon Linux 2018.03 v2.11.4 ru...
] 动态块Dynamic Block 动态块的作用是根据变量重复某一块配置。这在Terraform是会遇见的。 resource "aws_elastic_beanstalk_environment" "tfenvtest" { name = "tf-test-name" application = "${aws_elastic_beanstalk_application.tftest.name}" solution_stack_name = "64bit Amazon Linux 2018.03 v2.11.4...
动态块Dynamic Block 动态块的作用是根据变量重复某一块配置。这在Terraform是会遇见的。 resource "aws_elastic_beanstalk_environment" "tfenvtest" { name = "tf-test-name" application = "${aws_elastic_beanstalk_application.tftest.name}" solution_stack_name = "64bit Amazon Linux 2018.03 v2.11.4 ru...
复制 resource "aws_instance" "example" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" dynamic "ebs_block_device" { for_each = var.create_ebs_block_device ? [1, 2] : [] content { device_name = "/dev/sd${char(105 + ebs_block_device.key)}" volume_size = 100 ...
Terraform 0.12 introduces a special new dynamic block construct to support these dynamic configuration use-cases in a first-class way. The same example converted to Terraform 0.12: # Configuration for Terraform 0.12locals{standard_tags={Component="user-service"Environment="production"}}resource"aws_aut...
Theiteratorargument (optional) sets the name of a temporary variable that represents the current element of the complex value. If omitted, the name of the variable defaults to the label of thedynamicblock ("setting"in the example above). ...
Therefore the local.inputs in my example above is already a suitable collection for dynamic block for_each, with each.key giving the index of each element: dynamic "example" { for_each = local.inputs content { index = each.key arg = each.value } } If you don't actually need to ...
Terraform 0.12 introduces a special new dynamic block construct to support these dynamic configuration use-cases in a first-class way. The same example converted to Terraform 0.12: # Configuration for Terraform 0.12 locals { standard_tags = { ...
Useful for creating human-friendly shortcuts for deeper links into a site, or for dynamic links (e.g. download.example.com always pointing to your latest release). Main features: DNS entries are created automatically HTTPS enabled by default HTTP Strict Transport Security supported Optional ...
name="example" instance_type="basic" open_public_operation=true security_policy{ cidr_block="10.0.0.1/24" } security_policy{ cidr_block="192.168.1.1/24" } } 此时,可使用 dynamic 块来动态构建重复且类似 security_policy 的内嵌块。例如: ...