ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 122 - Professional Cloud DevOps Engineer discussion

Report
Export

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
Answers
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
Answers
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.
Answers
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_bef ore_destroy meta-argument to true in the lifecycle block on the instance template
Answers
D.
Set the create_bef ore_destroy meta-argument to true in the lifecycle block on the instance template
Suggested answer: D

Explanation:

The best option for updating the instance template and minimizing disruption to the application and the number of pipeline runs is to set the create_before_destroy meta-argument to true in the lifecycle block on the instance template. The create_before_destroy meta-argument is a Terraform feature that specifies that a new resource should be created before destroying an existing one during an update. This way, you can avoid downtime and errors when updating a resource that is in use by another resource, such as an instance template that is used by a managed instance group. By setting the create_before_destroy meta-argument to true in the lifecycle block on the instance template, you can ensure that Terraform creates a new instance template with the updated machine type, updates the managed instance group to use the new instance template, and then deletes the old instance template.

asked 18/09/2024
Madhankumar Rathinakumar
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first