Created
September 5, 2021 09:23
-
-
Save roylines/9047128048a87ea5dfba21ef0e6563ba to your computer and use it in GitHub Desktop.
github action: terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: terraform | |
on: | |
push: | |
paths: | |
- 'terraform/**' | |
- '.github/workflows/terraform.yml' | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
defaults: | |
run: | |
working-directory: terraform | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.0.6 | |
- run: terraform version | |
- run: terraform init | |
- run: terraform plan -out=plan.out | |
- if: github.ref == 'refs/heads/main' | |
run: terraform apply -auto-approve plan.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment