Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EREGCSC-2894 Update CDK bootstrap for latest version #1488

Merged
merged 16 commits into from
Dec 16, 2024

Conversation

cgodwin1
Copy link
Contributor

@cgodwin1 cgodwin1 commented Nov 19, 2024

Resolves #2894

Description-

In order for our CDK scripts to reliably deploy/create AWS resources, we need to keep our CDK stacks up to date. Sometimes AWS releases updates, and we have to apply them, and it's happened already!

We decided we wanted to do this automatically via cron'd Github Action, but found it wasn't possible to do this using standard bootstrap procedure because we are relying on a CMS-specific template.yaml. By diffing the CMS template.yaml with the default one from CDK, we found it was feasible to create a script (update_template.py) that attempts to automatically apply those needed changes to the default template.

From there, we can automate the bootstrap update procedure.

This pull request changes...

  • New Github Action, update-cdk-bootstrap.yml, that runs weekly on Monday and runs the commands needed to execute a CDK bootstrap update.
  • New script, update_template.py, which takes as CLI arguments a JSON file containing a list of roles to update, the default CDK template to process, and an output filename.
    • JSON file and optional arguments allow customization, see ./update_template.py -h for more info.
  • Github Action downloads the default CDK template, runs update_template.py to generate a usable one, and then performs the bootstrap on an empty "temp" project directory.
  • Because prod (and currently val) have protection rules, only the dev (and eventually val) bootstrap updates will run automatically. This means a dev will need to approve bootstrap updates for prod, which while still requiring user action, is probably the appropriate thing to do anyway. We can work around this later if we want, using a set of custom environments specific to this action.

Steps to manually verify this change...

You can't directly verify this without merging to prod, because this action runs on a schedule (see the cron section of the action file). Instead, check out this test run. You can go to each environment's run and see that with the updated template.yaml file that the script generates, the bootstrapping process completed successfully for dev, val, and prod.

Copy link

✨ See the Django Site in action

Copy link

✨ See the Django Site in action

@cgodwin1 cgodwin1 added the Needs Review This PR needs a code review label Nov 25, 2024
@cgodwin1 cgodwin1 marked this pull request as ready for review November 25, 2024 22:34
@cgodwin1 cgodwin1 requested a review from PhilR8 as a code owner November 25, 2024 22:34
Copy link

✨ See the Django Site in action

* add README.md
* add requirements.txt due to PyYAML dependency
* make role-to-assume a required positional argument
Copy link

✨ See the Django Site in action

Copy link
Contributor

@PhilR8 PhilR8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@PhilR8 PhilR8 added Approved and removed Needs Review This PR needs a code review labels Dec 12, 2024
@cgodwin1 cgodwin1 merged commit e0b07d4 into main Dec 16, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants