-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: docs fixes #297 * chore: module version * fix: fixes #323 * fix: fixes #289 * fix: fixes bug: When routing intent is enabled in the module subsequent runs attempt to remove the route table association and propagation #289 * docs: make docs * test: add test for #323
- Loading branch information
1 parent
cdffd0f
commit 63d73dd
Showing
15 changed files
with
251 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"locals": { | ||
"module_version": "3.5.0" | ||
"module_version": "4.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...rtualnetwork/testdata/TestDeployVirtualNetworkValidVhubConnectionAndRoutingIntent/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
resource "azapi_resource" "rg" { | ||
type = "Microsoft.Resources/resourceGroups@2021-04-01" | ||
parent_id = "/subscriptions/${var.subscription_id}" | ||
name = "${var.virtual_networks["primary"].name}-hub" | ||
location = var.virtual_networks["primary"].location | ||
} | ||
|
||
resource "azapi_resource" "vwan" { | ||
type = "Microsoft.Network/virtualWans@2021-08-01" | ||
name = "${var.virtual_networks["primary"].name}-vwan" | ||
location = azapi_resource.rg.location | ||
parent_id = azapi_resource.rg.id | ||
body = jsonencode({ | ||
properties = { | ||
type = "Standard" | ||
allowBranchToBranchTraffic = true | ||
disableVpnEncryption = false | ||
} | ||
}) | ||
} | ||
|
||
resource "azapi_resource" "fwpol" { | ||
type = "Microsoft.Network/firewallPolicies@2023-09-01" | ||
parent_id = azapi_resource.rg.id | ||
location = azapi_resource.rg.location | ||
name = "fwpolicy" | ||
body = jsonencode({ | ||
properties = { | ||
sku = { | ||
tier = "Standard" | ||
} | ||
threatIntelMode = "Alert" | ||
} | ||
}) | ||
} | ||
|
||
resource "azapi_resource" "vhub" { | ||
type = "Microsoft.Network/virtualHubs@2021-08-01" | ||
name = "${var.virtual_networks["primary"].name}-vhub" | ||
location = azapi_resource.vwan.location | ||
parent_id = azapi_resource.rg.id | ||
body = jsonencode({ | ||
properties = { | ||
addressPrefix = "192.168.100.0/23" | ||
sku = "Standard" | ||
virtualWan = { | ||
id = azapi_resource.vwan.id | ||
} | ||
} | ||
}) | ||
} | ||
|
||
resource "azapi_resource" "hubfw" { | ||
type = "Microsoft.Network/azureFirewalls@2023-09-01" | ||
name = "hubfw" | ||
location = azapi_resource.rg.location | ||
parent_id = azapi_resource.rg.id | ||
body = jsonencode({ | ||
properties = { | ||
sku = { | ||
name = "AZFW_Hub" | ||
tier = "Standard" | ||
} | ||
virtualHub = { | ||
id = azapi_resource.vhub.id | ||
} | ||
hubIPAddresses = { | ||
publicIPs = { | ||
count = 1 | ||
} | ||
} | ||
firewallPolicy = { | ||
id = azapi_resource.fwpol.id | ||
} | ||
} | ||
}) | ||
} | ||
|
||
resource "azapi_resource" "hubfw_routingintent" { | ||
type = "Microsoft.Network/virtualHubs/routingIntent@2023-09-01" | ||
parent_id = azapi_resource.vhub.id | ||
name = "hubfw-routingintent" | ||
body = jsonencode({ | ||
properties = { | ||
routingPolicies = [ | ||
{ | ||
destinations = ["Internet"] | ||
name = "PublicTraffic" | ||
nextHop = azapi_resource.hubfw.id | ||
}, | ||
{ | ||
destinations = ["PrivateTraffic"] | ||
name = "PrivateTraffic" | ||
nextHop = azapi_resource.hubfw.id | ||
} | ||
] | ||
} | ||
}) | ||
|
||
} | ||
|
||
locals { | ||
virtual_network_primary_merged = merge(var.virtual_networks["primary"], { | ||
vwan_hub_resource_id = azapi_resource.vhub.id | ||
}) | ||
virtual_network_secondary_merged = merge(var.virtual_networks["secondary"], { | ||
vwan_hub_resource_id = azapi_resource.vhub.id | ||
}) | ||
virtual_networks_merged = { | ||
primary = local.virtual_network_primary_merged | ||
secondary = local.virtual_network_secondary_merged | ||
} | ||
} | ||
|
||
module "virtualnetwork_test" { | ||
source = "../../" | ||
subscription_id = var.subscription_id | ||
virtual_networks = local.virtual_networks_merged | ||
} |
13 changes: 13 additions & 0 deletions
13
...network/testdata/TestDeployVirtualNetworkValidVhubConnectionAndRoutingIntent/terraform.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
terraform { | ||
required_version = ">= 1.3.0" | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 3.7.0" | ||
} | ||
azapi = { | ||
source = "Azure/azapi" | ||
version = ">= 1.0.0" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...network/testdata/TestDeployVirtualNetworkValidVhubConnectionAndRoutingIntent/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
variable "subscription_id" { | ||
type = string | ||
} | ||
|
||
variable "virtual_networks" { | ||
type = any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters