Google Cloud Professional Cloud DevOps Engineer — Question 106

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?

Answer options

Correct answer: B

Explanation

The correct answer is B because using the Terraform gcs backend allows for proper state management in Google Cloud, preventing multiple instances of the infrastructure stack. Options A and D do not address the root cause of the issue, and C is incorrect since source control is not a recommended method for storing tfstate files in this context.