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

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

Which of the following is the safest way to inject sensitive values into a Terraform Cloud workspace?

  • A. Write the value to a file and specify the file with the -var-file flag
  • B. Set a value for the variable in the UI and check the "Sensitive" check box
  • C. Edit the state file directly just before running terraform apply
  • D. Set the variable value on the command line with the -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
kiran15789
1 year, 6 months ago
Selected Answer: A
The safest way to inject sensitive values into a Terraform Cloud workspace is to write the value to a file and specify the file with the -var-file flag. Option A is the correct answer. This method allows you to store the sensitive value in a file that can be encrypted and stored securely. Terraform Cloud supports encrypted variables, and you can encrypt the file that contains the sensitive value using a tool like SOPS or Vault before uploading it to Terraform Cloud.
upvoted 1 times
...
camps
1 year, 7 months ago
Selected Answer: B
B. Set a value for the variable in the UI and check the "Sensitive" check box. When working with Terraform Cloud workspaces, the safest way to inject sensitive values into a Terraform Cloud workspace is to set a value for the variable in the UI and check the "Sensitive" check box. This will ensure that the value is stored securely and not visible in plain text in the Terraform Cloud UI or API. Option A, writing the value to a file and specifying the file with the -var-file flag, may be less secure because the file could potentially be accessed by unauthorized users. Option C, editing the state file directly just before running terraform apply, is not a best practice and could result in data loss or corruption. Option D, setting the variable value on the command line with the -var flag, could result in the sensitive value being stored in plain text in the command history or other logs, which could be accessed by unauthorized users.
upvoted 4 times
...
princajen
1 year, 9 months ago
Selected Answer: B
B. Set a value for the variable in the UI and check the "Sensitive" check box is the safest way to inject sensitive values into a Terraform Cloud workspace. This ensures that the sensitive values are securely stored and encrypted in the workspace, and are not visible in the Terraform logs or state file. Writing the value to a file or setting the variable value on the command line can expose the sensitive data to unauthorized access, and editing the state file directly is not a recommended practice and can potentially corrupt the state.
upvoted 1 times
...
wanrltw
1 year, 11 months ago
https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables/managing-variables#sensitive-values
upvoted 4 times
...
depal_dhir
2 years, 2 months ago
Selected Answer: B
https://www.terraform.io/cloud-docs/workspaces/variables
upvoted 2 times
...
Hizumi
2 years, 2 months ago
Answer is B. -var and -var-file overwrite workspace-specific and variable set variables that have the same key. From the workspace, variable can be added and checked off as being sensitive. Reference: https://www.terraform.io/cloud-docs/workspaces/variables/managing-variables#loading-variables-from-files https://www.terraform.io/cloud-docs/workspaces/variables
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 ...