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

ionoscloud.Firewall

Explore with Pulumi AI

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

    Manages a set of Firewall Rules on IonosCloud.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    import * as random from "@pulumi/random";
    
    const exampleDatacenter = new ionoscloud.Datacenter("exampleDatacenter", {
        location: "us/las",
        description: "Datacenter Description",
        secAuthProtection: false,
    });
    const exampleIpblock = new ionoscloud.Ipblock("exampleIpblock", {
        location: exampleDatacenter.location,
        size: 2,
    });
    const serverImagePassword = new random.index.Random_password("serverImagePassword", {
        length: 16,
        special: false,
    });
    const exampleServer = new ionoscloud.Server("exampleServer", {
        datacenterId: exampleDatacenter.datacenterId,
        cores: 1,
        ram: 1024,
        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.Nic("exampleNic", {
        datacenterId: exampleDatacenter.datacenterId,
        serverId: exampleServer.serverId,
        lan: 2,
        dhcp: true,
        firewallActive: true,
    });
    const exampleFirewall = new ionoscloud.Firewall("exampleFirewall", {
        datacenterId: exampleDatacenter.datacenterId,
        serverId: exampleServer.serverId,
        nicId: exampleNic.nicId,
        protocol: "ICMP",
        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_datacenter = ionoscloud.Datacenter("exampleDatacenter",
        location="us/las",
        description="Datacenter Description",
        sec_auth_protection=False)
    example_ipblock = ionoscloud.Ipblock("exampleIpblock",
        location=example_datacenter.location,
        size=2)
    server_image_password = random.index.Random_password("serverImagePassword",
        length=16,
        special=False)
    example_server = ionoscloud.Server("exampleServer",
        datacenter_id=example_datacenter.datacenter_id,
        cores=1,
        ram=1024,
        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.Nic("exampleNic",
        datacenter_id=example_datacenter.datacenter_id,
        server_id=example_server.server_id,
        lan=2,
        dhcp=True,
        firewall_active=True)
    example_firewall = ionoscloud.Firewall("exampleFirewall",
        datacenter_id=example_datacenter.datacenter_id,
        server_id=example_server.server_id,
        nic_id=example_nic.nic_id,
        protocol="ICMP",
        source_mac="00:0a:95:9d:68:16",
        source_ip=example_ipblock.ips[0],
        target_ip=example_ipblock.ips[1],
        icmp_type="1",
        icmp_code="8",
        type="INGRESS")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-random/sdk/go/random"
    	"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("us/las"),
    			Description:       pulumi.String("Datacenter Description"),
    			SecAuthProtection: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		exampleIpblock, err := ionoscloud.NewIpblock(ctx, "exampleIpblock", &ionoscloud.IpblockArgs{
    			Location: exampleDatacenter.Location,
    			Size:     pulumi.Float64(2),
    		})
    		if err != nil {
    			return err
    		}
    		serverImagePassword, err := random.NewRandom_password(ctx, "serverImagePassword", &random.Random_passwordArgs{
    			Length:  16,
    			Special: false,
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := ionoscloud.NewServer(ctx, "exampleServer", &ionoscloud.ServerArgs{
    			DatacenterId:  exampleDatacenter.DatacenterId,
    			Cores:         pulumi.Float64(1),
    			Ram:           pulumi.Float64(1024),
    			ImageName:     pulumi.String("Ubuntu-20.04"),
    			ImagePassword: serverImagePassword.Result,
    			Volume: &ionoscloud.ServerVolumeArgs{
    				Name:     pulumi.String("system"),
    				Size:     pulumi.Float64(14),
    				DiskType: pulumi.String("SSD"),
    			},
    			Nic: &ionoscloud.ServerNicArgs{
    				Lan:            pulumi.Float64(1),
    				Dhcp:           pulumi.Bool(true),
    				FirewallActive: pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleNic, err := ionoscloud.NewNic(ctx, "exampleNic", &ionoscloud.NicArgs{
    			DatacenterId:   exampleDatacenter.DatacenterId,
    			ServerId:       exampleServer.ServerId,
    			Lan:            pulumi.Float64(2),
    			Dhcp:           pulumi.Bool(true),
    			FirewallActive: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ionoscloud.NewFirewall(ctx, "exampleFirewall", &ionoscloud.FirewallArgs{
    			DatacenterId: exampleDatacenter.DatacenterId,
    			ServerId:     exampleServer.ServerId,
    			NicId:        exampleNic.NicId,
    			Protocol:     pulumi.String("ICMP"),
    			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 = Pulumi.Ionoscloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDatacenter = new Ionoscloud.Datacenter("exampleDatacenter", new()
        {
            Location = "us/las",
            Description = "Datacenter Description",
            SecAuthProtection = false,
        });
    
        var exampleIpblock = new Ionoscloud.Ipblock("exampleIpblock", new()
        {
            Location = exampleDatacenter.Location,
            Size = 2,
        });
    
        var serverImagePassword = new Random.Index.Random_password("serverImagePassword", new()
        {
            Length = 16,
            Special = false,
        });
    
        var exampleServer = new Ionoscloud.Server("exampleServer", new()
        {
            DatacenterId = exampleDatacenter.DatacenterId,
            Cores = 1,
            Ram = 1024,
            ImageName = "Ubuntu-20.04",
            ImagePassword = serverImagePassword.Result,
            Volume = new Ionoscloud.Inputs.ServerVolumeArgs
            {
                Name = "system",
                Size = 14,
                DiskType = "SSD",
            },
            Nic = new Ionoscloud.Inputs.ServerNicArgs
            {
                Lan = 1,
                Dhcp = true,
                FirewallActive = true,
            },
        });
    
        var exampleNic = new Ionoscloud.Nic("exampleNic", new()
        {
            DatacenterId = exampleDatacenter.DatacenterId,
            ServerId = exampleServer.ServerId,
            Lan = 2,
            Dhcp = true,
            FirewallActive = true,
        });
    
        var exampleFirewall = new Ionoscloud.Firewall("exampleFirewall", new()
        {
            DatacenterId = exampleDatacenter.DatacenterId,
            ServerId = exampleServer.ServerId,
            NicId = exampleNic.NicId,
            Protocol = "ICMP",
            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.Datacenter;
    import com.pulumi.ionoscloud.DatacenterArgs;
    import com.pulumi.ionoscloud.Ipblock;
    import com.pulumi.ionoscloud.IpblockArgs;
    import com.pulumi.random.random_password;
    import com.pulumi.random.Random_passwordArgs;
    import com.pulumi.ionoscloud.Server;
    import com.pulumi.ionoscloud.ServerArgs;
    import com.pulumi.ionoscloud.inputs.ServerVolumeArgs;
    import com.pulumi.ionoscloud.inputs.ServerNicArgs;
    import com.pulumi.ionoscloud.Nic;
    import com.pulumi.ionoscloud.NicArgs;
    import com.pulumi.ionoscloud.Firewall;
    import com.pulumi.ionoscloud.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 exampleDatacenter = new Datacenter("exampleDatacenter", DatacenterArgs.builder()
                .location("us/las")
                .description("Datacenter Description")
                .secAuthProtection(false)
                .build());
    
            var exampleIpblock = new Ipblock("exampleIpblock", IpblockArgs.builder()
                .location(exampleDatacenter.location())
                .size(2)
                .build());
    
            var serverImagePassword = new Random_password("serverImagePassword", Random_passwordArgs.builder()
                .length(16)
                .special(false)
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()
                .datacenterId(exampleDatacenter.datacenterId())
                .cores(1)
                .ram(1024)
                .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(exampleDatacenter.datacenterId())
                .serverId(exampleServer.serverId())
                .lan(2)
                .dhcp(true)
                .firewallActive(true)
                .build());
    
            var exampleFirewall = new Firewall("exampleFirewall", FirewallArgs.builder()
                .datacenterId(exampleDatacenter.datacenterId())
                .serverId(exampleServer.serverId())
                .nicId(exampleNic.nicId())
                .protocol("ICMP")
                .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:
      exampleDatacenter:
        type: ionoscloud:Datacenter
        properties:
          location: us/las
          description: Datacenter Description
          secAuthProtection: false
      exampleIpblock:
        type: ionoscloud:Ipblock
        properties:
          location: ${exampleDatacenter.location}
          size: 2
      exampleServer:
        type: ionoscloud:Server
        properties:
          datacenterId: ${exampleDatacenter.datacenterId}
          cores: 1
          ram: 1024
          imageName: Ubuntu-20.04
          imagePassword: ${serverImagePassword.result}
          volume:
            name: system
            size: 14
            diskType: SSD
          nic:
            lan: '1'
            dhcp: true
            firewallActive: true
      exampleNic:
        type: ionoscloud:Nic
        properties:
          datacenterId: ${exampleDatacenter.datacenterId}
          serverId: ${exampleServer.serverId}
          lan: 2
          dhcp: true
          firewallActive: true
      exampleFirewall:
        type: ionoscloud:Firewall
        properties:
          datacenterId: ${exampleDatacenter.datacenterId}
          serverId: ${exampleServer.serverId}
          nicId: ${exampleNic.nicId}
          protocol: ICMP
          sourceMac: 00:0a:95:9d:68:16
          sourceIp: ${exampleIpblock.ips[0]}
          targetIp: ${exampleIpblock.ips[1]}
          icmpType: 1
          icmpCode: 8
          type: INGRESS
      serverImagePassword:
        type: random:random_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,
                 icmp_type: Optional[str] = None,
                 name: Optional[str] = None,
                 port_range_end: Optional[float] = None,
                 port_range_start: Optional[float] = None,
                 icmp_code: Optional[str] = None,
                 firewall_id: Optional[str] = None,
                 source_ip: Optional[str] = None,
                 source_mac: Optional[str] = None,
                 target_ip: Optional[str] = None,
                 timeouts: Optional[FirewallTimeoutsArgs] = 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: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.Firewall("firewallResource", new()
    {
        NicId = "string",
        ServerId = "string",
        Protocol = "string",
        DatacenterId = "string",
        IcmpType = "string",
        Name = "string",
        PortRangeEnd = 0,
        PortRangeStart = 0,
        IcmpCode = "string",
        FirewallId = "string",
        SourceIp = "string",
        SourceMac = "string",
        TargetIp = "string",
        Timeouts = new Ionoscloud.Inputs.FirewallTimeoutsArgs
        {
            Create = "string",
            Default = "string",
            Delete = "string",
            Update = "string",
        },
        Type = "string",
    });
    
    example, err := ionoscloud.NewFirewall(ctx, "firewallResource", &ionoscloud.FirewallArgs{
    	NicId:          pulumi.String("string"),
    	ServerId:       pulumi.String("string"),
    	Protocol:       pulumi.String("string"),
    	DatacenterId:   pulumi.String("string"),
    	IcmpType:       pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	PortRangeEnd:   pulumi.Float64(0),
    	PortRangeStart: pulumi.Float64(0),
    	IcmpCode:       pulumi.String("string"),
    	FirewallId:     pulumi.String("string"),
    	SourceIp:       pulumi.String("string"),
    	SourceMac:      pulumi.String("string"),
    	TargetIp:       pulumi.String("string"),
    	Timeouts: &ionoscloud.FirewallTimeoutsArgs{
    		Create:  pulumi.String("string"),
    		Default: pulumi.String("string"),
    		Delete:  pulumi.String("string"),
    		Update:  pulumi.String("string"),
    	},
    	Type: pulumi.String("string"),
    })
    
    var firewallResource = new Firewall("firewallResource", FirewallArgs.builder()
        .nicId("string")
        .serverId("string")
        .protocol("string")
        .datacenterId("string")
        .icmpType("string")
        .name("string")
        .portRangeEnd(0)
        .portRangeStart(0)
        .icmpCode("string")
        .firewallId("string")
        .sourceIp("string")
        .sourceMac("string")
        .targetIp("string")
        .timeouts(FirewallTimeoutsArgs.builder()
            .create("string")
            .default_("string")
            .delete("string")
            .update("string")
            .build())
        .type("string")
        .build());
    
    firewall_resource = ionoscloud.Firewall("firewallResource",
        nic_id="string",
        server_id="string",
        protocol="string",
        datacenter_id="string",
        icmp_type="string",
        name="string",
        port_range_end=0,
        port_range_start=0,
        icmp_code="string",
        firewall_id="string",
        source_ip="string",
        source_mac="string",
        target_ip="string",
        timeouts={
            "create": "string",
            "default": "string",
            "delete": "string",
            "update": "string",
        },
        type="string")
    
    const firewallResource = new ionoscloud.Firewall("firewallResource", {
        nicId: "string",
        serverId: "string",
        protocol: "string",
        datacenterId: "string",
        icmpType: "string",
        name: "string",
        portRangeEnd: 0,
        portRangeStart: 0,
        icmpCode: "string",
        firewallId: "string",
        sourceIp: "string",
        sourceMac: "string",
        targetIp: "string",
        timeouts: {
            create: "string",
            "default": "string",
            "delete": "string",
            update: "string",
        },
        type: "string",
    });
    
    type: ionoscloud:Firewall
    properties:
        datacenterId: string
        firewallId: string
        icmpCode: string
        icmpType: string
        name: string
        nicId: string
        portRangeEnd: 0
        portRangeStart: 0
        protocol: string
        serverId: string
        sourceIp: string
        sourceMac: string
        targetIp: string
        timeouts:
            create: string
            default: string
            delete: string
            update: 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.
    FirewallId string
    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 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
    [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.
    Timeouts FirewallTimeouts
    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.
    FirewallId string
    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 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
    [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.
    Timeouts FirewallTimeoutsArgs
    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.
    firewallId String
    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 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
    [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.
    timeouts FirewallTimeouts
    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.
    firewallId string
    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.
    timeouts FirewallTimeouts
    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.
    firewall_id str
    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 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
    [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.
    timeouts FirewallTimeoutsArgs
    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.
    firewallId String
    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.
    timeouts Property Map
    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,
            firewall_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[float] = None,
            port_range_start: Optional[float] = 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,
            timeouts: Optional[FirewallTimeoutsArgs] = 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: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.
    FirewallId string
    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 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).
    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.
    Timeouts FirewallTimeouts
    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.
    FirewallId string
    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 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).
    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.
    Timeouts FirewallTimeoutsArgs
    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.
    firewallId String
    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 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).
    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.
    timeouts FirewallTimeouts
    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.
    firewallId string
    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.
    timeouts FirewallTimeouts
    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.
    firewall_id str
    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 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).
    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.
    timeouts FirewallTimeoutsArgs
    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.
    firewallId String
    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.
    timeouts Property Map
    type String
    [string] The type of firewall rule. If is not specified, it will take the default value INGRESS.

    Supporting Types

    FirewallTimeouts, FirewallTimeoutsArgs

    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 Firewall can be imported using the resource id, e.g.

    $ pulumi import ionoscloud:index/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/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