Skip to content

Terraform GitHub Import #140

Terraform GitHub Import

Terraform GitHub Import #140

---
name: Terraform GitHub Import
on:
workflow_dispatch:
inputs:
dry_run:
description: "Dry Run"
required: true
type: boolean
default: true
env:
TF_VAR_GITHUB_APP_PEM_FILE: ${{ secrets.TF_VAR_GITHUB_APP_PEM_FILE }}
jobs:
terraform-github-import:
name: Terraform GitHub Import
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./terraform/github/"
steps:
- name: GitHub Checkout 🛎
uses: actions/checkout@v4
- name: Setup Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.10.4"
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_wrapper: false
- name: Terraform fmt
id: fmt
run: terraform fmt -check
- name: Terraform Init
id: init
run: terraform init
- name: Run import_resources [--dry-run]
id: dry-run
if: ${{inputs.dry_run == true}}
run: ./import_resources.py -n
- name: Run import_resources [--no-dry-run]
if: ${{inputs.dry_run == false}}
run: ./import_resources.py