Skip to content

data-platform-hq/terraform-azurerm-network-security-group

Repository files navigation

Azure Network Security Group Terraform module

Terraform module for creation Azure Network security group

Usage

This module provides an ability to deploy Azure Network security group, Below is an example on how to create nsg

locals {
    security_rules = [{
        name                       = "workspaces_UseOnly_databricks-worker-to-worker-inbound"
        description                = "Required for worker nodes communication within a cluster."
        priority                   = 100
        direction                  = "Inbound"
        access                     = "Allow"
        protocol                   = "*"
        source_port_range          = "*"
        destination_port_range     = "*"
        source_address_prefix      = "VirtualNetwork"
        destination_address_prefix = "VirtualNetwork"
    }]
}

module "network_security_group" {
  source  = "data-platform-hq/terraform-azurerm-network-security-group

  nsg_name        = "example-name"
  location        = "eastus"
  resource_group  = "example-rg"
  security_rules  = local.security_rules
  tags = {
    environment = "example"
  }
}

Requirements

Name Version
terraform >= 1.0.0
azurerm >= 4.0.1

Providers

Name Version
azurerm >= 4.0.1

Modules

No modules.

Resources

Name Type
azurerm_network_security_group.this resource

Inputs

Name Description Type Default Required
location Specifies the supported Azure location where the resource exists string n/a yes
nsg_name Network Security Group name string n/a yes
resource_group The name of the resource group in which resources is created string n/a yes
security_rules List of objects representing security rules
list(object({
name = string
priority = number
direction = string
access = string
protocol = string
description = optional(string, null)
source_port_range = optional(string, null)
source_port_ranges = optional(list(string), [])
destination_port_range = optional(string, null)
destination_port_ranges = optional(list(string), [])
source_address_prefix = optional(string, null)
source_address_prefixes = optional(list(string), [])
destination_address_prefix = optional(string, null)
destination_address_prefixes = optional(list(string), [])
}))
[] no
tags A mapping of tags to assign to the resource map(string) {} no

Outputs

Name Description
id The ID of the Network Security Group

License

Apache 2 Licensed. For more information please see LICENSE