0
0
Terraformcloud~20 mins

When workspaces are appropriate in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Workspace Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of Terraform Workspaces

Which scenario best describes when to use Terraform workspaces?

AManaging multiple environments like dev, staging, and prod within the same configuration.
BStoring sensitive variables securely outside of Terraform state files.
CRunning Terraform commands faster by caching resources locally.
DAutomatically scaling cloud resources based on traffic.
Attempts:
2 left
💡 Hint

Think about how Terraform separates state for different deployments.

Architecture
intermediate
2:00remaining
Workspace Usage in Infrastructure Architecture

You have a Terraform configuration for a web app. You want to deploy it to two AWS accounts: one for testing and one for production. How should you use workspaces?

AUse one workspace and change the AWS provider credentials manually before each deploy.
BCreate separate workspaces named 'test' and 'prod' and switch between them to deploy to each account.
CCreate multiple Terraform configurations, one per account, without using workspaces.
DUse workspaces only for different regions, not accounts.
Attempts:
2 left
💡 Hint

Workspaces help manage multiple states but consider provider credentials.

service_behavior
advanced
2:00remaining
Effect of Workspace Switch on Terraform State

What happens to the Terraform state when you switch from the 'default' workspace to a new workspace named 'feature'?

ATerraform loads a separate state file for 'feature', isolating its resources from 'default'.
BTerraform merges the 'feature' workspace state with the 'default' workspace state.
CTerraform deletes the 'default' workspace state and replaces it with 'feature' state.
DTerraform keeps using the 'default' workspace state regardless of the switch.
Attempts:
2 left
💡 Hint

Think about how workspaces isolate state files.

security
advanced
2:00remaining
Security Considerations with Terraform Workspaces

Which statement about security when using Terraform workspaces is true?

AWorkspaces store sensitive data separately from the state file to enhance security.
BWorkspaces automatically encrypt all sensitive variables in the state file.
CUsing multiple workspaces prevents unauthorized access to any state files by default.
DWorkspaces do not encrypt state files; sensitive data must be protected by backend encryption or access controls.
Attempts:
2 left
💡 Hint

Consider how Terraform stores state and sensitive data.

Best Practice
expert
2:00remaining
Best Practice for Using Workspaces in Large Teams

In a large team managing multiple environments with Terraform, what is the best practice regarding workspaces?

AUse a single workspace for all environments to simplify management.
BCreate one workspace per team member to avoid conflicts.
CUse workspaces only for short-lived feature branches; use separate configurations or backends for long-term environments.
DAvoid workspaces entirely and manage state files manually.
Attempts:
2 left
💡 Hint

Think about state isolation and team collaboration challenges.