Skip to content

Commit d05f08b

Browse files
committed
parameterization
1 parent c6cf437 commit d05f08b

File tree

8 files changed

+10
-7
lines changed

8 files changed

+10
-7
lines changed

terraform/endpoints.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ module "api_gateway" {
117117
oas = local.oas
118118
aws_region = var.aws_region
119119
immunisation_account_id = var.immunisation_account_id
120+
csoc_account_id = var.csoc_account_id
120121
}
121122

122123
resource "aws_lambda_permission" "api_gw" {

terraform/environments/dev/int/variables.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
4+
csoc_account_id = "693466633220"
45
pds_environment = "int"
56
pds_check_enabled = false
67
create_mesh_processor = true

terraform/environments/dev/internal-dev/variables.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
4+
csoc_account_id = "693466633220"
45
pds_environment = "int"
56
pds_check_enabled = true
67
create_mesh_processor = false

terraform/environments/dev/pr/variables.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
4+
csoc_account_id = "693466633220"
45
pds_environment = "int"
56
pds_check_enabled = true
67
create_mesh_processor = false

terraform/environments/dev/ref/variables.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
4+
csoc_account_id = "693466633220"
45
pds_environment = "ref"
56
pds_check_enabled = true
67
create_mesh_processor = false

terraform/modules/api_gateway/logs.tf

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ resource "aws_iam_policy" "api_logs_subscription_policy" {
7272
]
7373
Resource = [
7474
"arn:aws:logs:${var.aws_region}:${var.immunisation_account_id}:log-group:/aws/vendedlogs/${aws_apigatewayv2_api.service_api.id}/${var.sub_environment}:*",
75-
"arn:aws:logs:eu-west-2:693466633220:destination:api_gateway_log_destination"
75+
"arn:aws:logs:${var.aws_region}:${var.csoc_account_id}:destination:api_gateway_log_destination"
7676
]
7777
}
7878
]
@@ -84,10 +84,6 @@ resource "aws_iam_role_policy_attachment" "api_logs_subscription_policy" {
8484
policy_arn = aws_iam_policy.api_logs_subscription_policy.arn
8585
}
8686

87-
# TODO un-hardcode the region
88-
# e.g.
89-
# "logs.${data.aws_region.current.region}.amazonaws.com"
90-
9187
resource "aws_iam_role" "api_logs_subscription_role" {
9288
name = "${var.short_prefix}-api-logs-subscription-role"
9389
assume_role_policy = jsonencode({
@@ -96,7 +92,7 @@ resource "aws_iam_role" "api_logs_subscription_role" {
9692
Effect = "Allow",
9793
Sid = "",
9894
Principal = {
99-
Service = "logs.eu-west-2.amazonaws.com"
95+
Service = "logs.${var.aws_region}.amazonaws.com"
10096
},
10197
Action = "sts:AssumeRole"
10298
}]
@@ -107,6 +103,6 @@ resource "aws_cloudwatch_log_subscription_filter" "api_logs_subscription_logfilt
107103
name = "${var.short_prefix}-api-logs-subscription-logfilter"
108104
log_group_name = aws_cloudwatch_log_group.api_access_log.name
109105
filter_pattern = ""
110-
destination_arn = "arn:aws:logs:eu-west-2:693466633220:destination:api_gateway_log_destination"
106+
destination_arn = "arn:aws:logs:${var.aws_region}:${var.csoc_account_id}:destination:api_gateway_log_destination"
111107
role_arn = aws_iam_role.api_logs_subscription_role.arn
112108
}

terraform/modules/api_gateway/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ variable "sub_environment" {}
77
variable "oas" {}
88
variable "aws_region" {}
99
variable "immunisation_account_id" {}
10+
variable "csoc_account_id" {}

terraform/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ variable "sub_environment" {
66

77
variable "immunisation_account_id" {}
88
variable "dspp_core_account_id" {}
9+
variable "csoc_account_id" {}
910

1011
variable "create_mesh_processor" {
1112
default = false

0 commit comments

Comments
 (0)