cds-snc / notification-planning-core

Project planning for GC Notify Core Team
0 stars 0 forks source link

Terragrunt to read account IDs & co. from the tfvars file #410

Open P0NDER0SA opened 2 months ago

P0NDER0SA commented 2 months ago

Description

As a Developer, I need to be able to use Terraform variables in code such as the AWS account ID, so that I can achieve secure and maintainable code.

WHY are we building?

Code security and maintainability.

WHAT are we building?

VALUE created by our solution

Secure and consistent/debuggable code.

QA Steps

Acceptance Criteria

P0NDER0SA commented 2 months ago

Identified a list of all of the AWS account ids we have in our Terraform code. Investigated the best way to set up variables for them -- decided that we should focus on the CDS internal ids (as many of the other external ones are public anyways).

In order to use TFVars variables for these we really need to adjust our code to allow Terragrunt to use our TFVars file (which is scoped to Terraform for some silly reason).

Discovered a newer function that could help us do just that-- need to compare this with Bens other env enhancements and decide how to proceed. Also if we use this, we will have to update our actions to use a newer version of the Terragrunt Actions.

P0NDER0SA commented 2 months ago

https://github.com/cds-snc/notification-terraform/pull/1498

P0NDER0SA commented 2 months ago

Started on the implementation of the read_tfvars_function for dev and reviewing Bens amalgamated tfvars file for dev

P0NDER0SA commented 2 months ago

I have a working model for this on Dev, but i need to get it workign on Staging before I can merge it.

P0NDER0SA commented 2 months ago

Blocked by an issue with GHA that i can't reproduce locally. Will bug Ben when he's available. Updated the code to use variables (on dev and staging and sandbox environments).

Need to fix the plans for Staging before devising a way to keep production working as it does until i can get staging 100%.

https://github.com/cds-snc/notification-terraform/pull/1516

P0NDER0SA commented 2 months ago

Ben and I want to debug this more and find out why the planning is failing without any errors/warnings today

ben851 commented 2 months ago

For dev TF Plan github action, I just switched the role to notification-terraform-apply so that the DNS management works.

P0NDER0SA commented 2 months ago

amalgamated all configuraable values in staging into our tfvars file (this was a big job!) and created all variable declarations in our top level Terragrunt hcl file. Currently working on removing redundant variable declarations in downstream variable files for staging. We very much underestimated this one!

P0NDER0SA commented 2 months ago

all variables have been pulled together for dev and staging and are in 1pass tfvars files. they are extensive. Plans are working against dev and staging -- we need to verify the plans to make sure they aren't doing anythign dangerous (the new sensitive values are causing it to show a good many "changes" that might not really be changes). Making very good progresss.

sastels commented 1 month ago

Working through applies and debugging. Some issues arose on dev (VPN randomly breaking).

sastels commented 1 month ago

Notes don't seem to be versioned in 1Password - should investigating.

Update: It's versioned but you need to go through web portal to get to the history. Pond will add this to Tips and Tricks

sastels commented 1 month ago

VPN working again on dev :tada: Next:

sastels commented 1 month ago

Gonna look at the prod plan first.

jimleroyer commented 1 month ago

We got dev and staging ready to go with the changes for this PR. We'll wait on Pond before resuming on that task. Pond was working on the production workflows last week.

jimleroyer commented 1 month ago

Today

P0NDER0SA commented 1 month ago

new PR has been created with minimal commits! https://github.com/cds-snc/notification-terraform/pull/1562

jimleroyer commented 1 month ago
P0NDER0SA commented 1 month ago

Merged! It's deployed on staging.

One small issue with Heartbeat - just an out of date config value for the API key. Fixed!

We will re-create a new api key for production before we release to nip this in the bud.

TFVars for prod have been reviewed. One more pass on this today and a Plan against production before release!

P0NDER0SA commented 1 month ago

released to production this morning! Looks good so far :)

We might look at making some small changes to move "configurations" back to the code base for traceability and leaving the secrets in 1pass. They will still be fairly centralized and easy to track

P0NDER0SA commented 1 month ago

Looking good in Production!

sastels commented 1 month ago

Steve will fix account ids in:

sastels commented 1 month ago

PR to Move out a couple account ids

sastels commented 1 month ago

I'll do another check today to double check that we got everything.

sastels commented 1 month ago

dang it, I missed one. PR here

sastels commented 1 month ago

All good now!