A cloud architecture team needs to establish a standard Terraform workflow to manage Google Cloud infrastructure with remote state management. What is the correct sequence of steps to configure and execute this Infrastructure as Code workflow from start to finish?
- 1Create a Cloud Storage bucket with object versioning enabled to securely store the remote Terraform state file.
- 2Define the GCS backend configuration block within the Terraform code to reference the newly created bucket.
- 3Execute `terraform init` to download provider plugins and connect the workspace to the GCS remote backend.
- 4Execute `terraform plan` to review proposed infrastructure changes against the current state.
- 5Execute `terraform apply` to provision the resources in Google Cloud and update the remote state.
Answer
The correct order of operations begins with creating the GCS remote state bucket, followed by configuring the backend in Terraform code, initializing the directory with `terraform init`, generating an execution plan with `terraform plan`, and finally applying the configuration with `terraform apply`.
The standard Terraform deployment sequence requires establishing backend state storage before initialization, initializing the working directory before planning changes, and reviewing an execution plan before applying infrastructure modifications to Google Cloud.
Step-by-Step Solution
Key Concept
Terraform Remote State Workflow Lifecycle