This repository contains ready-to-use actions for your pipelines.
Below are some example on how they can be used:
This example expects the following structure:
.
βββ .github/
β βββ workflows/
β βββ test.yaml
βββ src
β βββ main.tf
β βββ module.yaml
β βββ outputs.tf
β βββ variables.tf
βββ tests
βββ test1-something.py
βββ test2-othercheck.py
βββ test3-thirdcheck.py
See example of a test file here: https://preview.infraweave.io/python/#example
This will:
- lint the terraform code
- if it passes; find all python files in the
testsfolder and run them in parallel
# Filename: ./github/workflows/test.yaml
name: Test Module
on: push
permissions:
id-token: write # for OIDC
contents: read
jobs:
terraform-lint-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.5.7'
- name: Install TFLint
run: |
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
- name: Run TFLint
run: tflint --chdir "./src"
- name: Terraform Validate
run: |
terraform -chdir="./src" init
terraform -chdir="./src" validate
run-tests:
needs: terraform-lint-validate
uses: infraweave-io/actions/.github/workflows/test-module.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
with:
central_account_id: "000000000000" # Modify this (recommended to use a variable)
workload_account_id: "111111111111" # Modify this (recommended to use a variable)
environment: "dev"
identifier: ${{ github.sha }}
This example expects the following structure:
.
βββ .github/
β βββ workflows/
β βββ publish-module.yaml
βββ src
β βββ main.tf
β βββ module.yaml
β βββ outputs.tf
β βββ variables.tf
...
This will:
- publish an InfraWeave module with the desired version
# Filename: ./github/workflows/publish-module.yaml
name: Publish Module
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
type: string
default: 0.0.1-dev+some-branch-replace-me
permissions:
id-token: write # for OIDC
contents: read
jobs:
publish-module-dev:
uses: infraweave-io/actions/.github/workflows/publish-module.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
with:
central_account_id: "000000000000" # Modify this (recommended to use a variable)
environment: "dev"
version: ${{ inputs.version }}This example expects the following structure:
.
βββ .github/
β βββ workflows/
β βββ publish-stack.yaml
βββ src
β βββ claim-bucket.yaml
β βββ claim-ec2.yaml
β βββ claim-s3.yaml
β βββ stack.yaml
...
This will:
- publish an InfraWeave stack with the desired version
# Filename: ./github/workflows/publish-stack.yaml
name: Publish Stack
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
type: string
default: 0.0.1-dev+some-branch-replace-me
permissions:
id-token: write # for OIDC
contents: read
jobs:
publish-module-dev:
uses: infraweave-io/actions/.github/workflows/publish-stack.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
with:
central_account_id: "000000000000" # Modify this (recommended to use a variable)
environment: "dev"
version: ${{ inputs.version }}
This example expects the following structure:
.
βββ .github/
β βββ workflows/
β βββ test.yaml
βββ src
β βββ s3bucket.yaml
β βββ stack.yaml
β βββ ec2.yaml
βββ tests
βββ test1-something.py
βββ test2-othercheck.py
βββ test3-thirdcheck.py
See example of a test file here: https://preview.infraweave.io/python/#example
This will:
- find all python files in the
testsfolder and run them in parallel
# Filename: ./github/workflows/test.yaml
name: Test Stack
on: push
permissions:
id-token: write # for OIDC
contents: read
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
run-tests:
needs: checkout
uses: infraweave-io/actions/.github/workflows/test-stack.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
with:
central_account_id: "000000000000" # Modify this (recommended to use a variable)
workload_account_id: "111111111111" # Modify this (recommended to use a variable)
environment: "dev"
identifier: ${{ github.sha }}