Complete the code to initialize Terraform before running drift detection.
terraform [1]Terraform must be initialized with terraform init to set up the backend and providers before any plan or apply commands.
Complete the code to create a Terraform plan that detects drift without applying changes.
terraform [1] -detailed-exitcodeThe terraform plan command shows changes without applying them. The -detailed-exitcode flag helps detect drift by returning specific exit codes.
Fix the error in the command to detect drift by returning a detailed exit code.
terraform plan [1] -detailed-exitcodeThe -refresh=true flag ensures Terraform refreshes the state from real infrastructure, which is necessary for accurate drift detection.
Fill both blanks to create a CI/CD step that runs drift detection and fails if drift is found.
terraform [1] -detailed-exitcode || exit [2]
The command runs terraform plan with detailed exit codes. If drift is detected, it exits with code 1 to fail the CI/CD step.
Fill all three blanks to define a Terraform workflow step that initializes, refreshes state, and detects drift.
terraform [1] && terraform plan [2] -detailed-exitcode || exit [3]
This sequence initializes Terraform, refreshes the state during plan to detect drift, and exits with code 1 if drift is found, causing CI/CD failure.