Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4b42c69
chore: use _shared folder
chrispsheehan Jan 16, 2026
d79d9c3
chore: sqs module
chrispsheehan Jan 16, 2026
fd18e62
feat: var for reserved
chrispsheehan Jan 16, 2026
233a19d
fix: null reserved
chrispsheehan Jan 16, 2026
ac68b0b
chore: update comment
chrispsheehan Jan 16, 2026
c05312c
chore: rename var + example
chrispsheehan Jan 16, 2026
ac9a3ab
chore: use lambda alias arn
chrispsheehan Jan 16, 2026
baf35e6
fix: fmt
chrispsheehan Jan 16, 2026
3d811b7
feat: consumer sqs queue
chrispsheehan Jan 19, 2026
91a5b6f
fix: fmt
chrispsheehan Jan 19, 2026
15c8c5e
chore: add lambda trigger from sqs
chrispsheehan Jan 19, 2026
9822e7c
chore: breadcrumb sqs scale
chrispsheehan Jan 19, 2026
0e72043
chore: pass in an validate sqs vars
chrispsheehan Jan 21, 2026
1554e22
chore: enable consumer deployment
chrispsheehan Jan 21, 2026
719cb10
fix: fmt
chrispsheehan Jan 21, 2026
8c1686e
fix: add requirements.txt
chrispsheehan Jan 21, 2026
7c7eaef
fix: rename to rm dupe
chrispsheehan Jan 21, 2026
9bcda9e
fix: module output fixes
chrispsheehan Jan 21, 2026
8b51943
fix: handle sqs queue name when not sqs
chrispsheehan Jan 21, 2026
a0121e0
fix: validation
chrispsheehan Jan 21, 2026
e8b1b2f
fix: use coalesce
chrispsheehan Jan 21, 2026
2e1ff3a
fix: working iams and vars
chrispsheehan Jan 21, 2026
9807bf6
fix: local modes
chrispsheehan Jan 21, 2026
704c612
fix: fmt
chrispsheehan Jan 21, 2026
397e17b
chore: try tf v1.13.3
chrispsheehan Jan 21, 2026
fa8cb3a
chore: +sqs:*
chrispsheehan Jan 21, 2026
e16cbc4
chore: terragrunt-aws-oidc-action@0.4.1
chrispsheehan Jan 21, 2026
c4df201
fix: appspec.yml rm duped names
chrispsheehan Jan 21, 2026
03c77d8
chore: add consumer to destroy
chrispsheehan Jan 21, 2026
a2ef175
chore: lambda deploy action
chrispsheehan Jan 22, 2026
1aad36c
fix: action path
chrispsheehan Jan 22, 2026
060f758
chore: add actions/checkout@v4
chrispsheehan Jan 22, 2026
28081de
fix: use correct appspec path
chrispsheehan Jan 22, 2026
4759e57
feat: decouple infra to deploy
chrispsheehan Jan 22, 2026
0d06f86
fix: BUCKET_NAME: ${{ inputs.lambda_bucket }}
chrispsheehan Jan 22, 2026
927df77
chore: separate jobs
chrispsheehan Jan 22, 2026
87be541
fix: consumer naming
chrispsheehan Jan 22, 2026
d953da7
chore: add APP_SPEC_KEY
chrispsheehan Jan 22, 2026
acb5fc2
feat: set appsec key in infra
chrispsheehan Jan 22, 2026
76003ef
fix: add lambda_appspec_key outputs
chrispsheehan Jan 22, 2026
7702891
debug: only 1 lambda
chrispsheehan Jan 22, 2026
f947872
fix: code deploy iam
chrispsheehan Jan 22, 2026
d0013e0
chore: breadcrumb
chrispsheehan Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/actions/deploy-lambda/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Deploy Lambda with CodeDeploy
description: Deploy a Lambda using Terragrunt + CodeDeploy (publish version, traffic shift, prune)

inputs:
aws_oidc_role_arn:
description: AWS OIDC role to assume
required: true

infra_version:
description: Git ref containing Terraform/Terragrunt config
required: true

tg_directory:
description: Terragrunt directory for this lambda
required: true

lambda_bucket:
description: "Bucket containing lambda zips"
required: true

lambda_version:
description: Lambda artifact version (S3 prefix)
required: true

lambda_keep:
description: Number of lambda versions to keep
required: true

runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.infra_version }}

- name: Get Terragrunt outputs
id: init
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
tg_directory: ${{ inputs.tg_directory }}
tg_action: init

