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

Configure app env vars and secrets #549

Merged
merged 8 commits into from
Feb 8, 2024
Merged

Configure app env vars and secrets #549

merged 8 commits into from
Feb 8, 2024

Conversation

lorenyu
Copy link
Contributor

@lorenyu lorenyu commented Feb 6, 2024

Ticket

Resolves #535 and #310

Changes

Add functionality for applications to:

  • Define application specific environment variables
  • Override values for these environment variables per application environment
  • Access secrets in SSM parameter store that get injected to the container as environment variables

Context for reviewers

This adds the ability for applications to define custom env vars and secrets

Deploying

platform-test-flask needs some manual changes since currently there are custom changes to infra/app/service/main.tf to define the API key

Testing

Developed and tested in platform-test in this PR navapbc/platform-test#85

@lorenyu lorenyu marked this pull request as draft February 7, 2024 04:07
@lorenyu
Copy link
Contributor Author

lorenyu commented Feb 7, 2024

Can safely ignore the anchore scan failure. That's due to the example app. I haven't figured out how to ignore the vuln checks only on the template and not when they copy the workflow to the project.

@lorenyu lorenyu marked this pull request as ready for review February 7, 2024 20:37
Copy link
Contributor

@coilysiren coilysiren left a comment

Choose a reason for hiding this comment

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

Yay thanks for this!

I'm not sure if we want to back fill this pattern into grants, but I'm sure future projects would love to use it 🙏🏽

@coilysiren
Copy link
Contributor

Update, I have backfilled this into grants ^_^

HHS/simpler-grants-gov#1516

coilysiren added a commit to HHS/simpler-grants-gov that referenced this pull request Mar 22, 2024
…ts (#1516)

## Summary

Relates to #784

Closes #1519

Copies navapbc/template-infra#549

### Time to review: __10 mins__

## Changes proposed

- cherry picks platform infra template's pattern for passing in env vars
and AWS SSM secrets
- changes `ENABLE_V_0_1_ENDPOINTS` / `enable_v01_endpoints` to use the
above pattern
- _**does not yet**_ change any of our SSM secrets to use platform's
pattern, I plan to do that in a follow-up PR

## Context for reviewers

I created this PR via tactical copy-pasting from the
https://github.com/navapbc/template-infra/ repo.

The goal of this PR is to DRY our methods for setting environment
variables. Notice on the red side of the diff, how I've removed the need
to set `enable_v01_endpoints` so many times. Then notice on the green
side of the diff, that I only need to set `ENABLE_V_0_1_ENDPOINTS` twice
(for dev and staging). That's the goal of this PR, to pull in platform's
very nice pattern for DRY'ing environment variables.

## Testing

To test this, I added - then removed - the following block from
`staging.tf`

```hcl
  service_override_extra_environment_variables = {
    ENABLE_V_0_1_ENDPOINTS = "true"
  }
```

I then deployed to staging to see the difference. It worked as intended.
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.

Add ability for apps to fetch secure strings from SSM
2 participants