Skip to content

nextmetaphor/terraform-azure-vnet

Repository files navigation

terraform-azure-vnet

Terraform module for Azure VNet.

This creates an Azure virtual network and a number of subnets, as specified by the provided variables. Examine variables.tf to understand the variable structure; variables.tfvars for example values.

Azure Virtual Network and Subnets

Install

This module requires that the following are installed locally:

It also requires that there is an existing Azure Resource Group into which to place the VNet components.

Usage

Log Into Azure

docker run -it -v $HOME/.azure:/root/.azure mcr.microsoft.com/azure-cli az login

Create the Virtual Network

# set the values below to reflect the resource group and remote storage
export TF_VAR_resource_group_name=
export TF_VAR_storage_account_name=
export TF_VAR_container_name=

# initialise terraform 
terraform init \
  -backend-config "resource_group_name=$TF_VAR_resource_group_name" \
  -backend-config "storage_account_name=$TF_VAR_storage_account_name" \
  -backend-config "container_name=$TF_VAR_container_name"

# create a terraform plan file from the provided variables
# NOTE: the existing Azure resource group will need to be provided at the command-line, or manually added to the tfvars file 
terraform plan -var-file="variables.tfvars" -out tfplan

# apply the plan, creating the Azure VNet resources
terraform apply "tfplan"

Destroy the Virtual Network

terraform destroy -var-file="variables.tfvars"

Licence

License

This project is licenced under the terms of the Apache 2.0 License licence.

Releases

No releases published

Packages

No packages published

Languages