Skip to content

Commit 7ff2f53

Browse files
authored
CCM-11007: Lambda log destination fix (#559)
1 parent 56ae8cf commit 7ff2f53

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

infrastructure/terraform/components/app/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
| <a name="input_letter_suppliers"></a> [letter\_suppliers](#input\_letter\_suppliers) | Letter suppliers enabled in the environment | <pre>map(object({<br/> email_addresses = list(string)<br/> enable_polling = bool<br/> default_supplier = optional(bool)<br/> }))</pre> | `{}` | no |
4141
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite | `number` | `0` | no |
4242
| <a name="input_observability_account_id"></a> [observability\_account\_id](#input\_observability\_account\_id) | The Observability Account ID that needs access | `string` | n/a | yes |
43+
| <a name="input_override_log_destination_arn"></a> [override\_log\_destination\_arn](#input\_override\_log\_destination\_arn) | Override the log destination ARN for this component. | `string` | `""` | no |
4344
| <a name="input_parent_acct_environment"></a> [parent\_acct\_environment](#input\_parent\_acct\_environment) | Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments | `string` | `"main"` | no |
4445
| <a name="input_project"></a> [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes |
4546
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |

infrastructure/terraform/components/app/cloudwatch_log_group_amplify.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ resource "aws_cloudwatch_log_subscription_filter" "amplify" {
77
name = "${local.csi}-amplify-${aws_amplify_app.main.id}"
88
log_group_name = aws_cloudwatch_log_group.amplify.name
99
filter_pattern = ""
10-
destination_arn = "arn:aws:logs:${var.region}:${var.observability_account_id}:destination:nhs-notify-main-acct-firehose-logs"
10+
destination_arn = local.log_destination_arn
1111
role_arn = local.acct.log_subscription_role_arn
1212
}

infrastructure/terraform/components/app/locals.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ locals {
22
cloudfront_files_domain_name = "files.${local.root_domain_name}"
33
root_domain_name = "${var.environment}.${local.acct.dns_zone["name"]}"
44
lambdas_source_code_dir = "../../../../lambdas"
5+
log_destination_arn = var.override_log_destination_arn != "" ? var.override_log_destination_arn : "arn:aws:logs:${var.region}:${var.observability_account_id}:destination:nhs-main-obs-firehose-logs" # TODO CCM-10579 Please remove this after we do dev/nonprod cutover for this BC
56
}

infrastructure/terraform/components/app/module_backend_api.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module "backend_api" {
2323

2424
enable_proofing = var.enable_proofing
2525
letter_suppliers = var.letter_suppliers
26-
log_destination_arn = "arn:aws:logs:${var.region}:${var.observability_account_id}:destination:nhs-notify-main-acct-firehose-logs"
26+
log_destination_arn = local.log_destination_arn
2727
log_subscription_role_arn = local.acct.log_subscription_role_arn
2828

2929
send_to_firehose = true

infrastructure/terraform/components/app/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,10 @@ variable "external_email_domain" {
218218
default = null
219219
description = "Externally managed domain used to create an SES identity for sending emails from. Validation DNS records will need to be manually configured in the DNS provider."
220220
}
221+
222+
variable "override_log_destination_arn" {
223+
type = string
224+
description = "Override the log destination ARN for this component."
225+
default = ""
226+
}
227+

0 commit comments

Comments
 (0)