diff --git a/auto_policy_testing/green/data/data_factory.tf b/auto_policy_testing/green/data/data_factory.tf index 9e22bab7..1a0cb498 100644 --- a/auto_policy_testing/green/data/data_factory.tf +++ b/auto_policy_testing/green/data/data_factory.tf @@ -1,7 +1,7 @@ resource "azurerm_data_factory" "this" { name = module.naming.resource_prefix.datafactory - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name github_configuration { account_name = "alyonaserdiuk" diff --git a/auto_policy_testing/green/data/databricks_workspace.tf b/auto_policy_testing/green/data/databricks_workspace.tf index f7c66753..df48076d 100644 --- a/auto_policy_testing/green/data/databricks_workspace.tf +++ b/auto_policy_testing/green/data/databricks_workspace.tf @@ -1,7 +1,7 @@ resource "azurerm_databricks_workspace" "this" { name = module.naming.resource_prefix.databricksws - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name sku = "standard" custom_parameters { diff --git a/auto_policy_testing/green/data/keyvault.tf b/auto_policy_testing/green/data/keyvault.tf index 752f5b51..61096549 100644 --- a/auto_policy_testing/green/data/keyvault.tf +++ b/auto_policy_testing/green/data/keyvault.tf @@ -1,8 +1,8 @@ data "azurerm_client_config" "current" {} resource "azurerm_user_assigned_identity" "this" { - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name name = module.naming.resource_prefix.useridentity } diff --git a/auto_policy_testing/green/data/network.tf b/auto_policy_testing/green/data/network.tf index b1697821..032067d1 100644 --- a/auto_policy_testing/green/data/network.tf +++ b/auto_policy_testing/green/data/network.tf @@ -1,14 +1,14 @@ resource "azurerm_virtual_network" "this" { name = module.naming.resource_prefix.vnet address_space = ["10.0.0.0/16"] - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name tags = module.naming.default_tags } resource "azurerm_subnet" "this" { name = module.naming.resource_prefix.subnet - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + resource_group_name = azurerm_resource_group.this.name virtual_network_name = azurerm_virtual_network.this.name address_prefixes = ["10.0.2.0/24"] delegation { @@ -32,8 +32,8 @@ resource "azurerm_subnet" "this" { resource "azurerm_network_security_group" "this" { name = module.naming.resource_prefix.networksecuritygroup - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name security_rule { name = "deny_inbound_udp" @@ -71,7 +71,7 @@ resource "azurerm_subnet_network_security_group_association" "this" { resource "azurerm_subnet" "this1" { name = "${module.naming.resource_prefix.subnet}-data" - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + resource_group_name = azurerm_resource_group.this.name virtual_network_name = azurerm_virtual_network.this.name address_prefixes = ["10.0.3.0/24"] @@ -96,8 +96,8 @@ resource "azurerm_subnet" "this1" { resource "azurerm_network_security_group" "this1" { name = "${module.naming.resource_prefix.networksecuritygroup}-data" - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name security_rule { name = "deny_inbound_udp" diff --git a/auto_policy_testing/green/data/provider.tf b/auto_policy_testing/green/data/provider.tf index 98f36662..5d026b71 100644 --- a/auto_policy_testing/green/data/provider.tf +++ b/auto_policy_testing/green/data/provider.tf @@ -14,6 +14,10 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } diff --git a/auto_policy_testing/green/data/resource_group.tf b/auto_policy_testing/green/data/resource_group.tf new file mode 100644 index 00000000..4c296ea9 --- /dev/null +++ b/auto_policy_testing/green/data/resource_group.tf @@ -0,0 +1,6 @@ +resource "azurerm_resource_group" "this" { + name = module.naming.resource_prefix.resourcegroup + location = "northeurope" + + tags = module.naming.default_tags +} \ No newline at end of file diff --git a/auto_policy_testing/red/data/data_factory.tf b/auto_policy_testing/red/data/data_factory.tf index 9746d305..00123397 100644 --- a/auto_policy_testing/red/data/data_factory.tf +++ b/auto_policy_testing/red/data/data_factory.tf @@ -2,8 +2,8 @@ data "azurerm_client_config" "current" {} resource "azurerm_data_factory" "this" { name = module.naming.resource_prefix.datafactory - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name tags = module.naming.default_tags } diff --git a/auto_policy_testing/red/data/databricks_workspace.tf b/auto_policy_testing/red/data/databricks_workspace.tf index ed0992a5..3d55e4bb 100644 --- a/auto_policy_testing/red/data/databricks_workspace.tf +++ b/auto_policy_testing/red/data/databricks_workspace.tf @@ -1,7 +1,7 @@ resource "azurerm_databricks_workspace" "this" { name = module.naming.resource_prefix.databricksws - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name sku = "standard" custom_parameters { diff --git a/auto_policy_testing/red/data/network.tf b/auto_policy_testing/red/data/network.tf index 7403828e..efb3c4dd 100644 --- a/auto_policy_testing/red/data/network.tf +++ b/auto_policy_testing/red/data/network.tf @@ -1,14 +1,14 @@ resource "azurerm_virtual_network" "this" { name = module.naming.resource_prefix.vnet address_space = ["10.0.0.0/16"] - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name tags = module.naming.default_tags } resource "azurerm_subnet" "this" { name = module.naming.resource_prefix.subnet - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + resource_group_name = azurerm_resource_group.this.name virtual_network_name = azurerm_virtual_network.this.name address_prefixes = ["10.0.2.0/24"] @@ -33,8 +33,8 @@ resource "azurerm_subnet" "this" { resource "azurerm_network_security_group" "this" { name = module.naming.resource_prefix.networksecuritygroup - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name security_rule { name = "deny_inbound_udp" @@ -72,7 +72,7 @@ resource "azurerm_subnet_network_security_group_association" "this" { resource "azurerm_subnet" "this1" { name = "${module.naming.resource_prefix.subnet}-data" - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + resource_group_name = azurerm_resource_group.this.name virtual_network_name = azurerm_virtual_network.this.name address_prefixes = ["10.0.3.0/24"] @@ -97,8 +97,8 @@ resource "azurerm_subnet" "this1" { resource "azurerm_network_security_group" "this1" { name = "${module.naming.resource_prefix.networksecuritygroup}-data" - location = data.terraform_remote_state.common.outputs.location - resource_group_name = data.terraform_remote_state.common.outputs.resource_group + location = "northeurope" + resource_group_name = azurerm_resource_group.this.name security_rule { name = "deny_inbound_udp" diff --git a/auto_policy_testing/red/data/provider.tf b/auto_policy_testing/red/data/provider.tf index 98f36662..5d026b71 100644 --- a/auto_policy_testing/red/data/provider.tf +++ b/auto_policy_testing/red/data/provider.tf @@ -14,6 +14,10 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } diff --git a/auto_policy_testing/red/data/resource_group.tf b/auto_policy_testing/red/data/resource_group.tf new file mode 100644 index 00000000..4c296ea9 --- /dev/null +++ b/auto_policy_testing/red/data/resource_group.tf @@ -0,0 +1,6 @@ +resource "azurerm_resource_group" "this" { + name = module.naming.resource_prefix.resourcegroup + location = "northeurope" + + tags = module.naming.default_tags +} \ No newline at end of file