Which statement best describes the difference between creation-time and destruction-time in Terraform?
Think about the lifecycle of a resource from start to end.
Creation-time is when Terraform provisions resources. Destruction-time happens when resources are removed, either by terraform destroy or when replaced.
When a resource attribute change requires replacement, what happens during Terraform apply?
What is the default order of operations for resource replacement in Terraform?
By default, Terraform destroys the old resource first, then creates the new resource. This may cause downtime unless create_before_destroy = true is set in the lifecycle block.
Given the following Terraform resource snippet, what is the effect during resource replacement?
resource "aws_instance" "example" {
ami = "ami-123456"
instance_type = "t2.micro"
lifecycle {
create_before_destroy = true
}
}Check what create_before_destroy does in the lifecycle block.
The create_before_destroy flag tells Terraform to create the new resource before destroying the old one, preventing downtime.
Which security risk is most relevant during destruction-time of cloud resources managed by Terraform?
Think about what happens to resource data and state files when resources are destroyed.
During destruction, sensitive data may be exposed if state files or logs are not properly secured.
You need to update a critical database server managed by Terraform without downtime. Which approach best uses creation-time and destruction-time concepts to achieve this?
Consider how to avoid downtime during resource replacement.
Using create_before_destroy ensures the new database is ready before the old one is removed, enabling zero downtime.