New Text Document
New Text Document
tf
provider "azurerm" { version = ">= 1.25, < 1.26" }
2)main.tf
resource "azurerm_virtual_network""multiple"
{
name = "vnet-${element(var.name,count.index)}"
resource_group_name = "${var.resource_group}"
location = "${var.location}"
address_space=["10.0.0.0/16"]
count="${length(var.name)}"
}
3)variable.tf
variable "resource_group"
{
default = "user-nuqo"
}
variable "location"
{
default = "East US"
}
variable "name"
{
type = "list"
default = ["A","B","C"]
}
4)terraform plan
5)terraform apply
6)terraform destroy
7)for ternary operator
8)modify main.tf and variable.tf to create a virtual network named 'myvnet' using
ternary operator.
variable "no_of_vnets"
{
default= 2
}
Make the changes in main.tf file to pass this as a value to the ternary operator
Kirti_1646852764482@tcsazuredevops.onmicrosoft.com
-a09e-bc37M80$