exam questions

Exam Professional Cloud DevOps Engineer All Questions

View all questions & answers for the Professional Cloud DevOps Engineer exam

Exam Professional Cloud DevOps Engineer topic 1 question 115 discussion

Actual exam question from Google's Professional Cloud DevOps Engineer
Question #: 115
Topic #: 1
[All Professional Cloud DevOps Engineer Questions]

You use Terraform to manage an application deployed to a Google Cloud environment. The application runs on instances deployed by a managed instance group. The Terraform code is deployed by using a CI/CD pipeline. When you change the machine type on the instance template used by the managed instance group, the pipeline fails at the terraform apply stage with the following error message:



You need to update the instance template and minimize disruption to the application and the number of pipeline runs.

What should you do?

  • A. Delete the managed instance group, and recreate it after updating the instance template.
  • B. Add a new instance template, update the managed instance group to use the new instance template, and delete the old instance template.
  • C. Remove the managed instance group from the Terraform state file, update the instance template, and reimport the managed instance group.
  • D. Set the create_before_destroy meta-argument to true in the lifecycle block on the instance template.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
alpha_canary
8 months, 2 weeks ago
Selected Answer: D
https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#create_before_destroy https://cloud.google.com/build/docs/deploying-builds/deploy-compute-engine#:~:text=Note%20that%20this,version%20is%20destroyed
upvoted 2 times
...
xhilmi
10 months, 4 weeks ago
Selected Answer: D
To update the instance template and minimize disruption to the application while resolving the error during the Terraform apply stage, the recommended approach is to use (Option D). By setting the create_before_destroy meta-argument to true in the lifecycle block on the instance template, Terraform will create a new instance template before destroying the old one. This ensures a smooth transition by allowing the managed instance group to gradually replace instances with the new template without causing downtime. This method optimizes the update process, reducing disruption to the application and minimizing the number of pipeline runs needed.
upvoted 1 times
...
Jason_Cloud_at
1 year ago
Selected Answer: D
D is the best option
upvoted 3 times
...
nhiguchi
1 year ago
Selected Answer: D
Answer should be D
upvoted 2 times
...
ReachTango73
1 year ago
D. Check to docs
upvoted 2 times
...
ManishKS
1 year ago
B is correct Answer
upvoted 1 times
florian_cartron
1 year ago
Answer B suggests a manual change, but we should use terraform in a CI/CD pipeline. Answer D is the good one, it does the same thing than B, but with terraform automatically, as the default behaviour of terraform is to destroy resources before recreating it when it cannot be updated we have to tune the lifecycle parameter.
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago