Skip to content

Commit e4c7085

Browse files
Merge pull request #1157 from NHSDigital/feat/DTOSS-00000-fix-circular-depedency-on-action-group
Fix circular dependency on infra module input
2 parents d49da1d + 37da53f commit e4c7085

5 files changed

Lines changed: 6 additions & 17 deletions

File tree

infrastructure/modules/container-apps/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ module "azurerm_application_insights_standard_web_test" {
6363
location = var.region
6464
action_group_id = var.action_group_id
6565
application_insights_id = var.app_insights_id
66-
target_url = var.target_url
66+
target_url = "${local.external_url}healthcheck"
6767
}

infrastructure/modules/container-apps/variables.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,6 @@ variable "enable_alerting" {
159159
type = bool
160160
}
161161

162-
variable "target_url" {
163-
description = "The external url"
164-
type = string
165-
}
166-
167162
variable "alert_window_size" {
168163
type = string
169164
nullable = false
@@ -223,6 +218,7 @@ locals {
223218
env_vars_from_yaml = yamldecode(
224219
file("${path.module}/../../environments/${var.env_config}/variables.yml")
225220
)
221+
external_url = "https://${module.frontdoor_endpoint.custom_domains["${var.environment}-domain"].host_name}/"
226222
common_env = merge(
227223
local.env_vars_from_yaml,
228224
{
@@ -239,9 +235,9 @@ locals {
239235

240236
azure_db_env = {
241237
AZURE_DB_CLIENT_ID = var.deploy_database_as_container ? null : module.db_connect_identity[0].client_id
242-
DATABASE_HOST = var.deploy_database_as_container ? null : module.postgres[0].host
243-
DATABASE_NAME = var.deploy_database_as_container ? null : module.postgres[0].database_names[0]
244-
DATABASE_USER = var.deploy_database_as_container ? null : module.db_connect_identity[0].name
238+
DATABASE_HOST = var.deploy_database_as_container ? null : module.postgres[0].host
239+
DATABASE_NAME = var.deploy_database_as_container ? null : module.postgres[0].database_names[0]
240+
DATABASE_USER = var.deploy_database_as_container ? null : module.db_connect_identity[0].name
245241
}
246242

247243
storage_account_name = "st${var.app_short_name}${var.environment}uks"

infrastructure/modules/infra/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module "app_insights_audit" {
8080
log_analytics_workspace_id = module.log_analytics_workspace_audit.id
8181

8282
# alerts
83-
action_group_id = var.action_group_id
83+
action_group_id = module.monitor_action_group.monitor_action_group.id
8484
enable_alerting = var.enable_alerting
8585
}
8686

infrastructure/modules/infra/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ variable "enable_alerting" {
5353
type = bool
5454
}
5555

56-
variable "action_group_id" {
57-
type = string
58-
description = "ID of the action group to notify."
59-
}
60-
6156
variable "enable_relay" {
6257
description = "Whether to create Azure Relay resources."
6358
type = bool

infrastructure/terraform/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ module "infra" {
1919
vnet_address_space = var.vnet_address_space
2020
cae_zone_redundancy_enabled = var.cae_zone_redundancy_enabled
2121
enable_alerting = var.enable_alerting
22-
action_group_id = var.deploy_infra ? module.infra[0].monitor_action_group_id : data.azurerm_monitor_action_group.main[0].id
2322
enable_relay = var.enable_relay
2423
enable_service_bus = var.enable_service_bus
2524
service_bus_public_network_access_enabled = var.service_bus_public_network_access_enabled
@@ -79,7 +78,6 @@ module "container-apps" {
7978
use_apex_domain = var.use_apex_domain
8079
infra_key_vault_name = local.infra_key_vault_name
8180
infra_key_vault_rg = local.infra_key_vault_rg
82-
target_url = var.deploy_container_apps ? "${module.container-apps[0].external_url}healthcheck" : null
8381
resource_group_name_infra = local.resource_group_name
8482
container_memory = var.container_memory
8583
min_replicas = var.min_replicas

0 commit comments

Comments
 (0)