What does the -replace flag do when used with terraform apply?
Think about how you can force Terraform to rebuild a resource even if no changes are detected.
The -replace flag tells Terraform to treat the specified resource as if it needs to be replaced, causing it to be destroyed and recreated during the apply.
Which of the following commands correctly uses the -replace flag to replace the resource aws_instance.web_server?
Check the exact syntax for flags with values in Terraform CLI.
The correct syntax uses a single dash and equals sign: -replace=resource_name.
What is the expected behavior of Terraform when applying with -replace=aws_s3_bucket.my_bucket if the bucket exists and has data?
Consider what happens when a resource is destroyed and recreated.
The -replace flag forces destruction and recreation, so existing data in the bucket will be lost unless backed up.
What is a key security risk when using terraform apply -replace on resources like databases or secrets managers?
Think about what happens to data when a resource is destroyed and recreated.
Destroying and recreating sensitive resources can expose data temporarily or cause loss if not handled carefully.
Which is the best practice before running terraform apply -replace on a critical production resource?
Consider how to avoid data loss and downtime.
Backing up data and testing in staging helps prevent data loss and service disruption.