SecurityRuleArgs

data class SecurityRuleArgs(val access: Output<Either<String, SecurityRuleAccess>>? = null, val description: Output<String>? = null, val destinationAddressPrefixes: Output<List<String>>? = null, val destinationPortRanges: Output<List<String>>? = null, val direction: Output<Either<String, SecurityRuleDirection>>? = null, val extendedLocation: Output<ExtendedLocationArgs>? = null, val networkSecurityGroupName: Output<String>? = null, val priority: Output<Int>? = null, val protocol: Output<Either<String, SecurityRuleProtocol>>? = null, val resourceGroupName: Output<String>? = null, val securityRuleName: Output<String>? = null, val sourceAddressPrefixes: Output<List<String>>? = null, val sourcePortRanges: Output<List<String>>? = null) : ConvertibleToJava<SecurityRuleArgs>

Security Rule resource. Uses Azure REST API version 2025-02-01-preview. In version 2.x of the Azure Native provider, it used API version 2024-02-01-preview. Other available API versions: 2024-02-01-preview, 2024-05-01-preview, 2024-07-15-preview, 2024-08-01-preview, 2024-10-01-preview, 2025-04-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native azurestackhci [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

SecurityRulesCreateOrUpdate

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var securityRule = new AzureNative.AzureStackHCI.SecurityRule("securityRule", new()
{
Access = AzureNative.AzureStackHCI.SecurityRuleAccess.Allow,
DestinationAddressPrefixes = new[]
{
"*",
},
DestinationPortRanges = new[]
{
"80",
},
Direction = AzureNative.AzureStackHCI.SecurityRuleDirection.Inbound,
ExtendedLocation = new AzureNative.AzureStackHCI.Inputs.ExtendedLocationArgs
{
Name = "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location",
Type = AzureNative.AzureStackHCI.ExtendedLocationTypes.CustomLocation,
},
NetworkSecurityGroupName = "testnsg",
Priority = 130,
Protocol = AzureNative.AzureStackHCI.SecurityRuleProtocol.Asterisk,
ResourceGroupName = "testrg",
SecurityRuleName = "rule1",
SourceAddressPrefixes = new[]
{
"*",
},
SourcePortRanges = new[]
{
"*",
},
});
});
package main
import (
azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := azurestackhci.NewSecurityRule(ctx, "securityRule", &azurestackhci.SecurityRuleArgs{
Access: pulumi.String(azurestackhci.SecurityRuleAccessAllow),
DestinationAddressPrefixes: pulumi.StringArray{
pulumi.String("*"),
},
DestinationPortRanges: pulumi.StringArray{
pulumi.String("80"),
},
Direction: pulumi.String(azurestackhci.SecurityRuleDirectionInbound),
ExtendedLocation: &azurestackhci.ExtendedLocationArgs{
Name: pulumi.String("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"),
Type: pulumi.String(azurestackhci.ExtendedLocationTypesCustomLocation),
},
NetworkSecurityGroupName: pulumi.String("testnsg"),
Priority: pulumi.Int(130),
Protocol: pulumi.String(azurestackhci.SecurityRuleProtocolAsterisk),
ResourceGroupName: pulumi.String("testrg"),
SecurityRuleName: pulumi.String("rule1"),
SourceAddressPrefixes: pulumi.StringArray{
pulumi.String("*"),
},
SourcePortRanges: pulumi.StringArray{
pulumi.String("*"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.azurestackhci.SecurityRule;
import com.pulumi.azurenative.azurestackhci.SecurityRuleArgs;
import com.pulumi.azurenative.azurestackhci.inputs.ExtendedLocationArgs;
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 securityRule = new SecurityRule("securityRule", SecurityRuleArgs.builder()
.access("Allow")
.destinationAddressPrefixes("*")
.destinationPortRanges("80")
.direction("Inbound")
.extendedLocation(ExtendedLocationArgs.builder()
.name("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location")
.type("CustomLocation")
.build())
.networkSecurityGroupName("testnsg")
.priority(130)
.protocol("*")
.resourceGroupName("testrg")
.securityRuleName("rule1")
.sourceAddressPrefixes("*")
.sourcePortRanges("*")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:azurestackhci:SecurityRule rule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}

Constructors

Link copied to clipboard
constructor(access: Output<Either<String, SecurityRuleAccess>>? = null, description: Output<String>? = null, destinationAddressPrefixes: Output<List<String>>? = null, destinationPortRanges: Output<List<String>>? = null, direction: Output<Either<String, SecurityRuleDirection>>? = null, extendedLocation: Output<ExtendedLocationArgs>? = null, networkSecurityGroupName: Output<String>? = null, priority: Output<Int>? = null, protocol: Output<Either<String, SecurityRuleProtocol>>? = null, resourceGroupName: Output<String>? = null, securityRuleName: Output<String>? = null, sourceAddressPrefixes: Output<List<String>>? = null, sourcePortRanges: Output<List<String>>? = null)

Properties

Link copied to clipboard
val access: Output<Either<String, SecurityRuleAccess>>? = null

The network traffic is allowed or denied.

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

A description for this rule. Restricted to 140 chars.

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

The destination address prefixes. CIDR or destination IP ranges.

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

The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Link copied to clipboard
val direction: Output<Either<String, SecurityRuleDirection>>? = null

The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Link copied to clipboard

The extendedLocation of the resource.

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

Name of the network security group

Link copied to clipboard
val priority: Output<Int>? = null

The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.

Link copied to clipboard
val protocol: Output<Either<String, SecurityRuleProtocol>>? = null

Network protocol this rule applies to.

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

The name of the resource group. The name is case insensitive.

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

Name of the security rule.

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

The CIDR or source IP ranges.

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

The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Functions

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