1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. NsgFirewallrule
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.NsgFirewallrule

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    Manages a Network Security Group Rule on IonosCloud.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const exampleDatacenter = new ionoscloud.Datacenter("exampleDatacenter", {location: "de/txl"});
    const exampleNsg = new ionoscloud.Nsg("exampleNsg", {
        description: "Example NSG Description",
        datacenterId: exampleDatacenter.datacenterId,
    });
    const exampleNsgFirewallrule = new ionoscloud.NsgFirewallrule("exampleNsgFirewallrule", {
        nsgId: exampleNsg.nsgId,
        datacenterId: exampleDatacenter.datacenterId,
        protocol: "TCP",
        sourceMac: "00:0a:95:9d:68:15",
        sourceIp: "22.231.113.11",
        targetIp: "22.231.113.75",
        type: "EGRESS",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example_datacenter = ionoscloud.Datacenter("exampleDatacenter", location="de/txl")
    example_nsg = ionoscloud.Nsg("exampleNsg",
        description="Example NSG Description",
        datacenter_id=example_datacenter.datacenter_id)
    example_nsg_firewallrule = ionoscloud.NsgFirewallrule("exampleNsgFirewallrule",
        nsg_id=example_nsg.nsg_id,
        datacenter_id=example_datacenter.datacenter_id,
        protocol="TCP",
        source_mac="00:0a:95:9d:68:15",
        source_ip="22.231.113.11",
        target_ip="22.231.113.75",
        type="EGRESS")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleDatacenter, err := ionoscloud.NewDatacenter(ctx, "exampleDatacenter", &ionoscloud.DatacenterArgs{
    			Location: pulumi.String("de/txl"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleNsg, err := ionoscloud.NewNsg(ctx, "exampleNsg", &ionoscloud.NsgArgs{
    			Description:  pulumi.String("Example NSG Description"),
    			DatacenterId: exampleDatacenter.DatacenterId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ionoscloud.NewNsgFirewallrule(ctx, "exampleNsgFirewallrule", &ionoscloud.NsgFirewallruleArgs{
    			NsgId:        exampleNsg.NsgId,
    			DatacenterId: exampleDatacenter.DatacenterId,
    			Protocol:     pulumi.String("TCP"),
    			SourceMac:    pulumi.String("00:0a:95:9d:68:15"),
    			SourceIp:     pulumi.String("22.231.113.11"),
    			TargetIp:     pulumi.String("22.231.113.75"),
    			Type:         pulumi.String("EGRESS"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDatacenter = new Ionoscloud.Datacenter("exampleDatacenter", new()
        {
            Location = "de/txl",
        });
    
        var exampleNsg = new Ionoscloud.Nsg("exampleNsg", new()
        {
            Description = "Example NSG Description",
            DatacenterId = exampleDatacenter.DatacenterId,
        });
    
        var exampleNsgFirewallrule = new Ionoscloud.NsgFirewallrule("exampleNsgFirewallrule", new()
        {
            NsgId = exampleNsg.NsgId,
            DatacenterId = exampleDatacenter.DatacenterId,
            Protocol = "TCP",
            SourceMac = "00:0a:95:9d:68:15",
            SourceIp = "22.231.113.11",
            TargetIp = "22.231.113.75",
            Type = "EGRESS",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.Datacenter;
    import com.pulumi.ionoscloud.DatacenterArgs;
    import com.pulumi.ionoscloud.Nsg;
    import com.pulumi.ionoscloud.NsgArgs;
    import com.pulumi.ionoscloud.NsgFirewallrule;
    import com.pulumi.ionoscloud.NsgFirewallruleArgs;
    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 exampleDatacenter = new Datacenter("exampleDatacenter", DatacenterArgs.builder()
                .location("de/txl")
                .build());
    
            var exampleNsg = new Nsg("exampleNsg", NsgArgs.builder()
                .description("Example NSG Description")
                .datacenterId(exampleDatacenter.datacenterId())
                .build());
    
            var exampleNsgFirewallrule = new NsgFirewallrule("exampleNsgFirewallrule", NsgFirewallruleArgs.builder()
                .nsgId(exampleNsg.nsgId())
                .datacenterId(exampleDatacenter.datacenterId())
                .protocol("TCP")
                .sourceMac("00:0a:95:9d:68:15")
                .sourceIp("22.231.113.11")
                .targetIp("22.231.113.75")
                .type("EGRESS")
                .build());
    
        }
    }
    
    resources:
      exampleDatacenter:
        type: ionoscloud:Datacenter
        properties:
          location: de/txl
      exampleNsg:
        type: ionoscloud:Nsg
        properties:
          description: Example NSG Description
          datacenterId: ${exampleDatacenter.datacenterId}
      exampleNsgFirewallrule:
        type: ionoscloud:NsgFirewallrule
        properties:
          nsgId: ${exampleNsg.nsgId}
          datacenterId: ${exampleDatacenter.datacenterId}
          protocol: TCP
          sourceMac: 00:0a:95:9d:68:15
          sourceIp: 22.231.113.11
          targetIp: 22.231.113.75
          type: EGRESS
    

    Create NsgFirewallrule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new NsgFirewallrule(name: string, args: NsgFirewallruleArgs, opts?: CustomResourceOptions);
    @overload
    def NsgFirewallrule(resource_name: str,
                        args: NsgFirewallruleArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def NsgFirewallrule(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        nsg_id: Optional[str] = None,
                        protocol: Optional[str] = None,
                        datacenter_id: Optional[str] = None,
                        port_range_end: Optional[float] = None,
                        nsg_firewallrule_id: Optional[str] = None,
                        name: Optional[str] = None,
                        icmp_type: Optional[str] = None,
                        port_range_start: Optional[float] = None,
                        icmp_code: Optional[str] = None,
                        source_ip: Optional[str] = None,
                        source_mac: Optional[str] = None,
                        target_ip: Optional[str] = None,
                        timeouts: Optional[NsgFirewallruleTimeoutsArgs] = None,
                        type: Optional[str] = None)
    func NewNsgFirewallrule(ctx *Context, name string, args NsgFirewallruleArgs, opts ...ResourceOption) (*NsgFirewallrule, error)
    public NsgFirewallrule(string name, NsgFirewallruleArgs args, CustomResourceOptions? opts = null)
    public NsgFirewallrule(String name, NsgFirewallruleArgs args)
    public NsgFirewallrule(String name, NsgFirewallruleArgs args, CustomResourceOptions options)
    
    type: ionoscloud:NsgFirewallrule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args NsgFirewallruleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args NsgFirewallruleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args NsgFirewallruleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NsgFirewallruleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NsgFirewallruleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var nsgFirewallruleResource = new Ionoscloud.NsgFirewallrule("nsgFirewallruleResource", new()
    {
        NsgId = "string",
        Protocol = "string",
        DatacenterId = "string",
        PortRangeEnd = 0,
        NsgFirewallruleId = "string",
        Name = "string",
        IcmpType = "string",
        PortRangeStart = 0,
        IcmpCode = "string",
        SourceIp = "string",
        SourceMac = "string",
        TargetIp = "string",
        Timeouts = new Ionoscloud.Inputs.NsgFirewallruleTimeoutsArgs
        {
            Create = "string",
            Default = "string",
            Delete = "string",
            Update = "string",
        },
        Type = "string",
    });
    
    example, err := ionoscloud.NewNsgFirewallrule(ctx, "nsgFirewallruleResource", &ionoscloud.NsgFirewallruleArgs{
    	NsgId:             pulumi.String("string"),
    	Protocol:          pulumi.String("string"),
    	DatacenterId:      pulumi.String("string"),
    	PortRangeEnd:      pulumi.Float64(0),
    	NsgFirewallruleId: pulumi.String("string"),
    	Name:              pulumi.String("string"),
    	IcmpType:          pulumi.String("string"),
    	PortRangeStart:    pulumi.Float64(0),
    	IcmpCode:          pulumi.String("string"),
    	SourceIp:          pulumi.String("string"),
    	SourceMac:         pulumi.String("string"),
    	TargetIp:          pulumi.String("string"),
    	Timeouts: &ionoscloud.NsgFirewallruleTimeoutsArgs{
    		Create:  pulumi.String("string"),
    		Default: pulumi.String("string"),
    		Delete:  pulumi.String("string"),
    		Update:  pulumi.String("string"),
    	},
    	Type: pulumi.String("string"),
    })
    
    var nsgFirewallruleResource = new NsgFirewallrule("nsgFirewallruleResource", NsgFirewallruleArgs.builder()
        .nsgId("string")
        .protocol("string")
        .datacenterId("string")
        .portRangeEnd(0)
        .nsgFirewallruleId("string")
        .name("string")
        .icmpType("string")
        .portRangeStart(0)
        .icmpCode("string")
        .sourceIp("string")
        .sourceMac("string")
        .targetIp("string")
        .timeouts(NsgFirewallruleTimeoutsArgs.builder()
            .create("string")
            .default_("string")
            .delete("string")
            .update("string")
            .build())
        .type("string")
        .build());
    
    nsg_firewallrule_resource = ionoscloud.NsgFirewallrule("nsgFirewallruleResource",
        nsg_id="string",
        protocol="string",
        datacenter_id="string",
        port_range_end=0,
        nsg_firewallrule_id="string",
        name="string",
        icmp_type="string",
        port_range_start=0,
        icmp_code="string",
        source_ip="string",
        source_mac="string",
        target_ip="string",
        timeouts={
            "create": "string",
            "default": "string",
            "delete": "string",
            "update": "string",
        },
        type="string")
    
    const nsgFirewallruleResource = new ionoscloud.NsgFirewallrule("nsgFirewallruleResource", {
        nsgId: "string",
        protocol: "string",
        datacenterId: "string",
        portRangeEnd: 0,
        nsgFirewallruleId: "string",
        name: "string",
        icmpType: "string",
        portRangeStart: 0,
        icmpCode: "string",
        sourceIp: "string",
        sourceMac: "string",
        targetIp: "string",
        timeouts: {
            create: "string",
            "default": "string",
            "delete": "string",
            update: "string",
        },
        type: "string",
    });
    
    type: ionoscloud:NsgFirewallrule
    properties:
        datacenterId: string
        icmpCode: string
        icmpType: string
        name: string
        nsgFirewallruleId: string
        nsgId: string
        portRangeEnd: 0
        portRangeStart: 0
        protocol: string
        sourceIp: string
        sourceMac: string
        targetIp: string
        timeouts:
            create: string
            default: string
            delete: string
            update: string
        type: string
    

    NsgFirewallrule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The NsgFirewallrule resource accepts the following input properties:

    DatacenterId string
    [string] The ID of a Virtual Data Center.
    NsgId string
    [string] The ID of a Network Security Group.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    IcmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    Name string
    [string] The name of the firewall rule.
    NsgFirewallruleId string
    PortRangeEnd double
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    PortRangeStart double
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    SourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    SourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    TargetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    Timeouts NsgFirewallruleTimeouts
    Type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    DatacenterId string
    [string] The ID of a Virtual Data Center.
    NsgId string
    [string] The ID of a Network Security Group.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    IcmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    Name string
    [string] The name of the firewall rule.
    NsgFirewallruleId string
    PortRangeEnd float64
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    PortRangeStart float64
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    SourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    SourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    TargetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    Timeouts NsgFirewallruleTimeoutsArgs
    Type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The ID of a Virtual Data Center.
    nsgId String
    [string] The ID of a Network Security Group.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    icmpCode String
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name String
    [string] The name of the firewall rule.
    nsgFirewallruleId String
    portRangeEnd Double
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart Double
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    sourceIp String
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac String
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp String
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeouts
    type String
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId string
    [string] The ID of a Virtual Data Center.
    nsgId string
    [string] The ID of a Network Security Group.
    protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    icmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name string
    [string] The name of the firewall rule.
    nsgFirewallruleId string
    portRangeEnd number
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart number
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    sourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeouts
    type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenter_id str
    [string] The ID of a Virtual Data Center.
    nsg_id str
    [string] The ID of a Network Security Group.
    protocol str
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    icmp_code str
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmp_type str
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name str
    [string] The name of the firewall rule.
    nsg_firewallrule_id str
    port_range_end float
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    port_range_start float
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    source_ip str
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    source_mac str
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    target_ip str
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeoutsArgs
    type str
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The ID of a Virtual Data Center.
    nsgId String
    [string] The ID of a Network Security Group.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    icmpCode String
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name String
    [string] The name of the firewall rule.
    nsgFirewallruleId String
    portRangeEnd Number
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart Number
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    sourceIp String
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac String
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp String
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts Property Map
    type String
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NsgFirewallrule resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing NsgFirewallrule Resource

    Get an existing NsgFirewallrule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: NsgFirewallruleState, opts?: CustomResourceOptions): NsgFirewallrule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            datacenter_id: Optional[str] = None,
            icmp_code: Optional[str] = None,
            icmp_type: Optional[str] = None,
            name: Optional[str] = None,
            nsg_firewallrule_id: Optional[str] = None,
            nsg_id: Optional[str] = None,
            port_range_end: Optional[float] = None,
            port_range_start: Optional[float] = None,
            protocol: Optional[str] = None,
            source_ip: Optional[str] = None,
            source_mac: Optional[str] = None,
            target_ip: Optional[str] = None,
            timeouts: Optional[NsgFirewallruleTimeoutsArgs] = None,
            type: Optional[str] = None) -> NsgFirewallrule
    func GetNsgFirewallrule(ctx *Context, name string, id IDInput, state *NsgFirewallruleState, opts ...ResourceOption) (*NsgFirewallrule, error)
    public static NsgFirewallrule Get(string name, Input<string> id, NsgFirewallruleState? state, CustomResourceOptions? opts = null)
    public static NsgFirewallrule get(String name, Output<String> id, NsgFirewallruleState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:NsgFirewallrule    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DatacenterId string
    [string] The ID of a Virtual Data Center.
    IcmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    Name string
    [string] The name of the firewall rule.
    NsgFirewallruleId string
    NsgId string
    [string] The ID of a Network Security Group.
    PortRangeEnd double
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    PortRangeStart double
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    SourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    SourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    TargetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    Timeouts NsgFirewallruleTimeouts
    Type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    DatacenterId string
    [string] The ID of a Virtual Data Center.
    IcmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    Name string
    [string] The name of the firewall rule.
    NsgFirewallruleId string
    NsgId string
    [string] The ID of a Network Security Group.
    PortRangeEnd float64
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    PortRangeStart float64
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    SourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    SourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    TargetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    Timeouts NsgFirewallruleTimeoutsArgs
    Type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The ID of a Virtual Data Center.
    icmpCode String
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name String
    [string] The name of the firewall rule.
    nsgFirewallruleId String
    nsgId String
    [string] The ID of a Network Security Group.
    portRangeEnd Double
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart Double
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    sourceIp String
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac String
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp String
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeouts
    type String
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId string
    [string] The ID of a Virtual Data Center.
    icmpCode string
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType string
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name string
    [string] The name of the firewall rule.
    nsgFirewallruleId string
    nsgId string
    [string] The ID of a Network Security Group.
    portRangeEnd number
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart number
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    sourceIp string
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac string
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp string
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeouts
    type string
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenter_id str
    [string] The ID of a Virtual Data Center.
    icmp_code str
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmp_type str
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name str
    [string] The name of the firewall rule.
    nsg_firewallrule_id str
    nsg_id str
    [string] The ID of a Network Security Group.
    port_range_end float
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    port_range_start float
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    protocol str
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    source_ip str
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    source_mac str
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    target_ip str
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts NsgFirewallruleTimeoutsArgs
    type str
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The ID of a Virtual Data Center.
    icmpCode String
    [int] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    [string] Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes.
    name String
    [string] The name of the firewall rule.
    nsgFirewallruleId String
    nsgId String
    [string] The ID of a Network Security Group.
    portRangeEnd Number
    [int] Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    portRangeStart Number
    [int] Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    sourceIp String
    (computed)[string] Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs.
    sourceMac String
    [string] Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address. Valid format: aa:bb:cc:dd:ee:ff.
    targetIp String
    (Computed)[string] In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. Value null allows all target IPs.
    timeouts Property Map
    type String
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.

    Supporting Types

    NsgFirewallruleTimeouts, NsgFirewallruleTimeoutsArgs

    Create string
    Default string
    Delete string
    Update string
    Create string
    Default string
    Delete string
    Update string
    create String
    default_ String
    delete String
    update String
    create string
    default string
    delete string
    update string
    create String
    default String
    delete String
    update String

    Import

    Resource Server can be imported using the resource id, nsg id and datacenter id, e.g.

    $ pulumi import ionoscloud:index/nsgFirewallrule:NsgFirewallrule mynsg datacenter uuid/nsg uuid/firewall uuid
    

    Or by using an import block.

    hcl

    import {

    to = ionoscloud_nsg.imported

    id = “datacenter uuid/nsg uuid/firewall uuid”

    }

    resource “ionoscloud_nsg_firewallrule” “imported” {

    nsg_id = ionoscloud_nsg.example.id

    datacenter_id = ionoscloud_datacenter.example.id

    protocol = protocol of the imported rule

    }

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud