Skip to content

Commit fdf8192

Browse files
committed
Set branch and main terraform build to separate jobs
1 parent 7eb854b commit fdf8192

1 file changed

Lines changed: 25 additions & 12 deletions

File tree

.github/workflows/deploy-sandbox.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,12 @@ jobs:
3434
env:
3535
SANDBOX_NAME: ${{ github.event.inputs.sandbox_name }}
3636

37-
terraform--main:
38-
runs-on: ubuntu-latest
39-
terraform_process:
37+
terraform-process--main:
4038
runs-on: ubuntu-latest
39+
needs: validate--inputs
4140
environment: development
4241

4342
steps:
44-
- name: Validate inputs
45-
run: |
46-
if ! [[ "$SANDBOX_NAME" =~ ^[a-z0-9]{1,9}$ ]]; then
47-
echo "Sandbox name must match [a-z0-9]{1,9} (lowercase letters and digits only, 1-9 chars)."
48-
exit 1
49-
fi
50-
env:
51-
SANDBOX_NAME: ${{ github.event.inputs.sandbox_name }}
52-
5343
# Checkout the repository to the GitHub Actions runner
5444
- name: Checkout main
5545
uses: actions/checkout@v5
@@ -97,6 +87,29 @@ jobs:
9787
run: terraform apply -auto-approve -input=false tf-main.plan
9888
working-directory: ./infrastructure
9989

90+
terraform-process--branch:
91+
runs-on: ubuntu-latest
92+
needs: terraform-process--main
93+
environment: development
94+
95+
steps:
96+
- name: Configure AWS Credentials
97+
uses: aws-actions/configure-aws-credentials@v5
98+
with:
99+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
100+
role-skip-session-tagging: true
101+
aws-region: ${{ vars.AWS_REGION }}
102+
mask-aws-account-id: true
103+
104+
- name: View AWS Role
105+
run: aws sts get-caller-identity
106+
107+
- name: Setup Terraform
108+
uses: hashicorp/setup-terraform@v3
109+
with:
110+
terraform_version: 1.11.4
111+
terraform_wrapper: false
112+
100113
- name: Checkout Branch
101114
if: ${{ github.event.inputs.git_ref != 'main' }}
102115
uses: actions/checkout@v5

0 commit comments

Comments
 (0)