Terraform: 101-loadbalancer-with-nat-rule


Kiran Patnayakuni   |   Co-authors:  Anusha DokulaVeeresh Setty

Azure SQL Database

Description

This is a conversion of ARM template 101-loadbalancer-with-nat-rule  from the repository azure\azure-quickstart-templates  to Terraform configuration.

This configuration allows you to create a Load Balancer, Public IP address for the Load balancer, Virtual Network, Network Interface in the Virtual Network & a NAT Rule in the Load Balancer that is used by the Network Interface, and it will deploy following the resources…

Note:

If the specified resource group is already exist then the script will not continue with the deployment. If you want to deploy the resources to the existing resource group, then import the resource group to state before deployment.

Syntax

# To initialize the configuration directory
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform init 

# To check the execution plan
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform plan

# To deploy the configuration
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform apply

Example

# Initialize
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform init 

# Plan
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform plan

# Apply
PS C:\Terraform\101-loadbalancer-with-nat-rule> terraform apply 

Output

azurerm_resource_group.arg-01: Creating...
azurerm_resource_group.arg-01: Creation complete after 1s
azurerm_virtual_network.avn-01: Creating...
azurerm_public_ip.apip-01: Creating...

<--- output truncated --->

azurerm_network_interface_nat_rule_association.anna-01: Creation complete after 1s 

Apply complete! Resources: 10 added, 0 changed, 0 destroyed.

Code

    View the code in GitHub  
Last modified: 21 August 2020

Share it on     |   |   |   | 
comments powered by Disqus