Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adds moves for old resources #136

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions azurerm/modules/azurerm-cosmosdb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ resource "azurerm_cosmosdb_account" "default" {
}

tags = var.resource_tags
lifecycle {
ignore_changes = [
tags,
]
}
}

resource "azurerm_cosmosdb_sql_database" "default" {
Expand Down
4 changes: 3 additions & 1 deletion azurerm/modules/azurerm-server-side-app/locals.tf
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 2 additions & 13 deletions azurerm/modules/azurerm-server-side-app/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" {
Expand Down Expand Up @@ -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
Expand All @@ -73,10 +68,4 @@ resource "azurerm_redis_cache" "default" {
}

tags = var.resource_tags

lifecycle {
ignore_changes = [
tags,
]
}
}
9 changes: 9 additions & 0 deletions azurerm/modules/azurerm-server-side-app/moved.tf
Original file line number Diff line number Diff line change
@@ -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]
}