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

refactor: consume dynamic env vars from SSM rather than env vars [CHI-2897] #801

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

GPaoloni
Copy link
Collaborator

@GPaoloni GPaoloni commented Dec 30, 2024

This PR completes the migrations of https://github.com/techmatters/infrastructure-config/pull/407 and techmatters/flex-plugins#2673.

Description

This PR

  • Adds a "dependency injection" logic to our auth functions (packages/twilio-worker-auth/src/twilioWorkerAuthMiddleware.ts): authTokenLookup and staticKeyLookup are required as parameters, with no "defaults" being configured.
  • Defines SSM cache helpers in HRM core that read the required parameters and caches them. This is used as the lookup functions mentioned above, by using auth_token and static_key parameters.
  • Above SSM cache is also used to lookup permissions config, by using permission_config parameter.
  • HRM and Resources services now expect to be given lookup functions that will then be used in auth. Both are being passed the same defaultAuthSecretsLookup (defined in HRM core), but should be rather trivial to pass the resources secrets once this service is isolated.

Note: all of the above is "added on top" of the environment variables. If the env vars are still provisioned via the env vars file, nothing will change, except that there's some extra "async" code around.
Once https://github.com/techmatters/infrastructure-config/pull/410 is applied, and the env vars are not provisioned from S3 anymore, the SSM reading logic will kick in.

Checklist

Verification steps

Is easier to deploy to development and test there. Configuring local environment to test this changes is time consuming. I'm happy to explain how to, if that's really desired, since I can quickly share the needed secrets.

AFTER YOU MERGE

  1. Cut a release tag using the GitHub workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

@GPaoloni GPaoloni changed the title refactor: consume dynamic env vars from SSM rather than env vars refactor: consume dynamic env vars from SSM rather than env vars [CHI-2897] Jan 15, 2025
@GPaoloni GPaoloni marked this pull request as ready for review January 15, 2025 17:03
Copy link
Collaborator

@stephenhand stephenhand left a comment

Choose a reason for hiding this comment

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

Just the naming thing. Looks good otherwise

@@ -0,0 +1,66 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we revert this back to the correct file naming convention? i.e. camel case

Copy link
Collaborator

Choose a reason for hiding this comment

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

In fact, given it's specialised nature, perhaps we could call it something like ssmConfigurationCache?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants