-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from g-lorena/feat/CI_CD
Feat/ci cd
- Loading branch information
Showing
3 changed files
with
59 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "Terraform destroy" | ||
on: | ||
push: | ||
branches: | ||
- feat*/* | ||
workflow_dispatch: | ||
permissions: | ||
id-token: write # This is required for aws oidc connection | ||
contents: read # This is required for actions/checkout | ||
pull-requests: write # This is required for gh bot to comment PR | ||
env: | ||
TF_LOG: INFO | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: . | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials from AWS account | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-session-name: GitHub-OIDC-TERRAFORM | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: 1.7.5 | ||
|
||
- name: Terraform fmt | ||
id: fmt | ||
run: terraform fmt -check | ||
continue-on-error: true | ||
|
||
- name: Terraform Init | ||
id: init | ||
env: | ||
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }} | ||
AWS_BUCKET_KEY_NAME: ${{ secrets.AWS_BUCKET_KEY_NAME }} | ||
run: make terraform-init | ||
|
||
- name: Terraform Destroy | ||
id: destroy | ||
run: make terraform-destroy | ||
|
||
|
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,8 +1,4 @@ | ||
terraform { | ||
backend "s3" {} | ||
} | ||
/* | ||
|
||
provider "aws" { | ||
region = "eu-west-3" | ||
} | ||
*/ |
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