Skip to content

Data Source: azurermNetworkSecurityGroup

Use this data source to access information about an existing Network Security Group.

Example Usage

import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermNetworkSecurityGroupExample =
  new azurerm.dataAzurermNetworkSecurityGroup.DataAzurermNetworkSecurityGroup(
    this,
    "example",
    {
      name: "example",
      resource_group_name: "${azurerm_resource_group.example.name}",
    }
  );
new cdktf.TerraformOutput(this, "location", {
  value: dataAzurermNetworkSecurityGroupExample.location,
});

Argument Reference

  • name - Specifies the Name of the Network Security Group.
  • resourceGroupName - Specifies the Name of the Resource Group within which the Network Security Group exists

Attributes Reference

  • id - The ID of the Network Security Group.

  • location - The supported Azure location where the resource exists.

  • securityRule - One or more securityRule blocks as defined below.

  • tags - A mapping of tags assigned to the resource.

The securityRule block supports:

  • name - The name of the security rule.

  • description - The description for this rule.

  • protocol - The network protocol this rule applies to.

  • sourcePortRange - The Source Port or Range.

  • destinationPortRange - The Destination Port or Range.

  • sourceAddressPrefix - CIDR or source IP range or * to match any IP.

  • sourceAddressPrefixes - A list of CIDRs or source IP ranges.

  • destinationAddressPrefix - CIDR or destination IP range or * to match any IP.

  • destinationAddressPrefixes - A list of CIDRs or destination IP ranges.

  • sourceApplicationSecurityGroupIds - A List of source Application Security Group IDs

  • destinationApplicationSecurityGroupIds - A List of destination Application Security Group IDs

  • access - Is network traffic is allowed or denied?

  • priority - The priority of the rule

  • direction - The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • read - (Defaults to 5 minutes) Used when retrieving the Network Security Group.