Skip to content

Commit 95e0fc8

Browse files
committed
Config names do match input directly.
1 parent a1722d2 commit 95e0fc8

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

.github/workflows/plan.yml

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,13 @@ permissions:
1818
id-token: write
1919

2020
jobs:
21-
determine_environment:
22-
runs-on: ubuntu-latest
23-
outputs:
24-
env_name: ${{ steps.set_env.outputs.environment_name }}
25-
ssm_param: ${{ steps.set_env.outputs.ssm_parameter }}
26-
steps:
27-
- name: Set environment name
28-
id: set_env
29-
run: |
30-
# Set environment based on branch or workflow_dispatch selection.
31-
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32-
env_name="${{ github.event.inputs.environment }}"
33-
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
34-
env_name="prod"
35-
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
36-
env_name="staging"
37-
else
38-
echo "Unsupported branch for deployment: ${{ github.ref }}"
39-
exit 1
40-
fi
41-
echo "environment_name=$env_name" >> "$GITHUB_OUTPUT"
42-
4321
plan:
44-
needs: [ determine_environment ]
4522
runs-on: ubuntu-latest
4623
environment:
47-
name: ${{ needs.determine_environment.outputs.env_name }}
24+
name: ${{ github.event.inputs.environment }}
4825
steps:
4926
- name: Config Directory
50-
run: echo "Tofu config directory ./terraform/config/${{ needs.determine_environment.outputs.env_name }}"
27+
run: echo "Tofu config directory ./terraform/config/${{ github.event.inputs.environment }}"
5128

5229
- name: Checkout
5330
uses: actions/checkout@v5
@@ -70,15 +47,15 @@ jobs:
7047
uses: opentofu/setup-opentofu@v1
7148

7249
- name: Initialize OpenTofu
73-
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
50+
working-directory: ./terraform/config/${{ github.event.inputs.environment }}
7451
run: tofu init
7552

7653
- name: Get OpenTofu version
77-
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
54+
working-directory: ./terraform/config/${{ github.event.inputs.environment }}
7855
run: tofu --version
7956

8057
- name: Apply tofu plan
81-
working-directory: ./terraform/config/${{ needs.determine_environment.outputs.env_name }}
58+
working-directory: ./terraform/config/${{ github.event.inputs.environment }}
8259
run: tofu plan -input=false
8360

8461
- name: Output stderr

0 commit comments

Comments
 (0)