Skip to content

Latest commit

 

History

History
212 lines (161 loc) · 9.14 KB

README.md

File metadata and controls

212 lines (161 loc) · 9.14 KB

Terraform AZURE SUBNET

Terraform module to create subnet resource on AZURE.

Terraform Licence


Prerequisites

This module has a few dependencies:

IMPORTANT: Since the master branch used in source varies based on new modifications, we suggest that you use the release versions here.

Simple Example

Here is an example of how you can use this module in your inventory structure:

Default Subnet

  module "subnet" {
    source               = "clouddrove/subnet/azure"
    name                 = "app"
    environment          = "test"
    label_order          = ["name", "environment"]
    resource_group_name  = module.resource_group.resource_group_name
    location             = module.resource_group.resource_group_location
    virtual_network_name = join("", module.vnet.vnet_name)

    #subnet
    subnet_names        = ["subnet1", "subnet2"]
    subnet_prefixes     = ["10.0.1.0/24", "10.0.2.0/24"]

    # route_table
    routes = [
      {
        name           = "rt-test"
        address_prefix = "0.0.0.0/0"
        next_hop_type  = "Internet"
      }
    ]
  }

Name_Specific Subnet

  module "name_specific_subnet" {
    source               = "clouddrove/subnet/azure"
    name                 = "app"
    environment          = "test"
    label_order          = ["name", "environment"]
    resource_group_name  = module.resource_group.resource_group_name
    location             = module.resource_group.resource_group_location
    virtual_network_name = join("", module.vnet.vnet_name)

    #subnet
    specific_name_subnet  = true
    specific_subnet_names = "SpecificSubnet"
    subnet_prefixes       = ["10.0.1.0/24"]

    # route_table
    routes = [
      {
        name           = "rt-test"
        address_prefix = "0.0.0.0/0"
        next_hop_type  = "Internet"
      }
    ]
  }

Nat_Gateway Subnet

  module "name_specific_subnet" {
    source               = "clouddrove/subnet/azure"
    name                 = "app"
    environment          = "test"
    label_order          = ["name", "environment"]
    resource_group_name  = module.resource_group.resource_group_name
    location             = module.resource_group.resource_group_location
    virtual_network_name = join("", module.vnet.vnet_name)

    #subnet
    create_nat_gateway  = true
    subnet_names        = ["subnet1", "subnet2"]
    subnet_prefixes     = ["10.0.1.0/24", "10.0.2.0/24"]

    # route_table
    routes = [
      {
        name           = "rt-test"
        address_prefix = "0.0.0.0/0"
        next_hop_type  = "Internet"
      }
    ]
  }

Inputs

Name Description Type Default Required
attributes Additional attributes (e.g. 1). list(any) [] no
create_nat_gateway Flag to control nat gateway creation. bool false no
delegation Configuration delegations on subnet
object({
name = object({
name = string,
actions = list(string)
})
})
map(list(any)) {} no
delimiter Delimiter to be used between organization, environment, name and attributes. string "-" no
disable_bgp_route_propagation Boolean flag which controls propagation of routes learned by BGP on that route table. bool false no
enable Flag to control the module creation bool true no
enable_route_table Flag to control route table creation. bool true no
environment Environment (e.g. prod, dev, staging). string "" no
label_order Label order, e.g. name,application. list(any)
[
"name",
"environment"
]
no
location The location/region where the virtual network is created. Changing this forces a new resource to be created. string "" no
managedby ManagedBy, eg 'CloudDrove'. string "[email protected]" no
name Name (e.g. app or cluster). string "" no
nat_gateway_idle_timeout Idle timeout configuration in minutes for Nat Gateway number 4 no
public_ip_zones Public ip Zones to configure. list(string) null no
repository Terraform current module repo string "https://github.com/clouddrove/terraform-azure-subnet.git" no
resource_group_name The name of an existing resource group to be imported. string "" no
route_table_name The name of the route table. string null no
routes List of objects that represent the configuration of each route. list(map(string)) [] no
service_endpoints A map with key (string) subnet name, value (list(string)) to indicate enabled service endpoints on the subnet. Default value is []. list(string) [] no
specific_name_subnet n/a bool false no
specific_subnet_names A list of subnets inside the vNet. string "" no
subnet_enforce_private_link_endpoint_network_policies A map with key (string) subnet name, value (bool) true or false to indicate enable or disable network policies for the private link endpoint on the subnet. Default value is false. map(bool) {} no
subnet_enforce_private_link_service_network_policies A map with key (string) subnet name, value (bool) true or false to indicate enable or disable network policies for the private link endpoint on the subnet. Default value is false. bool true no
subnet_names A list of public subnets inside the vNet. list(string) [] no
subnet_prefixes The address prefix to use for the subnet. list(string) [] no
tags Additional tags (e.g. map(BusinessUnit,XYZ). map(any) {} no
virtual_network_name The name of the virtual network in which the subnet is created in string "" no

Outputs

Name Description
default_subnet_address_prefixes The address prefixes for the subnet.
default_subnet_id The subnet ID.
default_subnet_name The name of the subnet.
nat_gateway_id The ID of the NAT Gateway.
public_ip_address The IP address value that was allocated.
public_ip_id The ID of this Public IP.
route_table_associated_subnets The collection of Subnets associated with this route table.
route_table_id The Route Table ID.
specific_subnet_address_prefixes The address prefixes for the subnet.
specific_subnet_id The subnet ID.
specific_subnet_name The name of the subnet.

Feedback

If you come accross a bug or have any feedback, please log it in our issue tracker, or feel free to drop us an email at [email protected].

If you have found it worth your time, go ahead and give us a ★ on our GitHub!

About us

At CloudDrove, we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

We are The Cloud Experts!


We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.