Skip to content

Commit 0657096

Browse files
committed
terraform ternary tweaks for mns publish
1 parent 337e745 commit 0657096

10 files changed

Lines changed: 40 additions & 59 deletions

File tree

infrastructure/instance/.terraform.lock.hcl

Lines changed: 30 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infrastructure/instance/environments/dev/internal-dev/variables.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
44
pds_environment = "int"
5-
enable_mns_test_queue = true
6-
mns_environment = "int"
5+
mns_environment = "dev"
76
error_alarm_notifications_enabled = true
87
create_mesh_processor = false
98
has_sub_environment_scope = true

infrastructure/instance/environments/dev/internal-qa/variables.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
44
pds_environment = "int"
5-
enable_mns_test_queue = true
6-
mns_environment = "int"
5+
mns_environment = "dev"
76
error_alarm_notifications_enabled = false
87
mns_publisher_feature_enabled = true
98
create_mesh_processor = false

infrastructure/instance/environments/dev/pr/variables.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
44
pds_environment = "int"
5-
enable_mns_test_queue = true
6-
mns_environment = "int"
5+
mns_environment = "dev"
76
error_alarm_notifications_enabled = false
87
mns_publisher_feature_enabled = true # Switch this off once tested fully e2e in Lambda branch
98
create_mesh_processor = false

infrastructure/instance/environments/dev/ref/variables.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ environment = "dev"
22
immunisation_account_id = "345594581768"
33
dspp_core_account_id = "603871901111"
44
pds_environment = "ref"
5-
enable_mns_test_queue = true
6-
mns_environment = "int"
5+
mns_environment = "dev"
76
error_alarm_notifications_enabled = true
87
create_mesh_processor = false
98
has_sub_environment_scope = true

infrastructure/instance/mns_publisher.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module "mns_publisher" {
1414
mns_test_notification_name_prefix = "${local.resource_scope}-mns-test-notification"
1515
secrets_manager_policy_path = "${local.policy_path}/secret_manager.json"
1616
account_id = data.aws_caller_identity.current.account_id
17-
enable_mns_test_queue = var.enable_mns_test_queue
1817
pds_environment = var.pds_environment
1918
mns_environment = var.mns_environment
2019

infrastructure/instance/modules/mns_publisher/sqs_test_publish_mns.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_sqs_queue" "mns_test_notification" {
2-
count = var.enable_mns_test_queue ? 1 : 0
2+
count = var.mns_environment == "dev" ? 1 : 0
33
name = "${var.mns_test_notification_name_prefix}-queue"
44
fifo_queue = false
55
message_retention_seconds = 86400
@@ -8,6 +8,7 @@ resource "aws_sqs_queue" "mns_test_notification" {
88

99

1010
data "aws_iam_policy_document" "mns_test_notification_sqs_policy" {
11+
count = var.mns_environment == "dev" ? 1 : 0
1112
statement {
1213
sid = "mns-test-notification-allow-lambda-access"
1314
effect = "Allow"
@@ -28,17 +29,18 @@ data "aws_iam_policy_document" "mns_test_notification_sqs_policy" {
2829
}
2930

3031
resource "aws_sqs_queue_policy" "mns_test_notification_sqs" {
32+
count = var.mns_environment == "dev" ? 1 : 0
3133
queue_url = aws_sqs_queue.mns_test_notification[0].id
32-
policy = data.aws_iam_policy_document.mns_test_notification_sqs_policy.json
34+
policy = data.aws_iam_policy_document.mns_test_notification_sqs_policy[0].json
3335
}
3436

3537
output "mns_test_queue_url" {
36-
value = aws_sqs_queue.mns_test_notification[0].url
38+
value = var.mns_environment == "dev" ? aws_sqs_queue.mns_test_notification[0].url : null
3739
description = "URL of the MNS test notifications queue"
3840
}
3941

4042
output "mns_test_queue_arn" {
41-
value = aws_sqs_queue.mns_test_notification[0].arn
43+
value = var.mns_environment == "dev" ? aws_sqs_queue.mns_test_notification[0].arn : 0
4244
description = "ARN of the MNS test notifications queue"
4345
}
4446

infrastructure/instance/modules/mns_publisher/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,4 @@ variable "secrets_manager_policy_path" {
107107
variable "mns_test_notification_name_prefix" {
108108
type = string
109109
description = "The prefix for the name of resources for testing mns notification"
110-
}
111-
112-
variable "enable_mns_test_queue" {
113-
description = "Enable test SQS queue for MNS notifications (dev only)"
114-
type = bool
115-
default = false
116110
}

infrastructure/instance/outputs.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ output "id_sync_queue_arn" {
1919
value = aws_sqs_queue.id_sync_queue.arn
2020
}
2121

22-
# TODO: Remove when MNS platform authorizes imms-vaccinations-1 event type
23-
# Temporary SQS queue for testing MNS notifications until MNS HTTP endpoint is available
2422
output "mns_test_queue_url" {
2523
value = var.mns_publisher_feature_enabled ? module.mns_publisher[0].mns_test_queue_url : null
2624
description = "URL of the MNS test notifications queue (from mns_publisher module)"

infrastructure/instance/variables.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ variable "mns_publisher_feature_enabled" {
9696
description = "Switch to the MNS Publisher feature which allows us to publish Immunisation events."
9797
type = bool
9898
}
99-
100-
variable "enable_mns_test_queue" {
101-
description = "Enable test SQS queue for MNS notifications (dev only)"
102-
type = bool
103-
default = false
104-
}
105-
10699
variable "has_sub_environment_scope" {
107100
description = "True if the sub-environment is a standalone environment, e.g. internal-dev. False if it is part of a blue-green split, e.g. int-green."
108101
type = bool

0 commit comments

Comments
 (0)