Challenge - 5 Problems
Terraform State Encryption Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Configuration
intermediate2:00remaining
Enable encryption for Terraform state file in AWS S3 backend
You want to store your Terraform state file securely in an AWS S3 bucket. Which backend configuration snippet correctly enables server-side encryption using AWS-managed keys (SSE-S3)?
Attempts:
2 left
💡 Hint
Look for the exact attribute name that enables AWS S3 server-side encryption with AES256.
✗ Incorrect
The correct attribute to enable AWS S3 server-side encryption with AWS-managed keys (SSE-S3) in Terraform backend is 'encrypt = true'. The 'server_side_encryption' attribute is not valid in the backend configuration. Using 'aws:kms' requires a KMS key ID and is for KMS encryption, not SSE-S3.
❓ Architecture
intermediate2:00remaining
Choosing encryption method for Terraform state in Azure Blob Storage
You are configuring Terraform state storage in Azure Blob Storage. Which option correctly describes how to enable encryption at rest for the state file?
Attempts:
2 left
💡 Hint
Azure Blob Storage encrypts data at rest by default, but you can enhance security with your own keys.
✗ Incorrect
Azure Blob Storage encrypts data at rest by default using Microsoft-managed keys. To use customer-managed keys, you configure a key in Azure Key Vault and link it to the storage account. The backend configuration does not have 'encrypt' or 'server_side_encryption' attributes for Azure. 'use_azuread_auth' is for authentication, not encryption.
❓ security
advanced2:00remaining
Impact of disabling encryption on Terraform state file security
What is the most significant risk if you disable encryption for your Terraform state file stored in a remote backend?
Attempts:
2 left
💡 Hint
Think about what sensitive information the state file contains and what happens if it is not protected.
✗ Incorrect
Terraform state files often contain sensitive information like resource IDs, IP addresses, and secrets. Without encryption, if the storage backend is compromised, attackers can access this data. Disabling encryption does not cause corruption, initialization failure, or size increase.
❓ service_behavior
advanced2:00remaining
Behavior of Terraform when state file encryption key is rotated in AWS KMS
If you use AWS KMS customer-managed keys (CMK) for encrypting your Terraform state file in S3 and rotate the CMK, what happens when Terraform tries to access the state file?
Attempts:
2 left
💡 Hint
Consider how AWS KMS key rotation works with the same key alias or ID.
✗ Incorrect
AWS KMS supports automatic key rotation for customer-managed keys without changing the key ID or alias. This means Terraform can decrypt the state file transparently after rotation. Terraform does not need backend config changes, nor does it create new state files automatically. It never ignores encryption.
✅ Best Practice
expert3:00remaining
Best practice for managing Terraform state encryption keys in a multi-team environment
In a large organization with multiple teams managing infrastructure via Terraform, what is the best practice for managing encryption keys used for Terraform state files stored in a centralized backend?
Attempts:
2 left
💡 Hint
Think about security isolation and accountability in multi-team environments.
✗ Incorrect
Using individual customer-managed keys per team with strict access controls and audit logging provides security isolation, limits blast radius, and improves accountability. Sharing a single key broadly weakens security. Disabling encryption or using default keys without restrictions exposes sensitive data and reduces control.