diff --git a/azurerm/modules/azurerm-cosmosdb/main.tf b/azurerm/modules/azurerm-cosmosdb/main.tf index aa440ec..3998b59 100644 --- a/azurerm/modules/azurerm-cosmosdb/main.tf +++ b/azurerm/modules/azurerm-cosmosdb/main.tf @@ -25,11 +25,6 @@ resource "azurerm_cosmosdb_account" "default" { } tags = var.resource_tags - lifecycle { - ignore_changes = [ - tags, - ] - } } resource "azurerm_cosmosdb_sql_database" "default" { diff --git a/azurerm/modules/azurerm-server-side-app/locals.tf b/azurerm/modules/azurerm-server-side-app/locals.tf index f856c12..80121f1 100644 --- a/azurerm/modules/azurerm-server-side-app/locals.tf +++ b/azurerm/modules/azurerm-server-side-app/locals.tf @@ -1,7 +1,9 @@ locals { create_resource_group = var.create_cosmosdb || var.create_cache || var.create_cdn_endpoint + create_cdn_alias_dns = var.create_dns_record && var.create_cdn_endpoint && var.dns_enable_alias_record + # We want to create the A Record if we are trying to create DNS but not a # CDN, OR, If we want to create an Alias DNS and a CDN - create_app_gateway_dns = (var.create_dns_record && !var.create_cdn_endpoint) || (var.create_dns_record && var.create_cdn_endpoint && var.dns_enable_alias_record) ? 1 : 0 + create_app_gateway_dns = (var.create_dns_record && !var.create_cdn_endpoint) || local.create_cdn_alias_dns ? 1 : 0 } diff --git a/azurerm/modules/azurerm-server-side-app/main.tf b/azurerm/modules/azurerm-server-side-app/main.tf index c0afb2f..e8ad27b 100644 --- a/azurerm/modules/azurerm-server-side-app/main.tf +++ b/azurerm/modules/azurerm-server-side-app/main.tf @@ -19,7 +19,7 @@ resource "azurerm_dns_a_record" "default" { # e.g. dev-api.nonprod.stacks.ensono.com is the intended CDN endpoint, # dev-api-appgw.nonprod.stacks.ensono.com is the Alias record for the App GW # public IP - name = var.create_dns_record && var.create_cdn_endpoint && var.dns_enable_alias_record ? "${var.dns_record}-appgw" : var.dns_record + name = local.create_cdn_alias_dns ? "${var.dns_record}-appgw" : var.dns_record zone_name = var.dns_zone_name resource_group_name = var.dns_zone_resource_group ttl = var.dns_ttl @@ -30,12 +30,6 @@ resource "azurerm_dns_a_record" "default" { records = var.dns_enable_alias_record ? null : var.dns_a_records tags = var.resource_tags - - lifecycle { - ignore_changes = [ - tags, - ] - } } module "cosmosdb" { @@ -65,6 +59,7 @@ resource "azurerm_redis_cache" "default" { sku_name = var.cache_sku_name enable_non_ssl_port = var.cach_enable_non_ssl_port minimum_tls_version = var.cache_minimum_tls_version + redis_configuration { enable_authentication = var.cache_redis_enable_authentication maxmemory_reserved = var.cache_redis_maxmemory_reserved @@ -73,10 +68,4 @@ resource "azurerm_redis_cache" "default" { } tags = var.resource_tags - - lifecycle { - ignore_changes = [ - tags, - ] - } } diff --git a/azurerm/modules/azurerm-server-side-app/moved.tf b/azurerm/modules/azurerm-server-side-app/moved.tf new file mode 100644 index 0000000..75eb521 --- /dev/null +++ b/azurerm/modules/azurerm-server-side-app/moved.tf @@ -0,0 +1,9 @@ +moved { + from = azurerm_resource_group.default + to = azurerm_resource_group.default[0] +} + +moved { + from = module.app.module.cosmosdb + to = module.app.module.cosmosdb[0] +}