Skip to content

Commit

Permalink
Move diff command to script.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelconnor00 committed Feb 29, 2024
1 parent 21f1051 commit 4c0601a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
-
name: CDK Diff
env:
CDK_DEPLOY_ACCOUNT: ${{ secrets.CDK_DEPLOY_ACCOUNT }}
CDK_DEPLOY_REGION: ${{ env.AWS_REGION }}
AWS_ACCOUNT: ${{ secrets.CDK_DEPLOY_ACCOUNT }}
AWS_REGION: ${{ env.AWS_REGION }}
run: cd iac/ && node_modules/aws-cdk/bin/cdk diff
6 changes: 2 additions & 4 deletions iac/bin/iac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const app = new cdk.App();

new IacStack(app, IacStack.stack_name, {
env: {
// region: app.node.tryGetContext("aws_region"),
// account: app.node.tryGetContext("aws_account"),
account: process.env.CDK_DEPLOY_ACCOUNT,
region: process.env.CDK_DEPLOY_REGION
region: app.node.tryGetContext("aws_region"),
account: app.node.tryGetContext("aws_account"),
}
});
19 changes: 19 additions & 0 deletions scripts/diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

pushd $(dirname $0)/../iac

if [ -z "$AWS_REGION" ]; then
echo "AWS_REGION env var is required for deployment"
exit 1
fi
if [ -z "$AWS_ACCOUNT" ]; then
echo "AWS_ACCOUNT env var is required for deployment"
exit 1
fi

cdk diff \
-c aws_region=$AWS_REGION \
-c aws_account=$AWS_ACCOUNT \
--require-approval never

0 comments on commit 4c0601a

Please sign in to comment.