An interactive game streaming platform needs to transition its manually provisioned Google Cloud Bigtable clusters and Cloud Storage assets into Terraform management. The platform team requires a safe operational workflow that uses a remote Google Cloud Storage (GCS) backend with state locking to prevent state corruption or service disruption. Arrange the operational steps in the correct sequence to import existing cloud resources into Terraform state.
- 1Write the Terraform HCL code blocks defining the expected resource schema and configure the GCS remote backend stanza.
- 2Run `terraform init` to set up the GCS backend connection and download the Google provider plugins.
- 3Execute `terraform import` commands mapping the existing GCP resource identifiers to their declared Terraform HCL resource addresses.
- 4Run `terraform plan` to inspect for configuration drift and confirm that no resource modification or destruction is scheduled.
- 5Execute `terraform apply` to commit the synchronized state and establish the automated pipeline baseline.
Answer
The correct operational sequence is: 1) Write the Terraform HCL code blocks and backend configuration, 2) Run `terraform init` to initialize the remote backend, 3) Execute `terraform import` to bind GCP resource IDs to state, 4) Run `terraform plan` to verify zero drift or unwanted changes, and 5) Execute `terraform apply` to commit the baseline state.
Safely bringing brownfield resources into Terraform management requires defining matching HCL configurations, initializing the GCS remote backend to secure state locks, importing existing GCP resource IDs into state, verifying zero unexpected diffs via `terraform plan`, and finally applying to lock in baseline operational state.
Step-by-Step Solution
Key Concept
Brownfield Infrastructure as Code Import Workflow