Skip to content

Commit f8bbede

Browse files
committed
Update tofu plan job.
1 parent a2bc87a commit f8bbede

File tree

1 file changed

+20
-38
lines changed

1 file changed

+20
-38
lines changed

.github/workflows/plan.yml

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,36 @@ name: Tofu Plan
44

55
on:
66
workflow_dispatch:
7-
8-
env:
9-
AWS_REGION: us-east-1
10-
ECR_APP_REPOSITORY: asap-pdf-production-app
11-
ECR_DOCUMENT_INFERENCE_REPOSITORY: asap-pdf-lambda-document-inference-production
12-
ECS_CLUSTER: asap-pdf-production-app
13-
ECS_SERVICE: asap-pdf-production-app
14-
ECS_TASK_DEFINITION: .aws/task-definition.json
15-
AWS_ACCOUNT_ID: 073165201938
7+
inputs:
8+
environment:
9+
type: choice
10+
description: Environment
11+
required: true
12+
options:
13+
- staging
14+
- prod
1615

1716
permissions:
1817
contents: read
1918
id-token: write
2019

2120
jobs:
2221
plan:
23-
name: Plan
2422
runs-on: ubuntu-latest
25-
environment: production
26-
23+
environment:
24+
name: ${{ github.event.inputs.environment }}"
2725
steps:
26+
- name: Deploy to environment
27+
run: echo "Deploying to ${{ needs.determine_environment.outputs.env_name }}"
28+
2829
- name: Checkout
2930
uses: actions/checkout@v5
3031

31-
- name: Debug OIDC claims
32-
run: |
33-
echo "GitHub repository: ${{ github.repository }}"
34-
echo "GitHub ref: ${{ github.ref }}"
35-
echo "GitHub SHA: ${{ github.sha }}"
36-
echo "Actor: ${{ github.actor }}"
37-
echo "Event name: ${{ github.event_name }}"
38-
echo "Workflow ref: ${{ github.workflow_ref }}"
39-
echo "Environment: ${{ github.environment }}"
40-
echo "Job: ${{ github.job }}"
41-
42-
- name: Debug AWS role
43-
run: |
44-
echo "Attempting to assume role with:"
45-
echo "Repository: repo:${{ github.repository }}:*"
46-
echo "Repository ref: repo:${{ github.repository }}:ref:${{ github.ref }}"
47-
4832
- name: Configure AWS credentials
4933
uses: aws-actions/configure-aws-credentials@v4
5034
with:
51-
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
52-
aws-region: ${{ env.AWS_REGION }}
35+
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
36+
aws-region: ${{ vars.AWS_REGION }}
5337
audience: "sts.amazonaws.com"
5438
role-session-name: "GitHubActions-${{ github.run_id }}"
5539
mask-aws-account-id: false
@@ -63,21 +47,19 @@ jobs:
6347
uses: opentofu/setup-opentofu@v1
6448

6549
- name: Initialize OpenTofu
66-
working-directory: ./terraform
50+
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
6751
run: tofu init
6852

6953
- name: Get OpenTofu version
70-
working-directory: ./terraform
54+
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
7155
run: tofu --version
7256

7357
- name: List out state
74-
working-directory: ./terraform
58+
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
7559
run: tofu state list
7660

77-
- name: Run tofu plan
78-
id: plan
79-
timeout-minutes: 5
80-
working-directory: ./terraform
61+
- name: Apply tofu plan
62+
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
8163
run: tofu plan -input=false
8264

8365
- name: Output stderr

0 commit comments

Comments
 (0)