Skip to content

Commit 9a0f291

Browse files
committed
refactor: optimize the pipeline code
1 parent 2156679 commit 9a0f291

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

.github/workflows/terraform-dev.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches:
66
- develop
77

8+
env:
9+
AWS_REGION: "sa-east-1"
10+
TERRAFORM_DYNAMODB_LOCK_TABLE: "buildrun-terraform-state-lock"
11+
TERRAFORM_S3_STATEFILE_BUCKET: "buildrun-sa-east-1-terraform-s3-statefile"
12+
813
permissions:
914
id-token: write
1015
contents: read
@@ -31,7 +36,7 @@ jobs:
3136
with:
3237
role-to-assume: arn:aws:iam::179916804929:role/BuildRun-GithubActions-Role
3338
role-session-name: GitHub_to_AWS_via_FederatedOIDC
34-
aws-region: ${{ vars.AWS_REGION }}
39+
aws-region: ${{ env.AWS_REGION }}
3540

3641
- name: Read destroy configuration
3742
id: read-destroy-config
@@ -42,10 +47,10 @@ jobs:
4247
- name: Terraform Init
4348
run: |
4449
cd infra && terraform init \
45-
-backend-config="bucket=${{ vars.TERRAFORM_S3_STATEFILE_BUCKET }}" \
50+
-backend-config="bucket=${{ env.TERRAFORM_S3_STATEFILE_BUCKET }}" \
4651
-backend-config="key=${{ github.event.repository.name }}" \
4752
-backend-config="region=${{ env.AWS_REGION }}" \
48-
-backend-config="dynamodb_table=${{ vars.TERRAFORM_DYNAMODB_LOCK_TABLE }}"
53+
-backend-config="dynamodb_table=${{ env.TERRAFORM_DYNAMODB_LOCK_TABLE }}"
4954
5055
- name: Terraform Validate
5156
run: terraform validate

infra/backend.tf

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
terraform {
2-
backend "s3" {
3-
# bucket = "buildrun-sa-east-1-terraform-s3-statefile"
4-
# dynamodb_table = "buildrun-terraform-state-lock"
5-
# key = "buildrun-infra-terraform-pipeline"
6-
# region = "sa-east-1"
7-
# profile = "terraform"
8-
# shared_credentials_file = "~/.aws/credentials"
9-
}
2+
backend "s3" {}
103
}

infra/destroy_config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"dev": true,
3-
"prod": true
2+
"dev": false,
3+
"prod": false
44
}

0 commit comments

Comments
 (0)