Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 70


You're building a CI/CD (continuous integration/ continuous delivery) pipeline and need to inject sensitive variables into your Terraform run.

How can you do this safely?

Show Answer
Correct Answer: A

The safest way to handle sensitive variables in a CI/CD pipeline is to pass them to Terraform using the -var flag. This practice allows you to supply the values of sensitive variables at runtime, avoiding hardcoding them directly into the Terraform code or storing them in insecure locations such as a source code repository. For even greater security, you can use environment variables or secret management tools supported by your CI/CD platform to pass these values without exposing them.

Discussion

22 comments
Sign in to comment
BereOption: A
Aug 15, 2023

The safest method to inject sensitive variables into your Terraform run in a CI/CD pipeline is: A. Pass variables to Terraform with a -var flag. When running Terraform in your CI/CD pipeline, you would pass the sensitive variables like this: terraform apply -var="database_password=mysecretpassword" -var="api_key=1234567890abcdef" For enhanced security, in a CI/CD environment, you'd typically use environment variables or secret management tools that are supported by your CI/CD platform to pass these sensitive values, so they are never exposed in logs or stored in insecure locations. For instance, using environment variables: export TF_VAR_database_password=mysecretpassword export TF_VAR_api_key=1234567890abcdef terraform apply

AnonymousOption: A
Jun 9, 2022

Definitely A.

samimshaikhOption: A
Dec 29, 2023

The safest option among the choices provided is to use the -var flag to pass sensitive variables to Terraform. This allows you to provide variable values at runtime without hardcoding them directly into the Terraform code or exposing them in the source code repository.

EltoothOption: A
Jun 28, 2022

A is correct answer : -var See Topic 1 # Question 43 https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1

campsOption: A
Mar 31, 2023

A. Pass variables to Terraform with a "var" flag. When running Terraform in a CI/CD pipeline, it is important to securely pass sensitive variables to Terraform. One way to pass sensitive variables to Terraform is to use the -var flag to supply the value of the variable at runtime.

bp339Option: A
Jun 4, 2022

A is the answer

FaaizzOption: A
Apr 4, 2023

Obviously A

TlakminiOption: A
Aug 10, 2023

https://developer.hashicorp.com/terraform/language/values/variables

Jedi
May 7, 2022

Shouldn't this be A? Making variables part of the code just doesn't sound right.

Echo89
May 9, 2022

I would choose A as well

Sunrayk
May 12, 2022

Should be A; definitely not the option provided

Oyster
May 14, 2022

A sounds right

bigboi23Option: A
May 18, 2022

I too would go with A

biscuithammerOption: A
May 24, 2022

I vote A

Ahmad_Terraform
Jul 14, 2022

A= correct Var

Tomcrui1234589
Aug 8, 2022

A for sure

tf_userOption: A
Sep 16, 2022

A is correct

eduvar4Option: A
Sep 27, 2022

https://developer.hashicorp.com/terraform/language/values/variables

thor7Option: A
Mar 29, 2023

A is a correct answer Reference: https://developer.hashicorp.com/terraform/language/values/variables

Power123
Mar 31, 2023

A is correct

cloudznj
Jul 6, 2023

I see that is A but since its on B. Will it be B on the exam? Or that option, even though everyone is on A. Just curious.

LunarPhobia
Jul 26, 2023

The answers on here aren't always correct. Typically go with the highest rated one

akki_0108Option: A
Sep 21, 2024

A is Correct for passing sensitive vars to CI/CD