Given the following Terraform plan output snippet, how many resources will be created?
# aws_instance.web will be created
+ resource "aws_instance" "web" {
+ ami = "ami-123456"
+ instance_type = "t2.micro"
}
# aws_s3_bucket.data_bucket will be updated in-place
~ resource "aws_s3_bucket" "data_bucket" {
~ versioning {
~ enabled = false -> true
}
}
Plan: 1 to add, 1 to change, 0 to destroy.Look for the '+' sign which indicates resource creation.
The plan shows one resource with a '+' sign meaning it will be created. The other resource has a '~' meaning it will be updated in place.
In Terraform plan output, what does the symbol '~' before a resource name indicate?
Think about what happens when a resource changes but is not destroyed.
The '~' symbol means the resource will be updated in-place without destruction.
Review this Terraform plan output snippet. How many resources will be replaced?
# aws_lb.web_lb must be replaced
-/+ resource "aws_lb" "web_lb" {
id = "lb-1234"
name = "web-lb"
internal = false
load_balancer_type = "application"
}
Plan: 1 to add, 0 to change, 1 to destroy.Look for the '-/+' symbol which indicates replacement.
The '-/+' symbol means the resource will be destroyed and recreated, which is a replacement.
Given this Terraform plan output snippet, which change could introduce a security risk?
# aws_security_group.sg will be updated in-place
~ resource "aws_security_group" "sg" {
~ ingress {
~ cidr_blocks = ["0.0.0.0/0"] -> ["0.0.0.0/0", "192.168.1.0/24"]
}
}
Plan: 0 to add, 1 to change, 0 to destroy.Consider which IP ranges are more open and risky.
Adding a new CIDR block 192.168.1.0/24 opens access to that subnet, increasing exposure.
Examine this Terraform plan summary:
Plan: 3 to add, 2 to change, 1 to destroy.
Which of the following statements is true about the infrastructure state after applying this plan?
Calculate net resource count: additions minus destructions.
3 resources added minus 1 destroyed equals a net increase of 2 resources, but 2 resources are changed (updated in place) which does not affect count. So net change is +3 - 1 = +2 resources. Therefore, the infrastructure will have 2 more resources than before.