Skip to content

Commit 2e587da

Browse files
Feature/ccm 8197 cross account observability (#449)
1 parent 9ed0ee5 commit 2e587da

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

infrastructure/terraform/components/acct/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| <a name="input_kms_deletion_window"></a> [kms\_deletion\_window](#input\_kms\_deletion\_window) | When a kms key is deleted, how long should it wait in the pending deletion state? | `string` | `"30"` | no |
2222
| <a name="input_letter_suppliers"></a> [letter\_suppliers](#input\_letter\_suppliers) | Letter suppliers enabled in the account (across all environments) | <pre>map(object({<br/> enable_polling = bool<br/> default_supplier = optional(bool)<br/> }))</pre> | `{}` | no |
2323
| <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 |
24+
| <a name="input_oam_sink_id"></a> [oam\_sink\_id](#input\_oam\_sink\_id) | The ID of the Cloudwatch OAM sink in the appropriate observability account. | `string` | `""` | no |
2425
| <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 |
2526
| <a name="input_project"></a> [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes |
2627
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |
@@ -33,6 +34,7 @@
3334
| Name | Source | Version |
3435
|------|--------|---------|
3536
| <a name="module_kms_sandbox"></a> [kms\_sandbox](#module\_kms\_sandbox) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/kms | v1.0.8 |
37+
| <a name="module_obs_datasource"></a> [obs\_datasource](#module\_obs\_datasource) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/obs-datasource | v2.0.3 |
3638
| <a name="module_s3bucket_access_logs"></a> [s3bucket\_access\_logs](#module\_s3bucket\_access\_logs) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.9 |
3739
| <a name="module_s3bucket_backup_reports"></a> [s3bucket\_backup\_reports](#module\_s3bucket\_backup\_reports) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.8 |
3840
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 5.19.0 |

infrastructure/terraform/components/acct/iam_policy_github_deploy_overload.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ data "aws_iam_policy_document" "github_deploy" {
2323
"cloudformation:*",
2424
"cognito-idp:*",
2525
"firehose:*",
26+
"logs:*",
27+
"oam:*",
2628
"pipes:*",
2729
"ses:*",
2830
"sns:*",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module "obs_datasource" {
2+
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/obs-datasource?ref=v2.0.3"
3+
4+
name = "obs-datasource"
5+
6+
aws_account_id = var.aws_account_id
7+
region = var.region
8+
project = var.project
9+
environment = var.environment
10+
component = var.component
11+
12+
oam_sink_id = var.oam_sink_id
13+
observability_account_id = var.observability_account_id
14+
}

infrastructure/terraform/components/acct/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,9 @@ variable "letter_suppliers" {
114114

115115
default = {}
116116
}
117+
118+
variable "oam_sink_id" {
119+
description = "The ID of the Cloudwatch OAM sink in the appropriate observability account."
120+
type = string
121+
default = ""
122+
}

infrastructure/terraform/components/app/cloudwatch_log_group_amplify.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ resource "aws_cloudwatch_log_group" "amplify" {
22
name = "/aws/amplify/${aws_amplify_app.main.id}"
33
retention_in_days = var.log_retention_in_days
44
}
5+
6+
resource "aws_cloudwatch_log_subscription_filter" "amplify" {
7+
name = "${local.csi}-amplify-${aws_amplify_app.main.id}"
8+
log_group_name = aws_cloudwatch_log_group.amplify.name
9+
filter_pattern = ""
10+
destination_arn = "arn:aws:logs:${var.region}:${var.observability_account_id}:destination:nhs-notify-main-acct-firehose-logs"
11+
role_arn = local.acct.log_subscription_role_arn
12+
}

0 commit comments

Comments
 (0)