Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 76


Which of these options is the most secure place to store secrets foe connecting to a Terraform remote backend?

Show Answer
Correct Answer: AC

The most secure place to store secrets for connecting to a Terraform remote backend is by defining them in a connection configuration outside of Terraform. Utilizing secret management tools such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault provides higher security through access control and encryption mechanisms. By keeping secrets outside of the Terraform configuration, it minimizes the risk of exposing sensitive information in configuration files or environment variables, which could be inadvertently exposed or shared.

Discussion

17 comments
Sign in to comment
zyxphreezOption: A
Aug 24, 2022

Definitely is: A https://www.terraform.io/language/settings/backends/configuration#credentials-and-sensitive-data Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive credentials.

deepeshukla
Jun 26, 2023

I will select C. In option A, any debugging will still disclose data.

Gomjaba
Sep 9, 2023

I presume they are hinting at vault here.

Alandt
Jan 23, 2024

Authentication outside of Terraform is more secure than environment variables. Your environment variables can still refer to a file or the definition of your variables inside terraform. So I would go for C.

CHRIS12722222Option: C
Jul 29, 2022

I will go for option C. Whenever possible, it is best to authenticate outside of terraform to keep secrets out of state file

Alandt
Jan 25, 2024

I agree with this.

Venki_devOption: C
Apr 19, 2024

C. Defined in a connection configuration outside of Terraform (Most Secure) This is the most secure option. Here, you store your secrets in a separate dedicated location outside of your Terraform configuration. There are several ways to achieve this: Secret Management Tools: Utilize tools like HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault to store and manage your secrets securely. These tools offer access control and encryption mechanisms. Encrypted Files: Store secrets in an encrypted file outside your Terraform configuration directory. Terraform can access these secrets during execution by referencing the decrypted content of the file.

samimshaikhOption: C
Dec 29, 2023

C. Defined in a connection configuration outside of Terraform The most secure option for storing secrets for connecting to a Terraform remote backend is to define them in a connection configuration outside of Terraform. This involves using external configuration files or secure credential management tools. Option A (defined in environment variables) is also a good practice for sensitive information, but it might be less secure than an external configuration file if, for example, there is a risk of exposing environment variables. Option B (inside the backend block within the Terraform configuration) is generally not recommended for storing sensitive information like secrets because Terraform configuration files may be versioned and shared, posing a security risk. Therefore, when dealing with sensitive information, it's a good practice to use external and secure methods for configuration, such as a separate configuration file or a secure credential management tool.

enookOption: C
Jan 18, 2024

Chat GPT: The most secure option for storing secrets for connecting to a Terraform remote backend is typically: C. Defined in a connection configuration outside of Terraform Storing sensitive information, such as authentication credentials, outside of the Terraform configuration helps enhance security by preventing accidental exposure or leakage of sensitive data. Using external tools or configuration management systems to manage secrets can provide additional layers of security and access control. It is generally not recommended to store sensitive information directly within the Terraform configuration (option B) to minimize the risk of inadvertent exposure. Additionally, environment variables (option A) can be a good practice for storing secrets securely, but they need to be managed carefully to avoid unintended exposure.

deepakpambanOption: C
May 4, 2024

Option C

TigerInTheCloudOption: A
Dec 18, 2023

https://developer.hashicorp.com/terraform/language/settings/backends/configuration Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive credentials.

[Removed]Option: D
Dec 20, 2023

It seems to be D

vipulchoubisaOption: A
Jan 9, 2024

Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive credentials. ANSWER SHOULD BE "A"

parag09Option: A
Jan 11, 2024

The most secure place to store secrets for connecting to a Terraform remote backend is typically defined in environment variables.

AlandtOption: C
Jan 23, 2024

Definitely C. Authentication outside of Terraform is the most secure way.

Kaname93Option: A
Feb 26, 2024

From the documentation : Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive credentials. So it's A

AntonyPeter7Option: C
Mar 3, 2024

Authentication outside of Terraform is more secure than environment variables. Like using terraform vault or cloud

aksliveswithawsOption: A
Apr 1, 2024

https://developer.hashicorp.com/terraform/language/settings/backends/configuration#credentials-and-sensitive-data:~:text=and%20apply%20steps.-,backend%20types,-The%20block%20label

kingfighersOption: A
Apr 3, 2024

choose A: when we use vault, we still need to download it into a file,here is official doc: - **File**: A configuration file may be specified via the `init` command line. To specify a file, use the `-backend-config=PATH` option when running `terraform init`. If the file contains secrets it may be kept in a secure data store, such as [Vault](https://www.vaultproject.io/), in which case it must be downloaded to the local disk before running Terraform. https://developer.hashicorp.com/terraform/language/settings/backends/configuration#credentials-and-sensitive-data

Molly1994Option: C
Jun 5, 2024

C vault as example

SureNotOption: C
Jun 11, 2024

Let's imagine use AWS S3 bas a backend. Credentials to S3 Bucket are stored in ~/.aws/credentials file - Outside of terraform, most secure way.