This file contains 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: create resource in aws by terraform apply | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
permissions: | |
id-token: write | |
contents: read # actions/checkout のために必要 | |
jobs: | |
get-caller-identity: | |
name: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials from test account | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: us-east-1 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.8.1 | |
- name: Terraform fmt | |
id: fmt | |
working-directory: ./terraform | |
run: terraform fmt -check | |
continue-on-error: true | |
- name: Terraform Init | |
id: init | |
working-directory: ./terraform | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
working-directory: ./terraform | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
working-directory: ./terraform | |
run: terraform plan -no-color | |
continue-on-error: true | |
- name: Terraform Apply | |
id: apply | |
working-directory: ./terraform | |
run: terraform apply -auto-approve |