Skip to content

Commit 4d87d25

Browse files
authored
Make MAVIS__PDS__ENQUEUE_BULK_UPDATES configurable (#3379)
This makes this variable configurable by adding it as a parameter and then exposing the variable as an environment variable. This would then allow us to enable/disable this part of the service per environment while also being able to temporarily turn it on and off. This will start by enabling it in all environments and then we can turn it off.
2 parents 8088a34 + 857b6c0 commit 4d87d25

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

terraform/app/env/copilotmigration.tfvars

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ http_hosts = {
1616
MAVIS__GIVE_OR_REFUSE_CONSENT_HOST = "copilotmigration.mavistesting.com"
1717
}
1818

19-
enable_splunk = false
20-
enable_cis2 = false
21-
enable_pds_enqueue_bulk_updates = false
19+
enable_splunk = false
20+
enable_cis2 = false
2221

2322
appspec_bucket = "nhse-mavis-appspec-bucket-copilotmigration"
2423
minimnum_web_replicas = 2

terraform/app/env/preview.tfvars

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ resource_name = {
1515
rails_env = "staging"
1616
rails_master_key_path = "/copilot/mavis/secrets/STAGING_RAILS_MASTER_KEY"
1717

18-
enable_splunk = false
19-
enable_cis2 = false
20-
enable_pds_enqueue_bulk_updates = false
18+
enable_splunk = false
19+
enable_cis2 = false
2120

2221
http_hosts = {
2322
MAVIS__HOST = "preview.mavistesting.com"

terraform/app/env/qa.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ resource_name = {
1515
rails_env = "staging"
1616
rails_master_key_path = "/copilot/mavis/secrets/STAGING_RAILS_MASTER_KEY"
1717

18-
enable_cis2 = false
19-
enable_pds_enqueue_bulk_updates = false
18+
enable_cis2 = false
2019

2120
http_hosts = {
2221
MAVIS__HOST = "qa.mavistesting.com"

terraform/app/env/training.tfvars

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ resource_name = {
1818
rails_env = "staging"
1919
rails_master_key_path = "/copilot/mavis/secrets/STAGING_RAILS_MASTER_KEY"
2020

21-
enable_splunk = false
22-
enable_cis2 = false
23-
enable_pds_enqueue_bulk_updates = false
21+
enable_splunk = false
22+
enable_cis2 = false
2423

2524
http_hosts = {
2625
MAVIS__HOST = "training.manage-vaccinations-in-schools.nhs.uk"

terraform/app/iam_policy_documents.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ data "aws_iam_policy_document" "ecs_secrets_access" {
5454
resources = [
5555
"arn:aws:ssm:${var.region}:${var.account_id}:parameter${var.rails_master_key_path}",
5656
aws_ssm_parameter.good_job_max_threads.arn,
57+
aws_ssm_parameter.pds_enqueue_bulk_jobs.arn,
5758
aws_ssm_parameter.pds_wait_between_jobs.arn
5859
]
5960
effect = "Allow"

terraform/app/ssm_parameters.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ resource "aws_ssm_parameter" "good_job_max_threads" {
1111
}
1212
}
1313

14+
resource "aws_ssm_parameter" "pds_enqueue_bulk_jobs" {
15+
name = "/${var.environment}/pds_enqueue_bulk_jobs"
16+
type = "String"
17+
18+
# This value is the default, but can be customised in the AWS console
19+
# directly and isn't managed by Terraform.
20+
value = "true"
21+
22+
lifecycle {
23+
ignore_changes = [value]
24+
}
25+
}
1426

1527
resource "aws_ssm_parameter" "pds_wait_between_jobs" {
1628
name = "/${var.environment}/pds_wait_between_jobs"

terraform/app/variables.tf

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,6 @@ variable "enable_cis2" {
143143
nullable = false
144144
}
145145

146-
variable "enable_pds_enqueue_bulk_updates" {
147-
type = bool
148-
default = false
149-
description = "Whether PDS jobs that update patients in bulk should execute or not. This is disabled in non-production environments to avoid making unnecessary requests to PDS."
150-
nullable = false
151-
}
152-
153146
variable "enable_splunk" {
154147
type = bool
155148
default = true
@@ -189,10 +182,6 @@ locals {
189182
name = "MAVIS__CIS2__ENABLED"
190183
value = var.enable_cis2 ? "true" : "false"
191184
},
192-
{
193-
name = "MAVIS__PDS__ENQUEUE_BULK_UPDATES"
194-
value = var.enable_pds_enqueue_bulk_updates ? "true" : "false"
195-
},
196185
{
197186
name = "MAVIS__SPLUNK__ENABLED"
198187
value = var.enable_splunk ? "true" : "false"
@@ -207,6 +196,10 @@ locals {
207196
name = "RAILS_MASTER_KEY"
208197
valueFrom = var.rails_master_key_path
209198
},
199+
{
200+
name = "MAVIS__PDS__ENQUEUE_BULK_UPDATES"
201+
valueFrom = aws_ssm_parameter.pds_enqueue_bulk_jobs.name,
202+
},
210203
{
211204
name = "MAVIS__PDS__WAIT_BETWEEN_JOBS",
212205
valueFrom = aws_ssm_parameter.pds_wait_between_jobs.name,

0 commit comments

Comments
 (0)