Hashicorp Certified Terraform Associate 003 · Free Practice Question Medium
Question 27
Your organization uses IaC to provision and manage resources in a public cloud platform. A new employee has developed changes to existing code and wants to push it into production.
What best practice should the new employee follow to submit the new code?
-
A
Execute the code locally on the developer's machine to make the changes directly to the infrastructure.
-
B
Submit the change to the change control board and wait for the approval. Commit the code directly to the main repository.
-
C
Submit a merge/pull request of the proposed changes. Have a team member validate the changes and approve the request.
-
D
Make the change directly using the cloud provider's API to ensure the changes are valid. Store the code locally and email a copy of the code to a teammate so they have an extra copy.
Reveal correct answer
Correct answer: C
Explanation
Following best practices for code, the new changes should be submitted as a pull/merge request in the existing code repository. A teammate, or the security team, should validate the changes and approve the request, ultimately merging the new changes into the existing codebase
Wrong Answers:
None of these follow best practices for managing code. Please don't do any of these things :)
https://learn.hashicorp.com/collections/terraform/aws-get-started
A. Executing code locally and making changes directly to the infrastructure without proper version control and review processes can introduce risks and inconsistencies in the infrastructure. It is important to follow a structured approach like submitting a merge/pull request for code changes to ensure proper validation and review.
B. Submitting changes to a change control board for approval is a good practice, but committing code directly to the main repository without validation or review can lead to potential issues in production. It is important to have a review process in place to ensure the quality and correctness of the code changes.
C. Submitting a merge/pull request is a common best practice in version control systems like Git. This allows for code review by team members, validation of changes, and approval before merging the code into the main branch. It ensures that changes are thoroughly reviewed and tested before being deployed to production.
D. Making changes directly using the cloud provider's API and storing code locally without proper version control and collaboration can lead to issues such as code loss, lack of traceability, and difficulty in managing changes. It is essential to follow version control practices and involve team members in the review and approval process for code changes.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
