0% found this document useful (0 votes)
9 views1 page

New Text Document

Uploaded by

kirtinewnew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

New Text Document

Uploaded by

kirtinewnew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1)touch provider.

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.

Declare a variable in variables.tf.

variable "no_of_vnets"
{
default= 2
}
Make the changes in main.tf file to pass this as a value to the ternary operator

count = "${var.no_of_vnets ==2 ?1 : 0}"

Kirti_1646852764482@tcsazuredevops.onmicrosoft.com

-a09e-bc37M80$

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy