0
0
Terraformcloud~20 mins

Why security matters in IaC in Terraform - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
IaC Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is it important to keep secrets out of Terraform code?

In Infrastructure as Code (IaC), why should sensitive information like passwords or API keys not be hardcoded directly in Terraform files?

ABecause hardcoded secrets automatically encrypt themselves, so it is unnecessary.
BBecause Terraform does not support variables for sensitive data.
CBecause secrets in code make Terraform run slower.
DBecause hardcoding secrets can expose them in version control and logs, risking unauthorized access.
Attempts:
2 left
💡 Hint

Think about who can see the code and what happens if secrets are exposed.

Architecture
intermediate
2:00remaining
What is a secure way to manage secrets in Terraform?

Which method is the most secure way to handle sensitive values like passwords in Terraform configurations?

AStore secrets in environment variables or secret management services and reference them in Terraform variables marked as sensitive.
BWrite secrets directly in Terraform files as plain text variables.
CUse Terraform locals to store secrets inside the configuration.
DCommit secrets in encrypted files inside the same repository without access controls.
Attempts:
2 left
💡 Hint

Consider how secrets can be kept out of code and safely injected during deployment.

service_behavior
advanced
2:00remaining
What happens if Terraform state files contain unencrypted secrets?

Terraform stores state files to track infrastructure. What is the risk if these state files contain unencrypted sensitive data?

AAnyone with access to the state file can read sensitive information, leading to potential security breaches.
BTerraform will automatically encrypt the state file, so there is no risk.
CThe state file size will increase but no security risk occurs.
DTerraform will refuse to apply changes if secrets are in the state file.
Attempts:
2 left
💡 Hint

Think about who can access the state file and what information it contains.

security
advanced
2:00remaining
Which Terraform backend setup improves security for state files?

Which backend configuration best protects Terraform state files containing sensitive data?

ACommit state files to a public Git repository for easy sharing.
BStore state files locally on developer machines without encryption.
CUse a remote backend with encryption at rest, access controls, and versioning enabled.
DUse a remote backend without any access restrictions or encryption.
Attempts:
2 left
💡 Hint

Consider how to protect state files from unauthorized access and accidental loss.

Best Practice
expert
2:00remaining
What is the best practice to prevent accidental exposure of secrets in Terraform workflows?

Which practice most effectively prevents accidental exposure of secrets during Terraform development and deployment?

ARely on developers to manually check for secrets before committing code.
BImplement automated scanning of Terraform code and state files for secrets before commits and deployments.
CStore all secrets in plain text files alongside Terraform code for easy access.
DDisable Terraform logging to hide secret values during runs.
Attempts:
2 left
💡 Hint

Think about how automation can help catch mistakes early.