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 102 discussion

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

Which option cannot be used to keep secrets out of Terraform configuration files?

  • A. Environment Variables
  • B. Mark the variable as sensitive
  • C. A Terraform provider
  • D. A -var flag
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
rotimislaw
Highly Voted 1 year, 9 months ago
Selected Answer: B
It's B The sensitive flag only prevents secret from showing up in the CLI outputs, but the value itself is still present in the configuration files.
upvoted 19 times
Chrisler
1 year, 2 months ago
This is true, you can still use the answer D. A terraform provider (e.g. Vault) to keep the secrets out of the terraform configuration.
upvoted 2 times
MauroSoli
1 year ago
The question is "Which option CANNOT be used"
upvoted 5 times
...
Tyler2023
1 year ago
I accidentally click the like button :D I agree with rotimislaw, the answer is B
upvoted 1 times
...
...
...
zaaath
Highly Voted 1 year, 7 months ago
Selected Answer: B
It's B. I think ChatGPT gets confused with this question, and people end up posting its response here. A. Environment Variables - keeps the value out of configuration and state B. Mark the variable as sensitive - the value is still in the configuration and state, but not in the console output C. A Terraform provider - keeps the value out of configuration, but not the state (like a provider's data resource) D. A -var flag - keeps the value out of configuration, but not the state
upvoted 8 times
zaaath
1 year, 7 months ago
Correction: D. A -var flag - keeps the value out of configuration and state
upvoted 2 times
...
...
premnick
Most Recent 3 months, 4 weeks ago
Selected Answer: B
Answer is B, this is because marking variable as sensitive is only to mask the value in the logs during tf apply. Programmer can always open the terraform file and view the value.
upvoted 1 times
...
a54b16f
9 months, 3 weeks ago
Selected Answer: B
C refers to Vault, which is valid
upvoted 1 times
...
vipulchoubisa
10 months, 2 weeks ago
D--VAR OPTION IS OUTSIDE .TF FILE. A-CAN BE SET IF YOU ARE USING TERRAFORM CLOUD B-CAN BE SET UNDER VARIABLE.TF FILE C-CAN BE SET UNDER PROVIDER BLOCK WHICH IS ALSO ONE OF THE .TF FILE ONLY -VAR FLAG IS OUTSIDE TERRAFROM, HENCE THIS IS CORRECT.
upvoted 1 times
...
jutove_mi
10 months, 3 weeks ago
Using Option B we can keep secrets out of Terraform configuration files, but question asked which option "can not be used" ? so I suppose C (also chatgpt reply C)
upvoted 1 times
...
Arshad011294
11 months, 2 weeks ago
Selected Answer: B
I will go for B, for anyone thinking its C, there is a video in this official terraform documentation where a lady is explaining best practices of using provider vault, where we can set secrets to expire and hence the actual secrets are kept from getting revealed in the terraform state file. https://registry.terraform.io/providers/hashicorp/vault/latest/docs
upvoted 2 times
...
Bere
12 months ago
Selected Answer: B
Answer is B. Mark the variable as sensitive. A. Environment Variables: This method keeps secrets out of configuration files by setting them externally. B. Mark the variable as sensitive: While this marks the variable as sensitive in Terraform's state and prevents it from being displayed in CLI outputs, the secret can still be present in the configuration files and state file. C. A Terraform provider: This doesn't inherently store or hide secrets in configuration files. D. A -var flag: This method can be used to pass variables at runtime, thus keeping them out of configuration files.
upvoted 2 times
...
MisterR0B0T
1 year ago
B Terraform documentation When you mark a variable as sensitive in Terraform, it does not keep the secrets out of the configuration files . Instead, it makes the variable write-only and prevents all users from viewing its value in the Terraform Cloud UI or reading it through the Variables API endpoint . Users with permission to read and write variables can set new values for sensitive variables, but you must delete and recreate the variable to edit its other attributes.
upvoted 1 times
...
brax404
1 year, 1 month ago
Selected Answer: C
C. A Terraform provider: Terraform providers are plugins that are responsible for managing the lifecycle of resources. They don't inherently offer a mechanism to keep secrets out of Terraform configuration files.
upvoted 4 times
...
debabrata6983
1 year, 2 months ago
Selected Answer: B
Secret flag prevents showing up the value in CLI o/p
upvoted 1 times
...
BaburTurk
1 year, 3 months ago
Selected Answer: C
C. A Terraform provider. Terraform providers are used to interact with specific cloud providers or other APIs. They do not have the ability to access or store secrets. The other options, environment variables, marking the variable as sensitive, and the -var flag, can all be used to keep secrets out of Terraform configuration files. Environment variables are a common way to pass secrets to Terraform. They are stored outside of the Terraform configuration files, so they are not visible to anyone who can read the Terraform code. Marking the variable as sensitive tells Terraform to encrypt the variable value when it is stored in the state file. This helps to protect the secret value from being exposed. The -var flag can be used to pass secret values to Terraform from the command line. This is useful for one-off operations, but it is not a recommended way to manage secrets.
upvoted 3 times
Tyler2023
1 year ago
I think Terraform will not encrypt your secrets in your state file, unless you are using Terraform cloud or enterprise
upvoted 1 times
...
...
kudakk
1 year, 3 months ago
Selected Answer: D
GPT: D. A -var flag Using the -var flag when running terraform apply or terraform plan from the command line requires you to specify variable values directly in the command, which could expose sensitive information in the command line history, system process list, or in logs. While the -var flag is a way to set variables in Terraform, it's not a recommended way to handle sensitive information due to the exposure risks associated with command line arguments.
upvoted 1 times
Chrisler
1 year, 2 months ago
But based on the question, "secrets out of Terraform configuration files" Yes it is in the CLI history, sys process list or in logs, but not the terraform configuration.
upvoted 1 times
...
...
arunrkaushik
1 year, 3 months ago
Try to understand the question, it is important : What is one method that cannot be utilized to prevent secrets from appearing in Terraform configuration files? What approach does not work to exclude confidential data from being included in Terraform config files? Which technique is not valid for keeping sensitive information out of the configs managed by Terraform? What is an invalid solution for ensuring private credentials do not get embedded in a Terraform configuration? Which choice is not viable for stopping secret keys and access tokens from being added to Terraform's setup files? What method fails to protect classified details from being inserted into the configuration code used by Terraform?
upvoted 1 times
...
milan92stankovic
1 year, 5 months ago
Selected Answer: B
I vote for B
upvoted 1 times
...
sdm13168
1 year, 6 months ago
Selected Answer: B
tested
upvoted 1 times
...
kiran15789
1 year, 6 months ago
Selected Answer: D
A -var flag
upvoted 2 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 ...