Skip to content

Commit 2d57432

Browse files
Test changed return code
1 parent cd4d236 commit 2d57432

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ on:
4444
- none
4545
default: all
4646

47+
env:
48+
account_id: ${{ inputs.environment == 'production' && '820242920762' || '393416225559' }}
49+
4750
jobs:
4851
validate-inputs:
4952
runs-on: ubuntu-latest
@@ -94,13 +97,13 @@ jobs:
9497
- name: Configure AWS Credentials
9598
uses: aws-actions/configure-aws-credentials@v4
9699
with:
97-
role-to-assume: ${{ env.aws_role }}
100+
role-to-assume: arn:aws:iam::${{ env.account_id }}:role/GithubDeployMavisAndInfrastructure
98101
aws-region: eu-west-2
99102
- name: Compare permissions
100103
id: compare-permissions
101104
run: |
102105
source ./scripts/validate-github-actions-policy.sh
103-
validate_policies arn:aws:iam::${{ env.aws_account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
106+
validate_policies arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
104107
exit $?
105108
update-permissions:
106109
runs-on: ubuntu-latest
@@ -120,10 +123,10 @@ jobs:
120123
- name: Configure AWS Credentials
121124
uses: aws-actions/configure-aws-credentials@v4
122125
with:
123-
role-to-assume: ${{ env.aws_role }}
126+
role-to-assume: arn:aws:iam::${{ env.account_id }}:role/GithubDeployMavisAndInfrastructure
124127
aws-region: eu-west-2
125128
- name: Update IAM policy
126-
run: ./scripts/update-github-actions-policy.sh arn:aws:iam::${{ env.aws_account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
129+
run: ./scripts/update-github-actions-policy.sh arn:aws:iam::${{ env.account_id }}:policy/DeployMavisResources ./resources/github_actions_policy.json
127130
deploy-infrastructure:
128131
permissions:
129132
id-token: write

terraform/resources/github_actions_policy.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@
123123
"secretsmanager:UpdateSecret",
124124
"ssm:DeleteParameter",
125125
"ssm:DeleteParameters",
126-
"ssm:PutParameter"
126+
"ssm:PutParameter",
127+
"ssm:GetParameter"
127128
],
128129
"Resource": ["*"]
129130
}

terraform/scripts/validate-github-actions-policy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function validate_policies() {
1515
jq -S . deployed_policy.json > deployed_policy_sorted.json
1616
jq -S . "$POLICY_FILE" > github_actions_policy_sorted.json
1717

18-
POLICY_DIFF=$(diff --unified deployed_policy_sorted.json github_actions_policy_sorted.json)
18+
POLICY_DIFF=$(diff --unified deployed_policy_sorted.json github_actions_policy_sorted.json) || true
1919
if [ -n "$POLICY_DIFF" ]; then
2020
echo "Policy mismatch detected: $POLICY_DIFF"
2121
return 1

0 commit comments

Comments
 (0)