-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
46 lines (40 loc) · 1.3 KB
/
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
# We strongly recommend using the required_providers block to set the
# Azure Provider source and version being used.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.71.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
# More information on the authentication methods supported by
# the AzureRM Provider can be found here:
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
# subscription_id = "..."
# client_id = "..."
# client_secret = "..."
# tenant_id = "..."
}
# Create a resource group
resource "azurerm_resource_group" "myrg" {
name = "IAC Demo"
location = "UK South"
}
# Create a virtual network in the IAC Demo resource group
resource "azurerm_virtual_network" "myvnet" {
name = "IAC Demo"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
address_space = ["10.0.0.0/16"]
}
#create a subnet within the vnet
resource "azurerm_subnet" "mysubnet" {
name = "iac_demo_subnet"
resource_group_name = azurerm_resource_group.myrg.name
virtual_network_name = azurerm_virtual_network.myvnet.name
address_prefix = ["10.0.1.0/24"]
}