Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 179 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 179
Topic #: 1
[All Terraform Associate Questions]

Why should secrets not be hard coded into Terraform code? (Choose two.)

  • A. It makes the code less reusable.
  • B. Terraform code is typically stored in version control, as well as copied to the systems from which it's run. Any of those may not have robust security mechanisms.
  • C. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a target resource is compromised.
  • D. All passwords should be rotated on a quarterly basis.
Show Suggested Answer Hide Answer
Suggested Answer: AB 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
yaza
Highly Voted 2 years, 2 months ago
AB, terraform code will not be copied to target resource, if you deploy a VM the code will not copied to the VM
upvoted 20 times
yaza
2 years, 1 month ago
Selected Answer: AB
upvoted 3 times
...
...
brax404
Highly Voted 1 year, 1 month ago
Selected Answer: AB
Explanation: A. It makes the code less reusable: Hard coding secrets means the Terraform code is tied to a specific environment or set of credentials. This makes it hard to reuse the code in different contexts or environments without modifying the secrets. B. Terraform code is typically stored in version control, as well as copied to the systems from which it's run. Any of those may not have robust security mechanisms: Storing secrets directly in the Terraform code exposes those secrets to anyone who has access to the code. Furthermore, secrets may be logged in version control history, making them discoverable long after they've been removed or changed.
upvoted 6 times
...
mussha
Most Recent 3 weeks, 5 days ago
AB, Hardcoding secrets (like passwords) in Terraform is bad because: Sharing Risk: If the code is shared or stored, anyone can see the secrets and misuse them. Hard to Reuse: If you want to use the code somewhere else, you’d have to change the secrets every time. Keeping secrets separate is safer and makes the code easier to use again.
upvoted 1 times
...
090200f
4 months ago
Selected Answer: BC
Seems like BC are correct answers , A is like ambiguity type means so we've to follow the best practices seems like not related to this question
upvoted 1 times
...
3cc17f1
1 year, 1 month ago
I vote A and B, because C doesn't make sense. Why would the terraform code be copied to the target resources? For example, I provision an Azure Storage account using terraform. There's no point at which the terraform code ends up on that storage account.
upvoted 2 times
...
Aiwa23
1 year, 1 month ago
B and C. My Terraform source code is in github repo, and when I use pipelines to run terraform, the source code gets downloaded in the CI/CD or build server or terraform server and access holder to this server could see them. The question terms this server as the target resource. Yes, hardcoding does make it less reusable, but there is a way around- using environment specific tfvars.
upvoted 2 times
...
vvkgp
1 year, 3 months ago
Answer is B and C, as its a serious security breach. A - just mentions about best practices.
upvoted 2 times
...
joyboy23
1 year, 4 months ago
Selected Answer: AB
AB, I don't think a terraform code is copied to any place(local, backend, any modules etc.,) But, The values of the variables are rendered into the state file. where the key/secrets are exposed
upvoted 1 times
...
March2023
1 year, 5 months ago
Selected Answer: BC
B and C
upvoted 2 times
Rajmane
1 year, 3 months ago
Exactly 💯
upvoted 1 times
...
...
kiran15789
1 year, 6 months ago
Selected Answer: BC
B and C are security related
upvoted 2 times
...
FarziWaliMarzi
1 year, 7 months ago
Selected Answer: AB
A and B
upvoted 1 times
...
Stanislav4907
1 year, 7 months ago
Selected Answer: BC
B. Terraform code is typically stored in version control, as well as copied to the systems from which it's run. Any of those may not have robust security mechanisms. Storing secrets in plain text within code, especially if it's publicly accessible or shared, increases the risk of the secrets being compromised. If the code is stored in a version control system, it's important to ensure that the secrets are not accidentally exposed in the version history. C. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a target resource is compromised. If the Terraform code contains secrets, then those secrets will be copied to the target resources during the deployment process. If any of the target resources are compromised, the secrets may be exposed. It's important to keep secrets separate from the code and ensure that they are securely transmitted to the target resources when needed.
upvoted 1 times
joyboy23
1 year, 4 months ago
Will the code be copied though ?
upvoted 2 times
...
...
Chinensis
1 year, 7 months ago
Selected Answer: AB
For me the answer C does not make sense...
upvoted 1 times
...
Nunyabiznes
1 year, 7 months ago
Selected Answer: BC
def, BC
upvoted 1 times
...
camps
1 year, 7 months ago
Selected Answer: BC
B. Terraform code is typically stored in version control, as well as copied to the systems from which it's run. Any of those may not have robust security mechanisms. C. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a target resource is compromised. Storing secrets, such as passwords or API keys, directly in Terraform code is a bad practice for several reasons. Firstly, Terraform code is typically stored in version control, and it may be copied to multiple systems from which it's run, such as a developer's machine, a CI/CD pipeline, or a Terraform cloud workspace. Any of those systems may not have robust security mechanisms, and exposing secrets in code leaves them vulnerable to potential attacks. Secondly, the Terraform code is copied to the target resources to be applied locally, so any secrets in the code could be exposed if a target resource is compromised. Therefore, it is recommended to use a secrets management system, such as HashiCorp Vault or AWS Secrets Manager, to store and manage secrets outside of Terraform code.
upvoted 1 times
090200f
4 months ago
agreed
upvoted 1 times
...
...
khaled_razouk
1 year, 8 months ago
Selected Answer: BC
B&C is the correct answer
upvoted 1 times
...
Daro_
1 year, 10 months ago
BC in my opinion
upvoted 1 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 ...