MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

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
Code language: JavaScript (javascript)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to Build Dynamic Websites Using GitHub Pages, REST APIs and GitHub Actions

Featured image โ€” GitHub Pages dynamic website tutorial. A practical guide for developers, DevOps engineers, technical bloggers and open-source maintainers who want interactive websites and automated publishing…

Read More

How to Build a CI/CD Pipeline for an MVP Without Slowing the Launch

A CI/CD pipeline for an MVP is the smallest automated path from a merged commit to a running staging environment: build, test, deploy, and a way to…

Read More

GitHub Actions: paths-filter complete Guide

dorny/paths-filter is a GitHub Action that checks which files changed in a pull request or push. It sets a true/false output for each named filter, so later…

Read More

GitHub Tutorials: Builds only when specific directories have code changes include / exclude

GitHub Actions can skip a workflow when a push or pull request changes no relevant files. You do this with the paths or paths-ignore filters on the…

Read More

Bare Metal vs Cloud for CI/CD Runners and Build Servers

Why it matters where your pipelines run Most teams pick a CI runner once and never revisit it. The usual default is the hosted runner that comes…

Read More

What Is GitHub Actions Runner Controller?

GitHub Actions is a CI/CD platform that automates tasks such as building applications, running tests, creating Docker images, and deploying software. Every GitHub Actions job requires a…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x