-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
51 lines (42 loc) · 955 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
terraform {
required_providers {
azurerm = {
version = "~>3.0.0"
source = "hashicorp/azurerm"
}
}
}
terraform {
backend "azurerm" {}
}
provider "azurerm" {
features {}
}
locals {
vnet = "192.168.0.0/16"
subnet1 = "192.168.1.0/24"
subnet2 = "192.168.2.0/24"
}
variable "resource_group_name" {}
variable "resource_group_location" {}
resource "azurerm_resource_group" "myrsg" {
name = var.resource_group_name
location = var.resource_group_location
}
resource "azurerm_resource_group_template_deployment" "template" {
name = "my-vnet-template"
resource_group_name = azurerm_resource_group.myrsg.name
deployment_mode = "Incremental"
template_content = file("${path.module}/vnet.json")
parameters_content = jsonencode({
"myvnet" = {
value = local.vnet
},
"mysubnet-1" = {
value = local.subnet1
},
"mysubnet-2" = {
value = local.subnet2
}
})
}