nerdexam
GoogleGoogle

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #58

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Question #58: Real Exam Question with Answer & Explanation

The correct answer is B: Confirm that the pipeline is storing and retrieving the terraform.tfstate file from Cloud Storage with. To optimize cloud spend by ensuring only a single instance of infrastructure exists when using Terraform in a CI/CD pipeline, confirm that the pipeline is consistently storing and retrieving the terraform.tfstate file from Cloud Storage.

Submitted by dimitri_ru· Apr 18, 2026Building and implementing CI/CD pipelines for a service

Question

You are using Terraform to manage infrastructure as code within a CI/CD pipeline. You notice that multiple copies of the entire infrastructure stack exist in your Google Cloud project, and a new copy is created each time a change to the existing infrastructure is made. You need to optimize your cloud spend by ensuring that only a single instance of your infrastructure stack exists at a time. You want to follow Google-recommended practices. What should you do?

Options

  • ACreate a new pipeline to delete old infrastructure stacks when they are no longer needed.
  • BConfirm that the pipeline is storing and retrieving the terraform.tfstate file from Cloud Storage with
  • CVerify that the pipeline is storing and retrieving the terraform.tfstate file from a source control.
  • DUpdate the pipeline to remove any existing infrastructure before you apply the latest

Explanation

To optimize cloud spend by ensuring only a single instance of infrastructure exists when using Terraform in a CI/CD pipeline, confirm that the pipeline is consistently storing and retrieving the terraform.tfstate file from Cloud Storage.

Common mistakes.

  • A. Creating a separate pipeline to delete old stacks is a reactive cleanup measure, not a proactive solution to prevent the creation of multiple infrastructure copies in the first place.
  • C. Storing the terraform.tfstate file in source control is generally not recommended due to potential for merge conflicts, exposure of sensitive data, and lack of locking mechanisms, which can lead to state corruption and inconsistent infrastructure management.
  • D. Updating the pipeline to remove any existing infrastructure before applying the latest configuration would be destructive, causing unnecessary downtime and is contrary to Terraform's design for managing infrastructure updates incrementally.

Concept tested. Terraform remote state management in CI/CD

Reference. https://cloud.google.com/docs/terraform/best-practices-for-using-terraform#state-management

Topics

#Terraform#CI/CD#State Management#Cloud Cost Optimization

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER PracticeBrowse All PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Questions