-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix - Emails only being sent to forms-formulaires@cds-snc.ca for Staging and Production #159
Conversation
⚠ Terrform update availableTerraform: 1.1.2 (using 1.0.10)
Terragrunt: 0.35.16 (using 0.35.6) |
Version diff |
Staging: app✅ Terraform Format: Plan: 2 to add, 1 to change, 2 to destroy Show planResource actions are indicated with the following symbols:
~ update in-place
-/+ destroy and then create replacement
Terraform will perform the following actions:
# aws_lambda_function.reliability will be updated in-place
~ resource "aws_lambda_function" "reliability" {
id = "Reliability"
~ layers = [
- "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_lib_packages:58",
- "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_node_packages:66",
] -> (known after apply)
tags = {
"CostCentre" = "forms-platform-staging"
"Terraform" = "true"
}
# (25 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_lambda_layer_version.reliability_lib must be replaced
-/+ resource "aws_lambda_layer_version" "reliability_lib" {
~ arn = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_lib_packages:58" -> (known after apply)
- compatible_architectures = [] -> null
~ created_date = "2021-12-02T20:00:32.730+0000" -> (known after apply)
~ id = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_lib_packages:58" -> (known after apply)
~ layer_arn = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_lib_packages" -> (known after apply)
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
~ source_code_hash = "WlVrmSYbhAS5Wy2hQ/TMtx9iRJTJiGmSuHnXfa6+ZTw=" -> "ku4dhZMcNr/hiGkN9ukcoHOSXP9xWu3LcX4y8grJBHc=" # forces replacement
~ source_code_size = 5659 -> (known after apply)
~ version = "58" -> (known after apply)
# (3 unchanged attributes hidden)
}
# aws_lambda_layer_version.reliability_nodejs must be replaced
-/+ resource "aws_lambda_layer_version" "reliability_nodejs" {
~ arn = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_node_packages:66" -> (known after apply)
- compatible_architectures = [] -> null
~ created_date = "2021-12-02T20:00:29.184+0000" -> (known after apply)
~ id = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_node_packages:66" -> (known after apply)
~ layer_arn = "arn:aws:lambda:ca-central-1:687401027353:layer:reliability_node_packages" -> (known after apply)
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
~ source_code_hash = "xoWozM5ekgveFb0bKe+thVxzETYMZjbJybt2ONIXhFo=" -> "CsMWtRhZ9tALeLaggMg+kHGWGEQIwwcPav5p+i5rGos=" # forces replacement
~ source_code_size = 4813591 -> (known after apply)
~ version = "66" -> (known after apply)
# (3 unchanged attributes hidden)
}
Plan: 2 to add, 1 to change, 2 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest results9 tests, 9 passed, 0 warnings, 0 failures, 0 exceptions
|
Production: sns✅ Terraform Format: Plan: 0 to add, 1 to change, 0 to destroy Show planResource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_sns_topic.alert_critical will be updated in-place
~ resource "aws_sns_topic" "alert_critical" {
id = "arn:aws:sns:ca-central-1:957818836222:alert-critical"
name = "alert-critical"
~ tags = {
~ "CostCentre" = "Forms" -> "forms-platform-production"
+ "Terraform" = "true"
}
~ tags_all = {
~ "CostCentre" = "Forms" -> "forms-platform-production"
+ "Terraform" = "true"
}
# (6 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Changes to Outputs:
+ sns_topic_alert_ok_us_east_arn = "arn:aws:sns:us-east-1:957818836222:alert-ok"
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest results9 tests, 9 passed, 0 warnings, 0 failures, 0 exceptions
|
Production: dynamodb✅ Terraform Format: Plan: 0 to add, 1 to change, 0 to destroy Show planResource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_dynamodb_table.vault will be updated in-place
~ resource "aws_dynamodb_table" "vault" {
id = "Vault"
name = "Vault"
tags = {
"CostCentre" = "forms-platform-production"
"Terraform" = "true"
}
# (8 unchanged attributes hidden)
+ attribute {
+ name = "Retrieved"
+ type = "N"
}
+ global_secondary_index {
+ hash_key = "Retrieved"
+ name = "retrieved-index"
+ non_key_attributes = []
+ projection_type = "ALL"
}
# (5 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest results9 tests, 9 passed, 0 warnings, 0 failures, 0 exceptions
|
Production: app✅ Terraform Format: Plan: 3 to add, 1 to change, 0 to destroy Show planResource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
# aws_iam_policy.forms_dynamodb will be updated in-place
~ resource "aws_iam_policy" "forms_dynamodb" {
id = "arn:aws:iam::957818836222:policy/forms_dynamodb"
name = "forms_dynamodb"
~ policy = jsonencode(
~ {
~ Statement = [
~ {
~ Action = [
# (3 unchanged elements hidden)
"dynamodb:PutItem",
+ "dynamodb:PartiQLUpdate",
+ "dynamodb:PartiQLSelect",
+ "dynamodb:PartiQLInsert",
+ "dynamodb:PartiQLDelete",
"dynamodb:GetItem",
# (2 unchanged elements hidden)
]
# (3 unchanged elements hidden)
},
]
# (1 unchanged element hidden)
}
)
tags = {
"CostCentre" = "forms-platform-production"
"Terraform" = "true"
}
# (5 unchanged attributes hidden)
}
# aws_iam_policy.forms_kms will be created
+ resource "aws_iam_policy" "forms_kms" {
+ arn = (known after apply)
+ description = "IAM policy for storing encrypting and decrypting data"
+ id = (known after apply)
+ name = "ecs_kms"
+ path = "/"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "kms:GenerateDataKey",
+ "kms:Encrypt",
+ "kms:Decrypt",
]
+ Effect = "Allow"
+ Resource = "arn:aws:kms:ca-central-1:957818836222:key/afbaea67-8277-4a4c-853e-7697dd2dade5"
+ Sid = ""
},
]
+ Version = "2012-10-17"
}
)
+ policy_id = (known after apply)
+ tags = {
+ "CostCentre" = "forms-platform-production"
+ "Terraform" = "true"
}
+ tags_all = {
+ "CostCentre" = "forms-platform-production"
+ "Terraform" = "true"
}
}
# aws_iam_role_policy_attachment.dynamodb_forms will be created
+ resource "aws_iam_role_policy_attachment" "dynamodb_forms" {
+ id = (known after apply)
+ policy_arn = "arn:aws:iam::957818836222:policy/forms_dynamodb"
+ role = "form-viewer"
}
# aws_iam_role_policy_attachment.kms_forms will be created
+ resource "aws_iam_role_policy_attachment" "kms_forms" {
+ id = (known after apply)
+ policy_arn = (known after apply)
+ role = "form-viewer"
}
Plan: 3 to add, 1 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest results9 tests, 9 passed, 0 warnings, 0 failures, 0 exceptions
|
Production: alarms✅ Terraform Format: Plan: 3 to add, 3 to change, 3 to destroy Show planResource actions are indicated with the following symbols:
~ update in-place
-/+ destroy and then create replacement
Terraform will perform the following actions:
# aws_cloudwatch_metric_alarm.route53_ddos will be updated in-place
~ resource "aws_cloudwatch_metric_alarm" "route53_ddos" {
id = "Route53DDoS"
~ ok_actions = [
+ "",
- "arn:aws:sns:us-east-1:957818836222:alert-ok",
]
tags = {}
# (17 unchanged attributes hidden)
}
# aws_lambda_permission.notify_slack_critical must be replaced
-/+ resource "aws_lambda_permission" "notify_slack_critical" {
~ function_name = "arn:aws:lambda:ca-central-1:957818836222:function:NotifySlackSNS" -> "NotifySlackSNS" # forces replacement
~ id = "AllowExecutionFromSNSCriticalAlert" -> (known after apply)
# (4 unchanged attributes hidden)
}
# aws_lambda_permission.notify_slack_ok_us_east must be replaced
-/+ resource "aws_lambda_permission" "notify_slack_ok_us_east" {
~ id = "AllowExecutionFromSNSOkAlertUSEast" -> (known after apply)
- source_arn = "arn:aws:sns:us-east-1:957818836222:alert-ok" -> null # forces replacement
# (4 unchanged attributes hidden)
}
# aws_sns_topic_policy.cloudwatch_events_critical_sns will be updated in-place
~ resource "aws_sns_topic_policy" "cloudwatch_events_critical_sns" {
id = "arn:aws:sns:ca-central-1:957818836222:alert-critical"
~ policy = jsonencode(
~ {
- Id = "__default_policy_ID" -> null
~ Statement = [
~ {
~ Action = [
- "SNS:GetTopicAttributes",
+ "SNS:Subscribe",
"SNS:SetTopicAttributes",
- "SNS:AddPermission",
"SNS:RemovePermission",
- "SNS:DeleteTopic",
- "SNS:Subscribe",
- "SNS:ListSubscriptionsByTopic",
- "SNS:Publish",
"SNS:Receive",
+ "SNS:Publish",
+ "SNS:ListSubscriptionsByTopic",
+ "SNS:GetTopicAttributes",
+ "SNS:DeleteTopic",
+ "SNS:AddPermission",
]
~ Condition = {
~ StringEquals = {
~ AWS:SourceOwner = "957818836222" -> [
+ "957818836222",
]
}
}
~ Resource = "arn:aws:sns:ca-central-1:957818836222:alert-critical" -> "*"
~ Sid = "__default_statement_ID" -> "SNS_Default_Policy"
# (2 unchanged elements hidden)
},
+ {
+ Action = "sns:Publish"
+ Effect = "Allow"
+ Principal = {
+ Service = "events.amazonaws.com"
}
+ Resource = "*"
+ Sid = "SNS_Publish_statement"
},
]
~ Version = "2008-10-17" -> "2012-10-17"
}
)
# (2 unchanged attributes hidden)
}
# aws_sns_topic_subscription.topic_critical will be updated in-place
~ resource "aws_sns_topic_subscription" "topic_critical" {
+ confirmation_timeout_in_minutes = 1
+ endpoint_auto_confirms = false
id = "arn:aws:sns:ca-central-1:957818836222:alert-critical:ac79de1f-8ce4-488e-b5ab-305a2c1adb8f"
# (8 unchanged attributes hidden)
}
# aws_sns_topic_subscription.topic_ok_us_east must be replaced
-/+ resource "aws_sns_topic_subscription" "topic_ok_us_east" {
~ arn = "arn:aws:sns:us-east-1:957818836222:alert-ok:af7ae647-9e45-4bc2-8f29-11028eadd437" -> (known after apply)
~ confirmation_was_authenticated = true -> (known after apply)
~ id = "arn:aws:sns:us-east-1:957818836222:alert-ok:af7ae647-9e45-4bc2-8f29-11028eadd437" -> (known after apply)
~ owner_id = "957818836222" -> (known after apply)
~ pending_confirmation = false -> (known after apply)
- topic_arn = "arn:aws:sns:us-east-1:957818836222:alert-ok" -> null # forces replacement
# (5 unchanged attributes hidden)
}
Plan: 3 to add, 3 to change, 3 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.alb_ddos"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.route53_ddos"]
10 tests, 8 passed, 2 warnings, 0 failures, 0 exceptions
|
Summary | Résumé
This PR fixes an issue where all emails for both Producton and Staging environments are only sent to forms-formulaires@cds-snc.ca. This was one of the differences between the Staging and Production terraform repos that was not caught before being launched.
Solution: use email source in the form submission. Any email address that is not on the safelist API will be refused by Notify but it is up to the Forms team to ensure that all Forms on Staging point to a safelisted Email address.