Skip to content

infinite-automations/terraform-all-in-one

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-all-in-one

Semantic Release

Run common Terraform commands in a single GitHub action

Usage

name: Deploy
on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

permissions:
  contents: read

jobs:
  deploy:
    name: Deploy And Destroy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Deploy With Value 1
        uses: "infinite-automations/[email protected]"
        with:
          directory: "./terraform"
          apply: true
        env:
          TF_VAR_my_var: "value1"
      - name: Run Test 1
        run: |
          echo "Running test 1..."
      - name: Deploy With Value 2
        uses: "infinite-automations/[email protected]"
        with:
          directory: "./terraform"
          apply: true
        env:
          TF_VAR_my_var: "value2"
      - name: Run Test 2
        uses: "infinite-automations/[email protected]"
        with:
          directory: "./terraform"
          test-directory: "./terraform"
          format: false
          validate: false
          plan: false
          test: true
      - name: Destroy
        uses: "infinite-automations/[email protected]"
        with:
          directory: "./terraform"
          setup: false
          init: false
          format: false
          validate: false
          plan: false
          apply: false
          destroy: true

You can configure additional command arguments with inputs.

Inputs

Input Name Description Required Default
directory The directory where the Terraform configuration files are located false .
test-directory The directory where the Terraform test configuration files are located false .
terraform-version The version of Terraform to use false latest
plan-file The path to the plan file false plan.json
common-args The arguments to pass to all terraform commands false
init-args The arguments to pass to terraform init false
validate-args The arguments to pass to terraform validate false
fmt-args The arguments to pass to terraform fmt false -check
test-args The arguments to pass to terraform test false
plan-args The arguments to pass to terraform plan false
apply-args The arguments to pass to terraform apply false
destroy-args The arguments to pass to terraform destroy false
setup Whether to setup false true
init Whether to init false true
format Whether to format false true
validate Whether to validate false true
test Whether to test false false
plan Whether to plan false true
apply Whether to apply false false
destroy Whether to destroy false false

Outputs

Output Name Description Value
output-json JSON formatted terraform output ${{ steps.apply.outputs.output-json }}

Changelog

See the Changelog file for details

About

Run common Terraform commands in a single GitHub action

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages