Skip to content

Commit

Permalink
feat: create secret manager resource to store environment variables (#…
Browse files Browse the repository at this point in the history
…413)

* feat: create secret manager resource to store environment variables

* chore: rename

* feat: output new variable and allow workflow dispatch for tf apply workflow
  • Loading branch information
mohdnr authored Mar 15, 2022
1 parent 4371e52 commit 49bb48d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/merge_to_main_production.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "Merge to main (Production)"

on:
# This will be used to dispatch this workflow from the manifest repo when environment variables change
workflow_dispatch:
push:
branches:
- main
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/merge_to_main_staging.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "Merge to main (Staging)"

on:
# This will be used to dispatch this workflow from the manifest repo when environment variables change
workflow_dispatch:
push:
branches:
- main
Expand Down
6 changes: 6 additions & 0 deletions aws/common/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ output "s3_bucket_csv_upload_bucket_arn" {
output "s3_bucket_csv_upload_bucket_name" {
value = aws_s3_bucket.csv_bucket.bucket
}

output "environment_variables_current_secret_string" {
description = "Environment variables shared between EKS and Lambda"
value = data.aws_secretsmanager_secret_version.environment_variables_current.secret_string
sensitive = true
}
11 changes: 11 additions & 0 deletions aws/common/secretsmanager.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "aws_secretsmanager_secret" "environment_variables" {
name = "environment_variables"

tags = {
CostCenter = "notification-canada-ca-${var.env}"
}
}

data "aws_secretsmanager_secret_version" "environment_variables_current" {
secret_id = aws_secretsmanager_secret.environment_variables.id
}

0 comments on commit 49bb48d

Please sign in to comment.