0
0
Terraformcloud~20 mins

Terraform in GitLab CI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform GitLab CI Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Terraform GitLab CI Pipeline Stage Order
Given the following GitLab CI stages for Terraform, what is the correct order to ensure safe infrastructure deployment?
A1,2,3,4
B2,1,3,4
C3,1,2,4
D1,3,2,4
Attempts:
2 left
💡 Hint
Initialization must happen before validation and planning.
security
intermediate
2:00remaining
Protecting Terraform State in GitLab CI
Which option best secures Terraform state files when running Terraform in GitLab CI pipelines?
ADisable state locking to speed up pipeline execution.
BStore state files locally on the GitLab runner disk.
CCommit state files to the Git repository for versioning.
DUse a remote backend like AWS S3 with encryption and access control.
Attempts:
2 left
💡 Hint
State files contain sensitive info and must be protected and shared safely.
service_behavior
advanced
2:00remaining
Terraform Apply Behavior in GitLab CI with Auto-Approve
What is the effect of adding the '-auto-approve' flag to 'terraform apply' in a GitLab CI pipeline?
AIt automatically applies changes without waiting for user confirmation.
BIt requires manual approval before applying changes.
CIt only plans changes but does not apply them.
DIt disables state locking during apply.
Attempts:
2 left
💡 Hint
Think about automation and manual steps in CI pipelines.
Architecture
advanced
2:00remaining
Managing Multiple Environments with Terraform in GitLab CI
Which approach best isolates Terraform state and variables for multiple environments (e.g., dev, staging, prod) in GitLab CI?
AUse a single state file and switch variables inside the pipeline script.
BRun all environments in parallel using the same state and variables.
CUse separate Terraform workspaces or backend state files per environment.
DStore all environment states in one backend bucket without prefixes.
Attempts:
2 left
💡 Hint
Isolation prevents accidental cross-environment changes.
Best Practice
expert
2:00remaining
Handling Sensitive Variables in GitLab CI for Terraform
What is the best practice to securely provide sensitive variables (like AWS credentials) to Terraform in GitLab CI pipelines?
AHardcode sensitive variables directly in the .gitlab-ci.yml file.
BStore sensitive variables in GitLab CI protected variables and reference them in the pipeline.
CCommit sensitive variables in a separate encrypted file in the repository.
DPass sensitive variables as plain text environment variables in pipeline scripts.
Attempts:
2 left
💡 Hint
Think about GitLab features designed for secrets management.