Which method is recommended for supplying sensitive variables to Terraform during automation?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which method is recommended for supplying sensitive variables to Terraform during automation?

Explanation:
When automating Terraform, secrets should not be baked into code or stored in plaintext. The best approach is to provide sensitive values at runtime through the Terraform CLI, such as with the -var flag (and you can pair this with a -var-file or environment variables). This keeps secrets out of the configuration and version control, which reduces the risk of leakage in pipelines or code repos, while still allowing automated deployments to inject the values you need for each environment. The other options place secrets directly in the codebase or plugins, or store them in plaintext in VCS, which is insecure and prone to exposure. Using -var to pass variables aligns with secure, repeatable automation and keeps the configuration environment-agnostic.

When automating Terraform, secrets should not be baked into code or stored in plaintext. The best approach is to provide sensitive values at runtime through the Terraform CLI, such as with the -var flag (and you can pair this with a -var-file or environment variables). This keeps secrets out of the configuration and version control, which reduces the risk of leakage in pipelines or code repos, while still allowing automated deployments to inject the values you need for each environment. The other options place secrets directly in the codebase or plugins, or store them in plaintext in VCS, which is insecure and prone to exposure. Using -var to pass variables aligns with secure, repeatable automation and keeps the configuration environment-agnostic.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy