Complete the code to use the meta-argument that controls resource creation count.
resource "aws_instance" "example" { ami = "ami-123456" instance_type = "t2.micro" [1] = 3 }
The count meta-argument tells Terraform how many instances of the resource to create.
Complete the code to use the meta-argument that defines dependencies between resources.
resource "aws_instance" "example" { ami = "ami-123456" instance_type = "t2.micro" [1] = [aws_security_group.sg] }
The depends_on meta-argument explicitly defines resource dependencies to control creation order.
Fix the error in the code by choosing the correct meta-argument to iterate over a map.
resource "aws_s3_bucket" "example" { [1] = var.bucket_names bucket = [1].value }
The for_each meta-argument is used to create multiple resources from a map or set of strings.
Fill both blanks to correctly prevent Terraform from deleting a resource on destroy and to ignore changes to tags.
resource "aws_instance" "example" { ami = "ami-123456" instance_type = "t2.micro" lifecycle { [1] = true [2] = ["tags"] } }
prevent_destroy stops Terraform from deleting the resource. ignore_changes tells Terraform to ignore changes to specified attributes like tags.
Fill all three blanks to correctly use meta-arguments to create multiple resources from a map, specify a provider, and define dependencies.
resource "aws_instance" "example" { [1] = var.instances provider = aws.[2] [3] = [aws_security_group.sg] ami = "ami-123456" instance_type = "t2.micro" }
for_each creates resources from a map. provider specifies the AWS region. depends_on sets resource dependencies.