-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25e7703
commit e328a4d
Showing
2 changed files
with
42 additions
and
48 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# Workflow name | ||
name: S3 Deploy | ||
on: | ||
workflow_dispatch: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,61 @@ | ||
name: Terraform Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- master | ||
paths: | ||
- 'infra/**' | ||
- .github/workflows/terraform.yaml | ||
|
||
|
||
- 'infra/**' | ||
- .github/workflows/terraform.yaml | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
jobs: | ||
plan-and-approve: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_REGION: sa-east-1 | ||
steps: | ||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: install terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: terraform init | ||
run: terraform init | ||
working-directory: infra | ||
- name: terraform plan | ||
run: terraform plan | ||
working-directory: infra | ||
|
||
|
||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: install terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: terraform init | ||
run: terraform init | ||
working-directory: infra | ||
- name: terraform plan | ||
run: terraform plan | ||
working-directory: infra | ||
execute-plan: | ||
runs-on: ubuntu-latest | ||
needs: plan-and-approve | ||
environment: production # This is required for the approval step | ||
env: | ||
AWS_REGION: sa-east-1 | ||
steps: | ||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: install terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: terraform init | ||
run: terraform init | ||
working-directory: infra | ||
- name: terraform apply | ||
run: terraform apply -auto-approve | ||
working-directory: infra | ||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: install terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
- name: checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: terraform init | ||
run: terraform init | ||
working-directory: infra | ||
- name: terraform apply | ||
run: terraform apply -auto-approve | ||
working-directory: infra | ||
|