0
0
Terraformcloud~5 mins

Terraform in GitLab CI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of using Terraform in GitLab CI?
Terraform in GitLab CI automates the process of creating, changing, and managing infrastructure as code during the software development lifecycle.
Click to reveal answer
beginner
Which GitLab CI file defines the Terraform pipeline stages?
The .gitlab-ci.yml file defines the pipeline stages, including Terraform commands like init, plan, and apply.
Click to reveal answer
intermediate
Why should Terraform state files be stored remotely in GitLab CI pipelines?
Storing Terraform state files remotely ensures team collaboration, prevents state conflicts, and keeps state data safe and consistent across pipeline runs.
Click to reveal answer
beginner
What is the role of the terraform plan command in GitLab CI?
terraform plan shows the changes Terraform will make to the infrastructure without applying them, helping to review before deployment.
Click to reveal answer
intermediate
How do you securely provide Terraform variables and credentials in GitLab CI?
Use GitLab CI environment variables or GitLab's secret management to securely pass sensitive data to Terraform during pipeline execution.
Click to reveal answer
Which file is essential to configure Terraform jobs in GitLab CI?
Avariables.tf
Bterraform.tfstate
Cmain.tf
D.gitlab-ci.yml
What does the terraform init command do in a GitLab CI pipeline?
ADeletes existing infrastructure
BApplies infrastructure changes
CInitializes Terraform and downloads required providers
DShows planned changes without applying
Why is remote state storage recommended in GitLab CI pipelines using Terraform?
ATo allow multiple users to share the state safely
BTo speed up pipeline execution
CTo avoid writing any state files
DTo store pipeline logs
How can sensitive Terraform variables be securely passed in GitLab CI?
AUsing GitLab CI environment variables marked as protected
BHardcoding in .gitlab-ci.yml
CStoring in public Git repository
DPassing as plain text in pipeline logs
What is the main benefit of running terraform plan before terraform apply in GitLab CI?
ATo delete old infrastructure
BTo preview infrastructure changes before applying
CTo initialize Terraform
DTo store state remotely
Explain how Terraform integrates with GitLab CI to automate infrastructure deployment.
Think about the pipeline steps and how Terraform commands fit in.
You got /4 concepts.
    Describe best practices for managing Terraform state and secrets in GitLab CI pipelines.
    Focus on security and collaboration aspects.
    You got /4 concepts.