Skip to content

Commit 3c3abd3

Browse files
committed
Rename deploy_mock_webhook var
1 parent ec282bd commit 3c3abd3

7 files changed

Lines changed: 16 additions & 16 deletions

File tree

infrastructure/terraform/components/callbacks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| <a name="input_client_config_bucket_force_destroy"></a> [client\_config\_bucket\_force\_destroy](#input\_client\_config\_bucket\_force\_destroy) | Force-delete all objects and versions from the client config bucket during destroy | `bool` | `false` | no |
1919
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"callbacks"` | no |
2020
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no |
21-
| <a name="input_deploy_mock_webhook"></a> [deploy\_mock\_webhook](#input\_deploy\_mock\_webhook) | Flag to deploy mock webhook lambda for integration testing (test/dev environments only) | `bool` | `false` | no |
21+
| <a name="input_deploy_mock_client_subscriptions"></a> [deploy\_mock\_client\_subscriptions](#input\_deploy\_mock\_client\_subscriptions) | Flag to deploy mock webhook lambda for integration testing (test/dev environments only) | `bool` | `false` | no |
2222
| <a name="input_enable_event_anomaly_detection"></a> [enable\_event\_anomaly\_detection](#input\_enable\_event\_anomaly\_detection) | Enable CloudWatch anomaly detection alarm for inbound event queue message reception | `bool` | `true` | no |
2323
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes |
2424
| <a name="input_event_anomaly_band_width"></a> [event\_anomaly\_band\_width](#input\_event\_anomaly\_band\_width) | The width of the anomaly detection band. Higher values (e.g. 4-6) reduce sensitivity and noise, lower values (e.g. 2-3) increase sensitivity. Recommended: 2-4. | `number` | `3` | no |

infrastructure/terraform/components/callbacks/locals.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ locals {
1010
mock_client_path = "${path.module}/../../../../tests/integration/fixtures/${local.mock_client_file}"
1111

1212
discovered_config_files = fileset(local.clients_dir_path, "*.json")
13-
config_files = var.deploy_mock_webhook ? setunion(
13+
config_files = var.deploy_mock_client_subscriptions ? setunion(
1414
local.discovered_config_files,
1515
toset([local.mock_client_file])
1616
) : local.discovered_config_files
@@ -27,10 +27,10 @@ locals {
2727
}
2828
]...)
2929

30-
mock_client_id = var.deploy_mock_webhook ? local.config_clients[local.mock_client_key].clientId : ""
30+
mock_client_id = var.deploy_mock_client_subscriptions ? local.config_clients[local.mock_client_key].clientId : ""
3131

3232
# Enriched mock client config with live Lambda URL and API key (for S3 upload)
33-
mock_client_config = var.deploy_mock_webhook ? merge(
33+
mock_client_config = var.deploy_mock_client_subscriptions ? merge(
3434
local.config_clients[local.mock_client_key],
3535
{
3636
targets = [
@@ -58,7 +58,7 @@ locals {
5858
]...)
5959

6060
# Override mock targets with live Lambda URL when deployed
61-
config_targets = var.deploy_mock_webhook ? merge(
61+
config_targets = var.deploy_mock_client_subscriptions ? merge(
6262
local.raw_targets,
6363
{ for target_id, target in local.raw_targets :
6464
target_id => merge(target, {

infrastructure/terraform/components/callbacks/module_mock_webhook_lambda.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "mock_webhook_lambda" {
2-
count = var.deploy_mock_webhook ? 1 : 0
2+
count = var.deploy_mock_client_subscriptions ? 1 : 0
33
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/3.0.6/terraform-lambda.zip"
44

55
function_name = "mock-webhook"
@@ -42,13 +42,13 @@ module "mock_webhook_lambda" {
4242
}
4343

4444
resource "random_password" "mock_webhook_api_key" {
45-
count = var.deploy_mock_webhook ? 1 : 0
45+
count = var.deploy_mock_client_subscriptions ? 1 : 0
4646
length = 32
4747
special = false
4848
}
4949

5050
data "aws_iam_policy_document" "mock_webhook_lambda" {
51-
count = var.deploy_mock_webhook ? 1 : 0
51+
count = var.deploy_mock_client_subscriptions ? 1 : 0
5252

5353
statement {
5454
sid = "KMSPermissions"
@@ -67,7 +67,7 @@ data "aws_iam_policy_document" "mock_webhook_lambda" {
6767

6868
# Lambda Function URL for mock webhook (test/dev only)
6969
resource "aws_lambda_function_url" "mock_webhook" {
70-
count = var.deploy_mock_webhook ? 1 : 0
70+
count = var.deploy_mock_client_subscriptions ? 1 : 0
7171
function_name = module.mock_webhook_lambda[0].function_name
7272
authorization_type = "NONE" # Public endpoint for testing
7373

@@ -80,7 +80,7 @@ resource "aws_lambda_function_url" "mock_webhook" {
8080
}
8181

8282
resource "aws_lambda_permission" "mock_webhook_function_url" {
83-
count = var.deploy_mock_webhook ? 1 : 0
83+
count = var.deploy_mock_client_subscriptions ? 1 : 0
8484
statement_id_prefix = "FunctionURLAllowPublicAccess"
8585
action = "lambda:InvokeFunctionUrl"
8686
function_name = module.mock_webhook_lambda[0].function_name
@@ -89,7 +89,7 @@ resource "aws_lambda_permission" "mock_webhook_function_url" {
8989
}
9090

9191
resource "aws_lambda_permission" "mock_webhook_function_invoke" {
92-
count = var.deploy_mock_webhook ? 1 : 0
92+
count = var.deploy_mock_client_subscriptions ? 1 : 0
9393
statement_id_prefix = "FunctionURLAllowInvokeAction"
9494
action = "lambda:InvokeFunction"
9595
function_name = module.mock_webhook_lambda[0].function_name

infrastructure/terraform/components/callbacks/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ output "deployment" {
2020

2121
output "mock_webhook_lambda_log_group_name" {
2222
description = "CloudWatch log group name for mock webhook lambda (for integration test queries)"
23-
value = var.deploy_mock_webhook ? module.mock_webhook_lambda[0].cloudwatch_log_group_name : null
23+
value = var.deploy_mock_client_subscriptions ? module.mock_webhook_lambda[0].cloudwatch_log_group_name : null
2424
}
2525

2626
output "mock_webhook_url" {
2727
description = "URL endpoint for mock webhook (for TEST_WEBHOOK_URL environment variable)"
28-
value = var.deploy_mock_webhook ? aws_lambda_function_url.mock_webhook[0].function_url : null
28+
value = var.deploy_mock_client_subscriptions ? aws_lambda_function_url.mock_webhook[0].function_url : null
2929
}

infrastructure/terraform/components/callbacks/s3_bucket_client_config.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_s3_object" "mock_client_config" {
2-
count = var.deploy_mock_webhook ? 1 : 0
2+
count = var.deploy_mock_client_subscriptions ? 1 : 0
33

44
bucket = module.client_config_bucket.id
55
key = "client_subscriptions/mock-it-client.json"

infrastructure/terraform/components/callbacks/ssm_parameter_applications_map.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "aws_ssm_parameter" "applications_map" {
33
type = "SecureString"
44
key_id = module.kms.key_arn
55

6-
value = var.deploy_mock_webhook ? jsonencode({
6+
value = var.deploy_mock_client_subscriptions ? jsonencode({
77
(local.mock_client_id) = "mock-application-id"
88
}) : jsonencode({})
99

infrastructure/terraform/components/callbacks/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ variable "event_anomaly_band_width" {
149149
}
150150
}
151151

152-
variable "deploy_mock_webhook" {
152+
variable "deploy_mock_client_subscriptions" {
153153
type = bool
154154
description = "Flag to deploy mock webhook lambda for integration testing (test/dev environments only)"
155155
default = false

0 commit comments

Comments
 (0)