updates to vnet code and test

This commit is contained in:
Michael Bender 2023-06-27 09:38:36 -05:00
parent 8fedbd9b92
commit a966811863
2 changed files with 8 additions and 2 deletions

View File

@ -11,9 +11,14 @@ resource "azurerm_resource_group" "rg" {
}
# Create three virtual networks
resource "random_string" "prefix" {
length = 4
special = false
upper = false
}
resource "random_pet" "virtual_network_name" {
prefix = "vnet"
prefix = "vnet-${random_string.prefix.result}"
}
resource "azurerm_virtual_network" "vnet" {
count = 3
@ -88,7 +93,7 @@ resource "azurerm_policy_definition" "network_group_policy" {
"allOf": [
{
"field": "Name",
"contains": "vnet"
"contains": "${random_pet.virtual_network_name.id}"
}
]
}

View File

@ -5,6 +5,7 @@ This template deploys an Azure Virtual Network Manager instance with a connectiv
## Terraform resource types
- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
- [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string)
- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group)
- [azurerm_virtual_network](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network)
- [azurerm_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet)