Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 43


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

Show Answer
Correct Answer: D

A 'secure string' is not a recognized or standard feature in Terraform for keeping secrets out of configuration files. Terraform provides several methods to keep secrets and sensitive information out of configuration files, including using a Terraform provider specifically designed for managing secrets (like Vault), environment variables prefixed with TF_VAR_, and the -var command-line flag. However, there is no built-in mechanism in Terraform referred to as a 'secure string' to accomplish this.

Discussion

40 comments
Sign in to comment
hip9kOption: D
Aug 23, 2022

It's D We can use providers to supply variable values (vault for example). We can provide input variable value in parameter for apply command. We can use environment variables. HashiCorp is not mentioning anything about secure strings. Reference: https://www.terraform.io/language/values/variables

[Removed]
Jun 25, 2023

Terraform does not have a built-in concept of a "secure string". This means that you cannot use the secure_string keyword to define a secret in your Terraform configuration file. Link below recommends the three options. A. e.g. Vault B. e.g. export TF_VAR_db_username=admin TF_VAR_db_password=adifferentpassword C. -var-file="secret.tfvars" https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables

stalk98
Jun 6, 2022

i think D

habros
Jun 5, 2022

I lean my decision towards A. Use a provider like Vault or Parameter Store to store sensitive keys

Empel
Jun 25, 2022

Is asking which is not.

EltoothOption: B
Jun 27, 2022

If we remove the "not" from the question, we can eliminate incorrect answers. Which option can "not" be used to keep secrets out of Terraform configuration files? A. A Terraform provider - can pass strings and templates containing secrets within provider module B. Environment variables - TF_VAR can be used to inject secrets outside of code C. A -var flag - Can be used to pass variable from secret.tfvars file D. secure string - Can be used to hold password Correct answer is B https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1

yuvifose
Jul 18, 2022

Yepp, looks like a typo in the question

abconline
May 29, 2022

question is what cannot be used so I think A is correct

Jlee7
Jun 25, 2023

Answer is A A Terraform provider is a software library that allows Terraform to interact with a particular cloud provider or other infrastructure service. Terraform providers do not have the ability to store secrets, so they cannot be used to keep secrets out of Terraform configuration files.

koneba1309
May 2, 2022

Even B is valid option, as you can pass variables by setting the TF_VAR_whatever env variables

Cassterraform
Sep 9, 2022

I think its A as its provider which has no relation with keeping secrets

CryptoShade
Apr 18, 2024

Answer is: A. Terraform provider It says: to Hide secrets and not include secrets. Here's why the other options are suitable for hiding secrets: B. Environment variables: Environment variables store sensitive information outside of Terraform code, and Terraform can access them during execution. C. A -var flag: The -var flag allows passing secrets as command-line arguments when running terraform apply or other commands. These arguments aren't stored in the configuration files. D. Secure string: Some Terraform providers (like AWS) offer functionality to store secrets securely within the provider itself (e.g., AWS Secrets Manager). This keeps them out of the configuration files.

szl0144
Jun 22, 2022

D is correct in my view.

Ahmad_Terraform
Jun 27, 2022

A seems credible , Provider can not be used

devopschampOption: A
Jul 3, 2022

A appears to be the correct answer, by reading these references: https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1 and this https://github.com/hashicorp/terraform/issues/516

donathonOption: A
Aug 10, 2022

B and C is definate a method as it's well documented. https://www.terraform.io/language/values/variables#variables-on-the-command-line >> this shows an example of using -var during an apply to put in something like secrets of password so it's not stored anywhere else. But this is not a very good method as the state file will still contain the password in plain text.

bukake
Aug 20, 2022

Well AWS provider apply sensitive = true automatically for any DB created so technically Provider can be used to secure value

adoubanOption: D
Dec 9, 2022

D, in terraform cloud they offer sensitive variable that contains sensitive information like passwords. "secure string" does not exist for terraform

FarziWaliMarziOption: C
Apr 22, 2023

I beg to differ with general thoughts here. We need to focus on statement "out of configuration file. They are not talking about security in this question.

bider_swit
Jun 29, 2023

-var is used in the cli

mememu
May 2, 2023

A is incorrect, A provider can also declare an attribute as sensitive, which will cause Terraform to hide it from regular output regardless of how you assign it a value. Ref. https://developer.hashicorp.com/terraform/language/values/variables

BereOption: D
Jul 30, 2023

Answer is D. A. Terraform Provider: You can use sensitive variables in Terraform Cloud (below link) or other secrets management solutions (e.g. AWS Secrets Manager). Sensitive variables / sensitive values is described here: https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables/managing-variables#sensitive-values B. Environment Variables: You can use environment variables. Terraform will read environment variables that start with TF_VAR_, followed by the name of a declared variable in your configuration. C. -var flag: You can use the -var command line flag. This is useful for setting sensitive data that should not be stored in your configuration. e.g. terraform apply -var 'db_password=My$ecretP@ssw0rd' D. "secure string" is not a valid option for keeping secrets out of Terraform configuration files. The term "secure string" is not a recognized or standard feature in Terraform.

Spandrop
Aug 31, 2023

Bad answers for this question. Definitely you cannot use a terraform provider to keep secrets out of your terraform configuration. Even if you use Vault, you must provide the Vault itself secrets and or you save to a file, in an environment variable, or within the provider itself. So "A" is wrong. The issue is that "D" is also wrong. A and D should be the answers for this question in my opinion.

imkhan
Nov 5, 2023

I will go for A. All other options are to keep secrets out of Terraform configuration files, you typically use environment variables, a -var flag, or secure string variables.

Felienator
Apr 15, 2024

swear to god these questions are worded so fking poorly

EmpelOption: D
Jun 27, 2022

The correct is D

trongod05
Jul 1, 2022

What is a -var flag?

nhatneOption: D
Jul 10, 2022

I vote D

prince1234Option: D
Aug 8, 2022

I dont think they is something called secure string.

ychandunanu
Dec 27, 2022

A is correct

robertninho
Jan 5, 2023

I think its D mate, Option A is incorrect, as you can use a Terraform provider to store and retrieve sensitive data, such as passwords and API keys, from a remote location. The provider is responsible for interacting with the remote location and retrieving the sensitive data when needed.

agmesas
Feb 6, 2023

D. Use terraform Vault provider, Environment variables and -var flag to avoid pass sensitive data en configuration files. You can find it in the Exam Objetives (7g and 8b). The data is in plain text in state file but here is about how we pass the sensitive data (secrets).

sahara99Option: D
Feb 15, 2023

haven't seen anything about secure strings on HashiCorp!

nharazOption: D
Feb 19, 2023

D. secure string is not an option for keeping secrets out of Terraform configuration files. Secure string: While there is no option for a "secure string" in Terraform, you can use a number of different techniques to encrypt or obfuscate sensitive information in your configuration files. For example, you might use a tool like SOPS to encrypt your Terraform code, or you might use a tool like Vault to store and manage your secrets separately from your code.

Power123
Mar 30, 2023

secure string. Ans is D

campsOption: D
Apr 1, 2023

D. Secure string. Secure string is not a valid option for keeping secrets out of Terraform configuration files. There is no Terraform data type called secure string. It is possible that this option is referring to an external secrets management tool or encryption mechanism, but it is not a built-in Terraform feature.

Ni33Option: A
May 1, 2023

I think it is A. Provider has nothing to do with secret Managment.

milan92stankovicOption: D
Jun 16, 2023

It's D.

March2023Option: D
Jun 16, 2023

Terraform does not have a built-in "secure string" option

BtotheJOption: D
Aug 10, 2023

D is correct because all other options can be used to keep secrets out of terraform config files

Pradh
Sep 26, 2023

C is the answer

gofavad926Option: D
Sep 29, 2023

D, "secure string"

vibzr2023
Mar 27, 2024

D is correct.. In Terraform, the term "secure string" isn't a specific built-in type or feature by that name. However, the concept of treating certain strings as "secure" or sensitive is indeed present in Terraform, particularly through the use of the sensitive attribute for variables and outputs. When we refer to a "secure string" in the context of Terraform, it's generally about handling sensitive values such as passwords, secret keys, or any confidential data that should not be exposed in logs or CLI output. Here's how you can declare a variable as sensitive: variable "api_secret_key" { type = string sensitive = true }

Bolgarwow
Mar 29, 2024

can not be used to keep secrets D - Secret String

__Moritz__
Aug 4, 2024

A. A Terraform provider A Terraform provider is not typically used to keep secrets out of Terraform configuration files. Instead, environment variables, the -var flag, and secure strings are common methods used to manage secrets securely in Terraform.

suri_surendraOption: A
Dec 29, 2024

The correct answer is: A. A Terraform provider Explanation: Terraform providers are used to interact with external APIs and services (e.g., AWS, Azure, Google Cloud), but they are not designed to manage secrets or keep them out of configuration files. The other options, however, are valid ways to keep secrets secure.