NetworkSecurityGroupArgs

data class NetworkSecurityGroupArgs(val location: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val securityRules: Output<List<NetworkSecurityGroupSecurityRuleArgs>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<NetworkSecurityGroupArgs>

Manages a network security group that contains a list of network security rules. Network security groups enable inbound or outbound traffic to be enabled or denied.

NOTE on Network Security Groups and Network Security Rules: This provider currently provides both a standalone Network Security Rule resource, and allows for Network Security Rules to be defined in-line within the Network Security Group resource. At this time you cannot use a Network Security Group with in-line Network Security Rules in conjunction with any Network Security Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkSecurityGroup;
import com.pulumi.azure.network.NetworkSecurityGroupArgs;
import com.pulumi.azure.network.inputs.NetworkSecurityGroupSecurityRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.securityRules(NetworkSecurityGroupSecurityRuleArgs.builder()
.name("test123")
.priority(100)
.direction("Inbound")
.access("Allow")
.protocol("Tcp")
.sourcePortRange("*")
.destinationPortRange("*")
.sourceAddressPrefix("*")
.destinationAddressPrefix("*")
.build())
.tags(Map.of("environment", "Production"))
.build());
}
}

Import

Network Security Groups can be imported using the resource id, e.g.

$ pulumi import azure:network/networkSecurityGroup:NetworkSecurityGroup group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup

Constructors

Link copied to clipboard
fun NetworkSecurityGroupArgs(location: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, securityRules: Output<List<NetworkSecurityGroupSecurityRuleArgs>>? = null, tags: Output<Map<String, String>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): NetworkSecurityGroupArgs

Properties

Link copied to clipboard
val location: Output<String>? = null

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

The name of the security rule.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

Link copied to clipboard

A list of objects representing security rules, as defined below.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.