sondehub-infra/.github/workflows/main.yml

53 lines
1.4 KiB
YAML
Raw Normal View History

2021-11-12 11:47:43 +00:00
name: 'Terraform GitHub Actions'
on:
2023-07-07 01:42:16 +00:00
workflow_dispatch:
2021-11-12 11:47:43 +00:00
push:
branches:
- main
env:
tf_version: 'latest'
tf_working_dir: '.'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
terraform:
environment: main
name: 'Terraform'
runs-on: ubuntu-latest
2021-12-15 08:48:28 +00:00
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
2022-01-29 03:52:34 +00:00
contents: write
2021-11-12 11:47:43 +00:00
steps:
2021-12-15 08:19:34 +00:00
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-southeast-2
role-to-assume: arn:aws:iam::143841941773:role/github
role-session-name: Terraform
2021-11-12 11:47:43 +00:00
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.1.5
2021-11-12 11:47:43 +00:00
- name: 'Checkout'
uses: actions/checkout@master
- name: Terraform fmt
id: fmt
2021-12-15 08:19:34 +00:00
run: terraform fmt
2021-11-12 11:47:43 +00:00
continue-on-error: true
2022-01-29 03:52:34 +00:00
- uses: EndBug/add-and-commit@v7
with:
message: Terraform fmt [skip ci]
committer_name: GitHub Actions
committer_email: actions@github.com
2021-11-12 11:47:43 +00:00
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Apply
id: apply
2021-11-12 11:55:33 +00:00
run: terraform apply -input=false -auto-approve
2021-11-12 11:47:43 +00:00
continue-on-error: true