Virtual Network Creation Using Terraform
Creating a virtual network with Terraform
Now that you’ve gone through the main components of Terraform, how to get up and running, and the concepts of what each Terraform configuration is, let’s take that knowledge and put it to action by creating a Terraform module!
In this chapter project you will create a virtual network (vNet) using the following Terraform concepts:
terraform.tfvarsvariable definition file
Once the configuration is created, you will then initialize, validate, and finally deploy the Azure vNet.
Note: All Terraform configuration files need to be in a single directory.
Building the variable configuration file
Although it’s tempting to begin building the main configuration file first, it’s usually best to create the variable configuration file (if you have one) first. You’ll typically want to build this file first to know how the environment will be defined.
In VS Code, create a new file and save it as
variables.tfconfiguration file and copy/paste the below content.