You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
The terraform taint command marks a resource as tainted, which means it will be destroyed and recreated on the next apply. This way, you can replace the VM instance without affecting the database or other resources.Reference= [Terraform Taint]
You're building a CI/CD (continuous integration/continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?
This is a secure way to inject sensitive variables into your Terraform run, as they will not be stored in any file or source code repository. You can also use environment variables or variable files with encryption to pass sensitive variables to Terraform.
You corrected a typo in a resource name, changing it from aws_s3_bucket.photoes to aws_s3_bucket.photos. You want to update the Terraform state so that the existing resource is recognized under the new name, without destroying and recreating it. Which configuration should you use?
Rationale for Correct Answer: A moved block tells Terraform that an object's address in state has changed (renamed/refactored) and it should move the state from the old address to the new address. This preserves the existing real resource and prevents unnecessary destroy/recreate.
Analysis of Incorrect Options (Distractors):
A: Works but is unnecessarily risky/extra work; moved is the intended refactoring mechanism for renames.
B: Incorrect---refresh-only updates state to match real infrastructure, but it does not remap an object from one address to another.
C: Incorrect---Terraform will treat the new name as a new resource address and the old one as removed unless you explicitly move/rename state.
Key Concept: Refactoring addresses safely using moved blocks (state address migration).
====================
You're building a CI/CD (continuous integration/continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?
This is a secure way to inject sensitive variables into your Terraform run, as they will not be stored in any file or source code repository. You can also use environment variables or variable files with encryption to pass sensitive variables to Terraform.
Which of the following is not a benefit of adopting infrastructure as code?
Infrastructure as Code (IaC) provides several benefits, including the ability to version control infrastructure, reuse code, and automate infrastructure management. However, IaC is typically associated with declarative configuration files and does not inherently provide a graphical user interface (GUI). A GUI is a feature that may be provided by specific tools or platforms built on top of IaC principles but is not a direct benefit of IaC itself1.
Reference = The benefits of IaC can be verified from the official HashiCorp documentation on ''What is Infrastructure as Code with Terraform?'' provided by HashiCorp Developer1.
Frank Hall
6 days agoEdward Baker
19 days agoElizabeth Cooper
1 month agoGerald Carter
1 month agoJames Ramirez
26 days agoJessica Flores
17 days agoRichard Allen
1 month agoMark Cook
22 days agoDarrel
2 months agoGearldine
2 months agoDonte
2 months agoLorrie
3 months agoSkye
3 months agoLavonda
3 months agoAudrie
3 months agoDong
4 months agoLigia
4 months agoLynelle
4 months agoElise
4 months ago