1. Packages
  2. Ionoscloud
  3. API Docs
  4. nsg
  5. Firewall
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

ionoscloud.nsg.Firewall

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

    Manages a Network Security Group Rule on IonosCloud.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    
    const example = new ionoscloud.compute.Datacenter("example", {
        name: "Datacenter NSG Example",
        location: "de/txl",
    });
    const exampleNsg = new ionoscloud.nsg.Nsg("example", {
        name: "Example NSG",
        description: "Example NSG Description",
        datacenterId: example.id,
    });
    const exampleFirewall = new ionoscloud.nsg.Firewall("example", {
        nsgId: exampleNsg.id,
        datacenterId: example.id,
        protocol: "TCP",
        name: "SG Rule",
        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 = ionoscloud.compute.Datacenter("example",
        name="Datacenter NSG Example",
        location="de/txl")
    example_nsg = ionoscloud.nsg.Nsg("example",
        name="Example NSG",
        description="Example NSG Description",
        datacenter_id=example.id)
    example_firewall = ionoscloud.nsg.Firewall("example",
        nsg_id=example_nsg.id,
        datacenter_id=example.id,
        protocol="TCP",
        name="SG Rule",
        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/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/compute"
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/nsg"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := compute.NewDatacenter(ctx, "example", &compute.DatacenterArgs{
    			Name:     pulumi.String("Datacenter NSG Example"),
    			Location: pulumi.String("de/txl"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleNsg, err := nsg.NewNsg(ctx, "example", &nsg.NsgArgs{
    			Name:         pulumi.String("Example NSG"),
    			Description:  pulumi.String("Example NSG Description"),
    			DatacenterId: example.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = nsg.NewFirewall(ctx, "example", &nsg.FirewallArgs{
    			NsgId:        exampleNsg.ID(),
    			DatacenterId: example.ID(),
    			Protocol:     pulumi.String("TCP"),
    			Name:         pulumi.String("SG Rule"),
    			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 = Ionoscloud.Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.Compute.Datacenter("example", new()
        {
            Name = "Datacenter NSG Example",
            Location = "de/txl",
        });
    
        var exampleNsg = new Ionoscloud.Nsg.Nsg("example", new()
        {
            Name = "Example NSG",
            Description = "Example NSG Description",
            DatacenterId = example.Id,
        });
    
        var exampleFirewall = new Ionoscloud.Nsg.Firewall("example", new()
        {
            NsgId = exampleNsg.Id,
            DatacenterId = example.Id,
            Protocol = "TCP",
            Name = "SG Rule",
            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.compute.Datacenter;
    import com.pulumi.ionoscloud.compute.DatacenterArgs;
    import com.pulumi.ionoscloud.nsg.Nsg;
    import com.pulumi.ionoscloud.nsg.NsgArgs;
    import com.pulumi.ionoscloud.nsg.Firewall;
    import com.pulumi.ionoscloud.nsg.FirewallArgs;
    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 example = new Datacenter("example", DatacenterArgs.builder()
                .name("Datacenter NSG Example")
                .location("de/txl")
                .build());
    
            var exampleNsg = new Nsg("exampleNsg", NsgArgs.builder()
                .name("Example NSG")
                .description("Example NSG Description")
                .datacenterId(example.id())
                .build());
    
            var exampleFirewall = new Firewall("exampleFirewall", FirewallArgs.builder()
                .nsgId(exampleNsg.id())
                .datacenterId(example.id())
                .protocol("TCP")
                .name("SG Rule")
                .sourceMac("00:0a:95:9d:68:15")
                .sourceIp("22.231.113.11")
                .targetIp("22.231.113.75")
                .type("EGRESS")
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:compute:Datacenter
        properties:
          name: Datacenter NSG Example
          location: de/txl
      exampleNsg:
        type: ionoscloud:nsg:Nsg
        name: example
        properties:
          name: Example NSG
          description: Example NSG Description
          datacenterId: ${example.id}
      exampleFirewall:
        type: ionoscloud:nsg:Firewall
        name: example
        properties:
          nsgId: ${exampleNsg.id}
          datacenterId: ${example.id}
          protocol: TCP
          name: SG Rule
          sourceMac: 00:0a:95:9d:68:15
          sourceIp: 22.231.113.11
          targetIp: 22.231.113.75
          type: EGRESS
    

    Create Firewall Resource

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

    Constructor syntax

    new Firewall(name: string, args: FirewallArgs, opts?: CustomResourceOptions);
    @overload
    def Firewall(resource_name: str,
                 args: FirewallArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Firewall(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 datacenter_id: Optional[str] = None,
                 nsg_id: Optional[str] = None,
                 protocol: Optional[str] = None,
                 icmp_code: Optional[str] = None,
                 icmp_type: Optional[str] = None,
                 name: Optional[str] = None,
                 port_range_end: Optional[int] = None,
                 port_range_start: Optional[int] = None,
                 source_ip: Optional[str] = None,
                 source_mac: Optional[str] = None,
                 target_ip: Optional[str] = None,
                 type: Optional[str] = None)
    func NewFirewall(ctx *Context, name string, args FirewallArgs, opts ...ResourceOption) (*Firewall, error)
    public Firewall(string name, FirewallArgs args, CustomResourceOptions? opts = null)
    public Firewall(String name, FirewallArgs args)
    public Firewall(String name, FirewallArgs args, CustomResourceOptions options)
    
    type: ionoscloud:nsg:Firewall
    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 FirewallArgs
    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 FirewallArgs
    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 FirewallArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FirewallArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FirewallArgs
    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 ionoscloudFirewallResource = new Ionoscloud.Nsg.Firewall("ionoscloudFirewallResource", new()
    {
        DatacenterId = "string",
        NsgId = "string",
        Protocol = "string",
        IcmpCode = "string",
        IcmpType = "string",
        Name = "string",
        PortRangeEnd = 0,
        PortRangeStart = 0,
        SourceIp = "string",
        SourceMac = "string",
        TargetIp = "string",
        Type = "string",
    });
    
    example, err := nsg.NewFirewall(ctx, "ionoscloudFirewallResource", &nsg.FirewallArgs{
    	DatacenterId:   pulumi.String("string"),
    	NsgId:          pulumi.String("string"),
    	Protocol:       pulumi.String("string"),
    	IcmpCode:       pulumi.String("string"),
    	IcmpType:       pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	PortRangeEnd:   pulumi.Int(0),
    	PortRangeStart: pulumi.Int(0),
    	SourceIp:       pulumi.String("string"),
    	SourceMac:      pulumi.String("string"),
    	TargetIp:       pulumi.String("string"),
    	Type:           pulumi.String("string"),
    })
    
    var ionoscloudFirewallResource = new com.ionoscloud.pulumi.ionoscloud.nsg.Firewall("ionoscloudFirewallResource", com.ionoscloud.pulumi.ionoscloud.nsg.FirewallArgs.builder()
        .datacenterId("string")
        .nsgId("string")
        .protocol("string")
        .icmpCode("string")
        .icmpType("string")
        .name("string")
        .portRangeEnd(0)
        .portRangeStart(0)
        .sourceIp("string")
        .sourceMac("string")
        .targetIp("string")
        .type("string")
        .build());
    
    ionoscloud_firewall_resource = ionoscloud.nsg.Firewall("ionoscloudFirewallResource",
        datacenter_id="string",
        nsg_id="string",
        protocol="string",
        icmp_code="string",
        icmp_type="string",
        name="string",
        port_range_end=0,
        port_range_start=0,
        source_ip="string",
        source_mac="string",
        target_ip="string",
        type="string")
    
    const ionoscloudFirewallResource = new ionoscloud.nsg.Firewall("ionoscloudFirewallResource", {
        datacenterId: "string",
        nsgId: "string",
        protocol: "string",
        icmpCode: "string",
        icmpType: "string",
        name: "string",
        portRangeEnd: 0,
        portRangeStart: 0,
        sourceIp: "string",
        sourceMac: "string",
        targetIp: "string",
        type: "string",
    });
    
    type: ionoscloud:nsg:Firewall
    properties:
        datacenterId: string
        icmpCode: string
        icmpType: string
        name: string
        nsgId: string
        portRangeEnd: 0
        portRangeStart: 0
        protocol: string
        sourceIp: string
        sourceMac: string
        targetIp: string
        type: string
    

    Firewall 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 Firewall 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.
    PortRangeEnd int
    [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 int
    [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.
    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.
    PortRangeEnd int
    [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 int
    [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.
    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.
    portRangeEnd Integer
    [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 Integer
    [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.
    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.
    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.
    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.
    port_range_end int
    [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 int
    [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.
    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.
    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.
    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 Firewall 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 Firewall Resource

    Get an existing Firewall 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?: FirewallState, opts?: CustomResourceOptions): Firewall
    @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_id: Optional[str] = None,
            port_range_end: Optional[int] = None,
            port_range_start: Optional[int] = None,
            protocol: Optional[str] = None,
            source_ip: Optional[str] = None,
            source_mac: Optional[str] = None,
            target_ip: Optional[str] = None,
            type: Optional[str] = None) -> Firewall
    func GetFirewall(ctx *Context, name string, id IDInput, state *FirewallState, opts ...ResourceOption) (*Firewall, error)
    public static Firewall Get(string name, Input<string> id, FirewallState? state, CustomResourceOptions? opts = null)
    public static Firewall get(String name, Output<String> id, FirewallState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:nsg:Firewall    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.
    NsgId string
    [string] The ID of a Network Security Group.
    PortRangeEnd int
    [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 int
    [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.
    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.
    NsgId string
    [string] The ID of a Network Security Group.
    PortRangeEnd int
    [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 int
    [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.
    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.
    nsgId String
    [string] The ID of a Network Security Group.
    portRangeEnd Integer
    [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 Integer
    [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.
    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.
    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.
    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_id str
    [string] The ID of a Network Security Group.
    port_range_end int
    [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 int
    [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.
    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.
    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.
    type String
    (Computed)[string] The type of firewall rule. If is not specified, it will take the default value INGRESS.

    Import

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

    $ pulumi import ionoscloud:nsg/firewall:Firewall 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/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud