🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Github Action Example code to Call terraform apply command

This workflow:

  • is triggered on a push to the main branch.
  • runs on an Ubuntu runner.
  • checks out the repository code.
  • sets up Terraform using the HashiCorp setup action and specifies the version of Terraform to use.
  • runs terraform init to initialize the working directory.
  • runs terraform apply -auto-approve to apply the changes in the Terraform configuration.

In this example, we also pass an environment variable TF_VAR_my_variable to the terraform apply command. The value of this variable is retrieved from a GitHub secret named MY_SECRET.


name: Terraform Apply

on:
  push:
    branches:
      - main

jobs:
  terraform_apply:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v1
        with:
          terraform_version: '1.0.4'

      - name: Terraform Init
        run: terraform init

      - name: Terraform Apply
        env:
          TF_VAR_my_variable: ${{ secrets.MY_SECRET }}
        run: terraform apply -auto-approve
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x