0
0
Terraformcloud~10 mins

Terraform in GitHub Actions - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the Terraform version in the GitHub Actions workflow.

Terraform
jobs:
  terraform:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v1
        with:
          terraform_version: [1]
Drag options to blanks, or click blank then click option'
Aterraform
Blatest
Cv1
D1.5.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'latest' instead of a specific version number.
Using 'v1' which is not a valid version format.
Leaving the version blank.
2fill in blank
medium

Complete the code to initialize Terraform in the GitHub Actions workflow.

Terraform
      - name: Terraform Init
        run: terraform [1]
Drag options to blanks, or click blank then click option'
Aapply
Bplan
Cinit
Dvalidate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' instead of 'init' for initialization.
Using 'plan' which only previews changes.
Using 'validate' which only checks configuration syntax.
3fill in blank
hard

Fix the error in the GitHub Actions step to apply Terraform changes automatically.

Terraform
      - name: Terraform Apply
        run: terraform apply -auto-[1]
Drag options to blanks, or click blank then click option'
Aapprove
Baccept
Cconfirm
Dapply
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-auto-confirm' which is invalid.
Using '-auto-accept' which is invalid.
Using '-auto-apply' which is invalid.
4fill in blank
hard

Fill both blanks to configure the GitHub Actions workflow to checkout the repository and set environment variables.

Terraform
      - name: Checkout code
        uses: [1]
      - name: Set environment variables
        run: echo "TF_VAR_region=[2]" >> $GITHUB_ENV
Drag options to blanks, or click blank then click option'
Aactions/checkout@v3
Bhashicorp/setup-terraform@v1
Cus-west-2
Dterraform-latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'hashicorp/setup-terraform@v1' instead of checkout action.
Setting region to an invalid value like 'terraform-latest'.
5fill in blank
hard

Fill all three blanks to create a GitHub Actions step that runs 'terraform plan' and saves the output to a file.

Terraform
      - name: Terraform Plan
        run: terraform [1] -out=[2] && terraform show -json [2] > [3]
Drag options to blanks, or click blank then click option'
Aplan
Btfplan
Cplan.json
Dapply
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' instead of 'plan' for the first blank.
Using invalid file names for output or JSON files.