mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-08-07 06:29:42 +00:00
fix(deploy): pass cron secret via CFN parameter, not ssm-secure resolve
CloudFormation rejects {{resolve:ssm-secure}} inside
AWS::Scheduler::Schedule HttpInvokeArgs.HeaderParameters (documented
property-allowlist limitation). Add a NoEcho CronSharedSecret parameter
and fetch the SSM SecureString in CI, then pass via --parameter-overrides.
Lambda runtime SSM-fetch flow unchanged.
This commit is contained in:
@@ -43,17 +43,23 @@ jobs:
|
||||
- name: SAM deploy
|
||||
env:
|
||||
ALERT_EMAIL: ${{ secrets.ALERT_EMAIL }}
|
||||
STACK_ENV: prod
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# EventBridge Scheduler can't resolve {{resolve:ssm-secure}} in
|
||||
# HttpInvokeArgs.HeaderParameters; fetch and pass as a NoEcho param.
|
||||
CRON_SECRET=$(aws ssm get-parameter \
|
||||
--name "/miti99bot/${STACK_ENV}/cron-shared-secret" \
|
||||
--with-decryption --query Parameter.Value --output text)
|
||||
echo "::add-mask::$CRON_SECRET"
|
||||
OVERRIDES="CronSharedSecret=$CRON_SECRET"
|
||||
if [ -n "$ALERT_EMAIL" ]; then
|
||||
sam deploy --template-file template.yaml \
|
||||
--no-confirm-changeset \
|
||||
--no-fail-on-empty-changeset \
|
||||
--parameter-overrides "AlertEmail=$ALERT_EMAIL"
|
||||
else
|
||||
sam deploy --template-file template.yaml \
|
||||
--no-confirm-changeset \
|
||||
--no-fail-on-empty-changeset
|
||||
OVERRIDES="$OVERRIDES AlertEmail=$ALERT_EMAIL"
|
||||
fi
|
||||
sam deploy --template-file template.yaml \
|
||||
--no-confirm-changeset \
|
||||
--no-fail-on-empty-changeset \
|
||||
--parameter-overrides "$OVERRIDES"
|
||||
|
||||
- name: Smoke test (Function URL responds)
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user