Find the detailed documentation for reusable workflows here.
Create a file in the path .github/workflows, example down below.
name: 'Build'
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
branches:
- main
jobs:
call-workflow:
strategy:
matrix:
target: [./, ./common, ./network]
uses: ScalefreeCOM/TFAutomation_templates/.github/workflows/terraform-build.yml@main
with:
region: eu-west-3
tf_version: "1.5.4"
working_directory: ${{ matrix.target }}
secrets: inherit
permissions:
contents: read
Note
on: when workflow is triggered
uses: path to reusable workflow
with: inputs for reusable workflow
If you have multiple directories use the matrix strategy:
strategy:
matrix:
target: [./, ./common, ./network]
replace your directories with those in the example.
terraform-build.yml
input name | default | required |
---|---|---|
runs-on | ubuntu-latest | no |
region | eu-west-1 | no |
cloud_provider | aws | specific for provider |
tf_version | - | yes |
working_directory | - | yes |
secrets | requires |
---|---|
TFAUTOMATION_AWS_ACCESS_KEY | yes |
TFAUTOMATION_AWS_SECRET_ACCESS_KEY | yes |
terraform-deploy.yml
input name | default | required |
---|---|---|
runs-on | ubuntu-latest | no |
region | eu-west-1 | no |
cloud_provider | aws | specific for provider |
tf_version | - | yes |
working_directory | - | yes |
approvers | - | yes |
minimum-approvals | 2 | no |
issue-title | Deploying | no |
issue-body | Please approve or deny the deployment | no |
secrets | requires |
---|---|
TFAUTOMATION_AWS_ACCESS_KEY | yes |
TFAUTOMATION_AWS_SECRET_ACCESS_KEY | yes |
docker-image-build-push.yml
input name | default | required |
---|---|---|
runs-on | ubuntu-latest | no |
region | eu-west-1 | no |
ecr-repo | - | yes |
image_tag | latest | no |
secrets | requires |
---|---|
TFAUTOMATION_AWS_ACCESS_KEY | yes |
TFAUTOMATION_AWS_SECRET_ACCESS_KEY | yes |