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 >= 3.40.0

Providers

Name Version
azurerm >= 3.40.0

Modules

No modules.

Resources

Name Type
azurerm_network_security_group.this resource

Inputs

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

Outputs

Name Description
id The ID of the Network Security Group

License

Apache 2 Licensed. For more information please see LICENSE