1. Packages
  2. Ionoscloud
  3. API Docs
  4. compute
  5. Firewall
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.compute.Firewall

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

    Manages a set of Firewall Rules on IonosCloud.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    import * as random from "@pulumi/random";
    
    const example = new ionoscloud.compute.Datacenter("example", {
        name: "Datacenter Example",
        location: "us/las",
        description: "Datacenter Description",
        secAuthProtection: false,
    });
    const exampleIPBlock = new ionoscloud.compute.IPBlock("example", {
        location: example.location,
        size: 2,
        name: "IP Block Example",
    });
    const serverImagePassword = new random.index.Password("server_image_password", {
        length: 16,
        special: false,
    });
    const exampleServer = new ionoscloud.compute.Server("example", {
        name: "Server Example",
        datacenterId: example.id,
        cores: 1,
        ram: 1024,
        availabilityZone: "ZONE_1",
        cpuFamily: "INTEL_XEON",
        imageName: "Ubuntu-20.04",
        imagePassword: serverImagePassword.result,
        volume: {
            name: "system",
            size: 14,
            diskType: "SSD",
        },
        nic: {
            lan: 1,
            dhcp: true,
            firewallActive: true,
        },
    });
    const exampleNic = new ionoscloud.compute.Nic("example", {
        datacenterId: example.id,
        serverId: exampleServer.id,
        lan: 2,
        dhcp: true,
        firewallActive: true,
        name: "Nic Example",
    });
    const exampleFirewall = new ionoscloud.compute.Firewall("example", {
        datacenterId: example.id,
        serverId: exampleServer.id,
        nicId: exampleNic.id,
        protocol: "ICMP",
        name: "Firewall Example",
        sourceMac: "00:0a:95:9d:68:16",
        sourceIp: exampleIPBlock.ips[0],
        targetIp: exampleIPBlock.ips[1],
        icmpType: "1",
        icmpCode: "8",
        type: "INGRESS",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    import pulumi_random as random
    
    example = ionoscloud.compute.Datacenter("example",
        name="Datacenter Example",
        location="us/las",
        description="Datacenter Description",
        sec_auth_protection=False)
    example_ip_block = ionoscloud.compute.IPBlock("example",
        location=example.location,
        size=2,
        name="IP Block Example")
    server_image_password = random.index.Password("server_image_password",
        length=16,
        special=False)
    example_server = ionoscloud.compute.Server("example",
        name="Server Example",
        datacenter_id=example.id,
        cores=1,
        ram=1024,
        availability_zone="ZONE_1",
        cpu_family="INTEL_XEON",
        image_name="Ubuntu-20.04",
        image_password=server_image_password["result"],
        volume={
            "name": "system",
            "size": 14,
            "disk_type": "SSD",
        },
        nic={
            "lan": 1,
            "dhcp": True,
            "firewall_active": True,
        })
    example_nic = ionoscloud.compute.Nic("example",
        datacenter_id=example.id,
        server_id=example_server.id,
        lan=2,
        dhcp=True,
        firewall_active=True,
        name="Nic Example")
    example_firewall = ionoscloud.compute.Firewall("example",
        datacenter_id=example.id,
        server_id=example_server.id,
        nic_id=example_nic.id,
        protocol="ICMP",
        name="Firewall Example",
        source_mac="00:0a:95:9d:68:16",
        source_ip=example_ip_block.ips[0],
        target_ip=example_ip_block.ips[1],
        icmp_type="1",
        icmp_code="8",
        type="INGRESS")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/compute"
    	"github.com/pulumi/pulumi-random/sdk/go/random"
    	"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 Example"),
    			Location:          pulumi.String("us/las"),
    			Description:       pulumi.String("Datacenter Description"),
    			SecAuthProtection: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		exampleIPBlock, err := compute.NewIPBlock(ctx, "example", &compute.IPBlockArgs{
    			Location: example.Location,
    			Size:     pulumi.Int(2),
    			Name:     pulumi.String("IP Block Example"),
    		})
    		if err != nil {
    			return err
    		}
    		serverImagePassword, err := random.NewPassword(ctx, "server_image_password", &random.PasswordArgs{
    			Length:  16,
    			Special: false,
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := compute.NewServer(ctx, "example", &compute.ServerArgs{
    			Name:             pulumi.String("Server Example"),
    			DatacenterId:     example.ID(),
    			Cores:            pulumi.Int(1),
    			Ram:              pulumi.Int(1024),
    			AvailabilityZone: pulumi.String("ZONE_1"),
    			CpuFamily:        pulumi.String("INTEL_XEON"),
    			ImageName:        pulumi.String("Ubuntu-20.04"),
    			ImagePassword:    serverImagePassword.Result,
    			Volume: &compute.ServerVolumeArgs{
    				Name:     pulumi.String("system"),
    				Size:     pulumi.Int(14),
    				DiskType: pulumi.String("SSD"),
    			},
    			Nic: &compute.ServerNicArgs{
    				Lan:            pulumi.Int(1),
    				Dhcp:           pulumi.Bool(true),
    				FirewallActive: pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleNic, err := compute.NewNic(ctx, "example", &compute.NicArgs{
    			DatacenterId:   example.ID(),
    			ServerId:       exampleServer.ID(),
    			Lan:            pulumi.Int(2),
    			Dhcp:           pulumi.Bool(true),
    			FirewallActive: pulumi.Bool(true),
    			Name:           pulumi.String("Nic Example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewFirewall(ctx, "example", &compute.FirewallArgs{
    			DatacenterId: example.ID(),
    			ServerId:     exampleServer.ID(),
    			NicId:        exampleNic.ID(),
    			Protocol:     pulumi.String("ICMP"),
    			Name:         pulumi.String("Firewall Example"),
    			SourceMac:    pulumi.String("00:0a:95:9d:68:16"),
    			SourceIp: exampleIPBlock.Ips.ApplyT(func(ips []string) (string, error) {
    				return ips[0], nil
    			}).(pulumi.StringOutput),
    			TargetIp: exampleIPBlock.Ips.ApplyT(func(ips []string) (string, error) {
    				return ips[1], nil
    			}).(pulumi.StringOutput),
    			IcmpType: pulumi.String("1"),
    			IcmpCode: pulumi.String("8"),
    			Type:     pulumi.String("INGRESS"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.Compute.Datacenter("example", new()
        {
            Name = "Datacenter Example",
            Location = "us/las",
            Description = "Datacenter Description",
            SecAuthProtection = false,
        });
    
        var exampleIPBlock = new Ionoscloud.Compute.IPBlock("example", new()
        {
            Location = example.Location,
            Size = 2,
            Name = "IP Block Example",
        });
    
        var serverImagePassword = new Random.Index.Password("server_image_password", new()
        {
            Length = 16,
            Special = false,
        });
    
        var exampleServer = new Ionoscloud.Compute.Server("example", new()
        {
            Name = "Server Example",
            DatacenterId = example.Id,
            Cores = 1,
            Ram = 1024,
            AvailabilityZone = "ZONE_1",
            CpuFamily = "INTEL_XEON",
            ImageName = "Ubuntu-20.04",
            ImagePassword = serverImagePassword.Result,
            Volume = new Ionoscloud.Compute.Inputs.ServerVolumeArgs
            {
                Name = "system",
                Size = 14,
                DiskType = "SSD",
            },
            Nic = new Ionoscloud.Compute.Inputs.ServerNicArgs
            {
                Lan = 1,
                Dhcp = true,
                FirewallActive = true,
            },
        });
    
        var exampleNic = new Ionoscloud.Compute.Nic("example", new()
        {
            DatacenterId = example.Id,
            ServerId = exampleServer.Id,
            Lan = 2,
            Dhcp = true,
            FirewallActive = true,
            Name = "Nic Example",
        });
    
        var exampleFirewall = new Ionoscloud.Compute.Firewall("example", new()
        {
            DatacenterId = example.Id,
            ServerId = exampleServer.Id,
            NicId = exampleNic.Id,
            Protocol = "ICMP",
            Name = "Firewall Example",
            SourceMac = "00:0a:95:9d:68:16",
            SourceIp = exampleIPBlock.Ips.Apply(ips => ips[0]),
            TargetIp = exampleIPBlock.Ips.Apply(ips => ips[1]),
            IcmpType = "1",
            IcmpCode = "8",
            Type = "INGRESS",
        });
    
    });
    
    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.compute.IPBlock;
    import com.pulumi.ionoscloud.compute.IPBlockArgs;
    import com.pulumi.random.password;
    import com.pulumi.random.PasswordArgs;
    import com.pulumi.ionoscloud.compute.Server;
    import com.pulumi.ionoscloud.compute.ServerArgs;
    import com.pulumi.ionoscloud.compute.inputs.ServerVolumeArgs;
    import com.pulumi.ionoscloud.compute.inputs.ServerNicArgs;
    import com.pulumi.ionoscloud.compute.Nic;
    import com.pulumi.ionoscloud.compute.NicArgs;
    import com.pulumi.ionoscloud.compute.Firewall;
    import com.pulumi.ionoscloud.compute.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 Example")
                .location("us/las")
                .description("Datacenter Description")
                .secAuthProtection(false)
                .build());
    
            var exampleIPBlock = new IPBlock("exampleIPBlock", IPBlockArgs.builder()
                .location(example.location())
                .size(2)
                .name("IP Block Example")
                .build());
    
            var serverImagePassword = new Password("serverImagePassword", PasswordArgs.builder()
                .length(16)
                .special(false)
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()
                .name("Server Example")
                .datacenterId(example.id())
                .cores(1)
                .ram(1024)
                .availabilityZone("ZONE_1")
                .cpuFamily("INTEL_XEON")
                .imageName("Ubuntu-20.04")
                .imagePassword(serverImagePassword.result())
                .volume(ServerVolumeArgs.builder()
                    .name("system")
                    .size(14)
                    .diskType("SSD")
                    .build())
                .nic(ServerNicArgs.builder()
                    .lan("1")
                    .dhcp(true)
                    .firewallActive(true)
                    .build())
                .build());
    
            var exampleNic = new Nic("exampleNic", NicArgs.builder()
                .datacenterId(example.id())
                .serverId(exampleServer.id())
                .lan(2)
                .dhcp(true)
                .firewallActive(true)
                .name("Nic Example")
                .build());
    
            var exampleFirewall = new Firewall("exampleFirewall", FirewallArgs.builder()
                .datacenterId(example.id())
                .serverId(exampleServer.id())
                .nicId(exampleNic.id())
                .protocol("ICMP")
                .name("Firewall Example")
                .sourceMac("00:0a:95:9d:68:16")
                .sourceIp(exampleIPBlock.ips().applyValue(ips -> ips[0]))
                .targetIp(exampleIPBlock.ips().applyValue(ips -> ips[1]))
                .icmpType(1)
                .icmpCode(8)
                .type("INGRESS")
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:compute:Datacenter
        properties:
          name: Datacenter Example
          location: us/las
          description: Datacenter Description
          secAuthProtection: false
      exampleIPBlock:
        type: ionoscloud:compute:IPBlock
        name: example
        properties:
          location: ${example.location}
          size: 2
          name: IP Block Example
      exampleServer:
        type: ionoscloud:compute:Server
        name: example
        properties:
          name: Server Example
          datacenterId: ${example.id}
          cores: 1
          ram: 1024
          availabilityZone: ZONE_1
          cpuFamily: INTEL_XEON
          imageName: Ubuntu-20.04
          imagePassword: ${serverImagePassword.result}
          volume:
            name: system
            size: 14
            diskType: SSD
          nic:
            lan: '1'
            dhcp: true
            firewallActive: true
      exampleNic:
        type: ionoscloud:compute:Nic
        name: example
        properties:
          datacenterId: ${example.id}
          serverId: ${exampleServer.id}
          lan: 2
          dhcp: true
          firewallActive: true
          name: Nic Example
      exampleFirewall:
        type: ionoscloud:compute:Firewall
        name: example
        properties:
          datacenterId: ${example.id}
          serverId: ${exampleServer.id}
          nicId: ${exampleNic.id}
          protocol: ICMP
          name: Firewall Example
          sourceMac: 00:0a:95:9d:68:16
          sourceIp: ${exampleIPBlock.ips[0]}
          targetIp: ${exampleIPBlock.ips[1]}
          icmpType: 1
          icmpCode: 8
          type: INGRESS
      serverImagePassword:
        type: random:password
        name: server_image_password
        properties:
          length: 16
          special: false
    

    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,
                 nic_id: Optional[str] = None,
                 server_id: Optional[str] = None,
                 protocol: Optional[str] = None,
                 datacenter_id: Optional[str] = None,
                 port_range_start: Optional[int] = None,
                 port_range_end: Optional[int] = None,
                 name: Optional[str] = None,
                 icmp_type: Optional[str] = None,
                 icmp_code: Optional[str] = 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:compute: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 firewallResource = new Ionoscloud.Compute.Firewall("firewallResource", new()
    {
        NicId = "string",
        ServerId = "string",
        Protocol = "string",
        DatacenterId = "string",
        PortRangeStart = 0,
        PortRangeEnd = 0,
        Name = "string",
        IcmpType = "string",
        IcmpCode = "string",
        SourceIp = "string",
        SourceMac = "string",
        TargetIp = "string",
        Type = "string",
    });
    
    example, err := compute.NewFirewall(ctx, "firewallResource", &compute.FirewallArgs{
    	NicId:          pulumi.String("string"),
    	ServerId:       pulumi.String("string"),
    	Protocol:       pulumi.String("string"),
    	DatacenterId:   pulumi.String("string"),
    	PortRangeStart: pulumi.Int(0),
    	PortRangeEnd:   pulumi.Int(0),
    	Name:           pulumi.String("string"),
    	IcmpType:       pulumi.String("string"),
    	IcmpCode:       pulumi.String("string"),
    	SourceIp:       pulumi.String("string"),
    	SourceMac:      pulumi.String("string"),
    	TargetIp:       pulumi.String("string"),
    	Type:           pulumi.String("string"),
    })
    
    var firewallResource = new com.ionoscloud.pulumi.ionoscloud.compute.Firewall("firewallResource", com.ionoscloud.pulumi.ionoscloud.compute.FirewallArgs.builder()
        .nicId("string")
        .serverId("string")
        .protocol("string")
        .datacenterId("string")
        .portRangeStart(0)
        .portRangeEnd(0)
        .name("string")
        .icmpType("string")
        .icmpCode("string")
        .sourceIp("string")
        .sourceMac("string")
        .targetIp("string")
        .type("string")
        .build());
    
    firewall_resource = ionoscloud.compute.Firewall("firewallResource",
        nic_id="string",
        server_id="string",
        protocol="string",
        datacenter_id="string",
        port_range_start=0,
        port_range_end=0,
        name="string",
        icmp_type="string",
        icmp_code="string",
        source_ip="string",
        source_mac="string",
        target_ip="string",
        type="string")
    
    const firewallResource = new ionoscloud.compute.Firewall("firewallResource", {
        nicId: "string",
        serverId: "string",
        protocol: "string",
        datacenterId: "string",
        portRangeStart: 0,
        portRangeEnd: 0,
        name: "string",
        icmpType: "string",
        icmpCode: "string",
        sourceIp: "string",
        sourceMac: "string",
        targetIp: "string",
        type: "string",
    });
    
    type: ionoscloud:compute:Firewall
    properties:
        datacenterId: string
        icmpCode: string
        icmpType: string
        name: string
        nicId: string
        portRangeEnd: 0
        portRangeStart: 0
        protocol: string
        serverId: 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 Virtual Data Center ID.
    NicId string
    [string] The NIC ID.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    ServerId string
    [string] The Server ID.
    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
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    DatacenterId string
    [string] The Virtual Data Center ID.
    NicId string
    [string] The NIC ID.
    Protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    ServerId string
    [string] The Server ID.
    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
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The Virtual Data Center ID.
    nicId String
    [string] The NIC ID.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    serverId String
    [string] The Server ID.
    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
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId string
    [string] The Virtual Data Center ID.
    nicId string
    [string] The NIC ID.
    protocol string
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    serverId string
    [string] The Server ID.
    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
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenter_id str
    [string] The Virtual Data Center ID.
    nic_id str
    [string] The NIC ID.
    protocol str
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    server_id str
    [string] The Server ID.
    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
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The Virtual Data Center ID.
    nicId String
    [string] The NIC ID.
    protocol String
    [string] The protocol for the rule: TCP, UDP, ICMP, ANY. Property cannot be modified after creation (disallowed in update requests).
    serverId String
    [string] The Server ID.
    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
    [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
    [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
    [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,
            nic_id: Optional[str] = None,
            port_range_end: Optional[int] = None,
            port_range_start: Optional[int] = None,
            protocol: Optional[str] = None,
            server_id: 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:compute: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 Virtual Data Center ID.
    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.
    NicId string
    [string] The NIC ID.
    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).
    ServerId string
    [string] The Server ID.
    SourceIp string
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    DatacenterId string
    [string] The Virtual Data Center ID.
    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.
    NicId string
    [string] The NIC ID.
    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).
    ServerId string
    [string] The Server ID.
    SourceIp string
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The Virtual Data Center ID.
    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.
    nicId String
    [string] The NIC ID.
    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).
    serverId String
    [string] The Server ID.
    sourceIp String
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId string
    [string] The Virtual Data Center ID.
    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.
    nicId string
    [string] The NIC ID.
    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).
    serverId string
    [string] The Server ID.
    sourceIp string
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenter_id str
    [string] The Virtual Data Center ID.
    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.
    nic_id str
    [string] The NIC ID.
    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).
    server_id str
    [string] The Server ID.
    source_ip str
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.
    datacenterId String
    [string] The Virtual Data Center ID.
    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.
    nicId String
    [string] The NIC ID.
    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).
    serverId String
    [string] The Server ID.
    sourceIp String
    [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
    [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
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.

    Import

    Resource Firewall can be imported using the resource id, e.g.

    $ pulumi import ionoscloud:compute/firewall:Firewall myfwruledatacenter uuid/server uuid/nic uuid/firewall uuid
    

    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.2 published on Monday, May 12, 2025 by ionos-cloud