How does terraform use modules?
For example in the below link there is reference to a module?
source = “innovationnorway/virtual-network/azurerm” what is this path for?
Please explain.
https://registry.terraform.io/modules/innovationnorway/virtual-network/azurerm/1.0.0
There is also module in the upper right of the html page. All it says is to run terraform init. What is the comment to “# insert the 4 required variables here”? What are these 4 variables?
module “virtual-network” {
source = “innovationnorway/virtual-network/azurerm”
version = “1.0.0”
insert the 4 required variables here
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "westeurope"
}
module "virtual_network" {
source = "innovationnorway/virtual-network/azurerm"
name = "example-network"
resource_group_name = azurerm_resource_group.example.name
address_space = ["10.0.0.0/16"]
subnets = [
{
name = "subnet-1"
address_prefix = "10.0.1.0/24"
},
{
name = "subnet-2"
address_prefix = "10.0.2.0/24"
delegations = ["Microsoft.ContainerInstance/containerGroups"]
},
]
}