- name: Extract Terragrunt outputs
id: vars
shell: bash
env:
TG_OUTPUTS: ${{ steps.init.outputs.tg_outputs }}
run: |
echo "lambda_function_name=$(echo $TG_OUTPUTS | jq -r '.lambda_function_name.value')" >> $GITHUB_OUTPUT
echo "lambda_alias_name=$(echo $TG_OUTPUTS | jq -r '.lambda_alias_name.value')" >> $GITHUB_OUTPUT
echo "code_deploy_app_name=$(echo $TG_OUTPUTS | jq -r '.code_deploy_app_name.value')" >> $GITHUB_OUTPUT
echo "code_deploy_group_name=$(echo $TG_OUTPUTS | jq -r '.code_deploy_group_name.value')" >> $GITHUB_OUTPUT

- name: Set AppSpec paths
id: appspec
shell: bash
run: |
lambda_zip_key="${{ inputs.lambda_version }}/${{ steps.vars.outputs.lambda_function_name }}.zip"
echo "lambda_appspec_key=$(echo $TG_OUTPUTS | jq -r '.lambda_zip_key.value')" >> $GITHUB_OUTPUT
echo "lambda_appspec_zip=$(echo $TG_OUTPUTS | jq -r '.lambda_function_name.value')" >> $GITHUB_OUTPUT

- name: Get current lambda version
id: get-version
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
FUNCTION_NAME: ${{ steps.vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.vars.outputs.lambda_alias_name }}
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
just_action: lambda-get-version

- name: Publish new lambda version
id: publish
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
BUCKET_NAME: ${{ inputs.lambda_bucket }}
FUNCTION_NAME: ${{ steps.vars.outputs.lambda_function_name }}
LAMBDA_ZIP_KEY: ${{ steps.vars.outputs.lambda_zip_key }}
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
just_action: lambda-create-version

- name: Upload AppSpec bundle
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
BUCKET_NAME: ${{ inputs.lambda_bucket }}
FUNCTION_NAME: ${{ steps.vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.vars.outputs.lambda_alias_name }}
CURRENT_VERSION: ${{ steps.get-version.outputs.just_outputs }}
NEW_VERSION: ${{ steps.publish.outputs.just_outputs }}
APP_SPEC_FILE: ${{ github.workspace }}/appspec.yml
APP_SPEC_KEY: ${{ steps.vars.outputs.lambda_appspec_key }}
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
just_action: lambda-upload-bundle

- name: Run CodeDeploy
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
BUCKET_NAME: ${{ inputs.lambda_bucket }}
CODE_DEPLOY_APP_NAME: ${{ steps.vars.outputs.code_deploy_app_name }}
CODE_DEPLOY_GROUP_NAME: ${{ steps.vars.outputs.code_deploy_group_name }}
APP_SPEC_KEY: ${{ steps.vars.outputs.lambda_appspec_key }}
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
just_action: lambda-deploy

- name: Prune old lambda versions
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
KEEP: ${{ inputs.lambda_keep }}
FUNCTION_NAME: ${{ steps.vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.vars.outputs.lambda_alias_name }}
with:
aws_oidc_role_arn: ${{ inputs.aws_oidc_role_arn }}
just_action: lambda-prune
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
ref: ${{ inputs.version }}

- name: Deploy code buckets
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
id: code_action
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
Expand Down
110 changes: 48 additions & 62 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ permissions:
env:
TF_VAR_lambda_version: ${{ inputs.lambda_version }}
AWS_OIDC_ROLE_ARN: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/aws-serverless-github-deploy-${{ inputs.environment }}-github-oidc-role
BUCKET_NAME: ${{ inputs.lambda_bucket }}

jobs:
setup:
Expand All @@ -44,94 +43,81 @@ jobs:
with:
ref: ${{ inputs.infra_version }}

- uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
- uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
tg_directory: infra/live/${{ inputs.environment }}/aws/oidc

- name: check Lambda version
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
BUCKET_NAME: ${{ inputs.lambda_bucket }}
VERSION: ${{ inputs.lambda_version }}
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: check-version

api:
api-infra:
needs: setup
runs-on: ubuntu-latest
env:
APP_SPEC_FILE: ${{ github.workspace }}/appspec.yml
APP_SPEC_KEY: ${{ inputs.lambda_version }}/appspec.zip
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.infra_version }}

- name: deploy api
id: deploy-api
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
- name: Deploy api infra
id: deploy
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
tg_directory: infra/live/${{ inputs.environment }}/aws/api

- name: get api variables
id: get-api-vars
env:
TG_OUTPUTS: ${{ steps.deploy-api.outputs.tg_outputs }}
run: |
echo "lambda_zip_key=$(echo $TG_OUTPUTS | jq -r '.lambda_zip_key.value')" >> $GITHUB_OUTPUT
echo "lambda_function_name=$(echo $TG_OUTPUTS | jq -r '.lambda_function_name.value')" >> $GITHUB_OUTPUT
echo "lambda_alias_name=$(echo $TG_OUTPUTS | jq -r '.lambda_alias_name.value')" >> $GITHUB_OUTPUT
echo "code_deploy_app_name=$(echo $TG_OUTPUTS | jq -r '.code_deploy_app_name.value')" >> $GITHUB_OUTPUT
echo "code_deploy_group_name=$(echo $TG_OUTPUTS | jq -r '.code_deploy_group_name.value')" >> $GITHUB_OUTPUT

- name: get lambda version
id: lambda-get-version
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
FUNCTION_NAME: ${{ steps.get-api-vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.get-api-vars.outputs.lambda_alias_name }}
api:
needs: api-infra
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: lambda-get-version
ref: ${{ inputs.infra_version }}

- name: create lambda version
id: lambda-create-version
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
LAMBDA_ZIP_KEY: ${{ steps.get-api-vars.outputs.lambda_zip_key }}
FUNCTION_NAME: ${{ steps.get-api-vars.outputs.lambda_function_name }}
- uses: ./.github/actions/deploy-lambda
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: lambda-create-version
infra_version: ${{ inputs.infra_version }}
tg_directory: infra/live/${{ inputs.environment }}/aws/api
lambda_bucket: ${{ inputs.lambda_bucket }}
lambda_version: ${{ inputs.lambda_version }}
lambda_keep: ${{ inputs.lambda_keep }}

- name: Prepare and upload AppSpec File to s3
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
FUNCTION_NAME: ${{ steps.get-api-vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.get-api-vars.outputs.lambda_alias_name }}
CURRENT_VERSION: ${{ steps.lambda-get-version.outputs.just_outputs }}
NEW_VERSION: ${{ steps.lambda-create-version.outputs.just_outputs }}
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: lambda-upload-bundle
# consumer-infra:
# needs: setup
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ inputs.infra_version }}

- name: deploy lambda
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
CODE_DEPLOY_APP_NAME: ${{ steps.get-api-vars.outputs.code_deploy_app_name }}
CODE_DEPLOY_GROUP_NAME: ${{ steps.get-api-vars.outputs.code_deploy_group_name }}
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: lambda-deploy
# - name: Deploy consumer infra
# id: deploy
# uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
# with:
# aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
# tg_directory: infra/live/${{ inputs.environment }}/aws/consumer

# consumer:
# needs: consumer-infra
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ inputs.infra_version }}

# - uses: ./.github/actions/deploy-lambda
# with:
# aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
# infra_version: ${{ inputs.infra_version }}
# tg_directory: infra/live/${{ inputs.environment }}/aws/consumer
# lambda_bucket: ${{ inputs.lambda_bucket }}
# lambda_version: ${{ inputs.lambda_version }}
# lambda_keep: ${{ inputs.lambda_keep }}

- name: prune lambda
uses: chrispsheehan/just-aws-oidc-action@0.1.3
env:
KEEP: ${{ inputs.lambda_keep }}
FUNCTION_NAME: ${{ steps.get-api-vars.outputs.lambda_function_name }}
ALIAS_NAME: ${{ steps.get-api-vars.outputs.lambda_alias_name }}
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
just_action: lambda-prune
17 changes: 15 additions & 2 deletions .github/workflows/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,34 @@ jobs:
- uses: actions/checkout@v4

- name: Destroy backend
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
tg_directory: infra/live/${{ inputs.environment }}/aws/api
tg_action: destroy

consumer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Destroy backend
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
tg_directory: infra/live/${{ inputs.environment }}/aws/consumer
tg_action: destroy

build:
needs:
- api
- consumer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Destroy code
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
tg_directory: infra/live/${{ inputs.environment }}/aws/code_bucket
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,20 @@ jobs:
environment: dev
version: ${{ github.sha }}

lambdas:
needs: build
uses: ./.github/workflows/infra_deploy.yml
with:
environment: dev
infra_version: ${{ github.sha }}
lambda_bucket: ${{ needs.build.outputs.lambda_bucket }}
lambda_version: ${{ github.sha }}

dev:
uses: ./.github/workflows/deploy.yml
needs: build
needs:
- build
- lambdas
with:
environment: dev
infra_version: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
ref: ${{ inputs.version }}

- name: Get code bucket outputs
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.0
uses: chrispsheehan/terragrunt-aws-oidc-action@0.4.1
id: code_action
with:
aws_oidc_role_arn: ${{ env.AWS_OIDC_ROLE_ARN }}
Expand Down
Loading