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

ionoscloud.getFirewall

Explore with Pulumi AI

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

    The Firewall data source can be used to search for and return an existing FirewallRules. You can provide a string for either id or name parameters which will be compared with provisioned Firewall Rules. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getFirewall({
        datacenterId: "datacenter_id",
        id: "firewall_id",
        nicId: "nic_id",
        serverId: "server_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_firewall(datacenter_id="datacenter_id",
        id="firewall_id",
        nic_id="nic_id",
        server_id="server_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupFirewall(ctx, &ionoscloud.LookupFirewallArgs{
    			DatacenterId: "datacenter_id",
    			Id:           pulumi.StringRef("firewall_id"),
    			NicId:        "nic_id",
    			ServerId:     "server_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetFirewall.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Id = "firewall_id",
            NicId = "nic_id",
            ServerId = "server_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetFirewallArgs;
    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) {
            final var example = IonoscloudFunctions.getFirewall(GetFirewallArgs.builder()
                .datacenterId("datacenter_id")
                .id("firewall_id")
                .nicId("nic_id")
                .serverId("server_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getFirewall
          arguments:
            datacenterId: datacenter_id
            id: firewall_id
            nicId: nic_id
            serverId: server_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getFirewall({
        datacenterId: "datacenter_id",
        name: "test_ds_firewall_rule",
        nicId: "nic_id",
        serverId: "server_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_firewall(datacenter_id="datacenter_id",
        name="test_ds_firewall_rule",
        nic_id="nic_id",
        server_id="server_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupFirewall(ctx, &ionoscloud.LookupFirewallArgs{
    			DatacenterId: "datacenter_id",
    			Name:         pulumi.StringRef("test_ds_firewall_rule"),
    			NicId:        "nic_id",
    			ServerId:     "server_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetFirewall.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Name = "test_ds_firewall_rule",
            NicId = "nic_id",
            ServerId = "server_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetFirewallArgs;
    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) {
            final var example = IonoscloudFunctions.getFirewall(GetFirewallArgs.builder()
                .datacenterId("datacenter_id")
                .name("test_ds_firewall_rule")
                .nicId("nic_id")
                .serverId("server_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getFirewall
          arguments:
            datacenterId: datacenter_id
            name: test_ds_firewall_rule
            nicId: nic_id
            serverId: server_id
    

    Using getFirewall

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getFirewall(args: GetFirewallArgs, opts?: InvokeOptions): Promise<GetFirewallResult>
    function getFirewallOutput(args: GetFirewallOutputArgs, opts?: InvokeOptions): Output<GetFirewallResult>
    def get_firewall(datacenter_id: Optional[str] = None,
                     id: Optional[str] = None,
                     name: Optional[str] = None,
                     nic_id: Optional[str] = None,
                     server_id: Optional[str] = None,
                     timeouts: Optional[GetFirewallTimeouts] = None,
                     opts: Optional[InvokeOptions] = None) -> GetFirewallResult
    def get_firewall_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                     id: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     nic_id: Optional[pulumi.Input[str]] = None,
                     server_id: Optional[pulumi.Input[str]] = None,
                     timeouts: Optional[pulumi.Input[GetFirewallTimeoutsArgs]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetFirewallResult]
    func LookupFirewall(ctx *Context, args *LookupFirewallArgs, opts ...InvokeOption) (*LookupFirewallResult, error)
    func LookupFirewallOutput(ctx *Context, args *LookupFirewallOutputArgs, opts ...InvokeOption) LookupFirewallResultOutput

    > Note: This function is named LookupFirewall in the Go SDK.

    public static class GetFirewall 
    {
        public static Task<GetFirewallResult> InvokeAsync(GetFirewallArgs args, InvokeOptions? opts = null)
        public static Output<GetFirewallResult> Invoke(GetFirewallInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFirewallResult> getFirewall(GetFirewallArgs args, InvokeOptions options)
    public static Output<GetFirewallResult> getFirewall(GetFirewallArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:index/getFirewall:getFirewall
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatacenterId string
    The Virtual Data Center ID.
    NicId string

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    ServerId string
    The Server ID.
    Id string
    ID of the firewall rule you want to search for.
    Name string
    Name of an existing firewall rule that you want to search for.
    Timeouts GetFirewallTimeouts
    DatacenterId string
    The Virtual Data Center ID.
    NicId string

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    ServerId string
    The Server ID.
    Id string
    ID of the firewall rule you want to search for.
    Name string
    Name of an existing firewall rule that you want to search for.
    Timeouts GetFirewallTimeouts
    datacenterId String
    The Virtual Data Center ID.
    nicId String

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    serverId String
    The Server ID.
    id String
    ID of the firewall rule you want to search for.
    name String
    Name of an existing firewall rule that you want to search for.
    timeouts GetFirewallTimeouts
    datacenterId string
    The Virtual Data Center ID.
    nicId string

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    serverId string
    The Server ID.
    id string
    ID of the firewall rule you want to search for.
    name string
    Name of an existing firewall rule that you want to search for.
    timeouts GetFirewallTimeouts
    datacenter_id str
    The Virtual Data Center ID.
    nic_id str

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    server_id str
    The Server ID.
    id str
    ID of the firewall rule you want to search for.
    name str
    Name of an existing firewall rule that you want to search for.
    timeouts GetFirewallTimeouts
    datacenterId String
    The Virtual Data Center ID.
    nicId String

    The NIC ID.

    Either name or id must be provided. If none, or both are provided, the datasource will return an error.

    serverId String
    The Server ID.
    id String
    ID of the firewall rule you want to search for.
    name String
    Name of an existing firewall rule that you want to search for.
    timeouts Property Map

    getFirewall Result

    The following output properties are available:

    DatacenterId string
    IcmpCode string
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    Id string
    The id of the firewall rule.
    Name string
    The name of the firewall rule.
    NicId string
    PortRangeEnd double
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    PortRangeStart double
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    Protocol string
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    ServerId string
    SourceIp string
    Only traffic originating from the respective IPv4 address is allowed.
    SourceMac string
    Only traffic originating from the respective MAC address is allowed.
    TargetIp string
    Only traffic directed to the respective IP address of the NIC is allowed.
    Type string
    Timeouts GetFirewallTimeouts
    DatacenterId string
    IcmpCode string
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    IcmpType string
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    Id string
    The id of the firewall rule.
    Name string
    The name of the firewall rule.
    NicId string
    PortRangeEnd float64
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    PortRangeStart float64
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    Protocol string
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    ServerId string
    SourceIp string
    Only traffic originating from the respective IPv4 address is allowed.
    SourceMac string
    Only traffic originating from the respective MAC address is allowed.
    TargetIp string
    Only traffic directed to the respective IP address of the NIC is allowed.
    Type string
    Timeouts GetFirewallTimeouts
    datacenterId String
    icmpCode String
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    id String
    The id of the firewall rule.
    name String
    The name of the firewall rule.
    nicId String
    portRangeEnd Double
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    portRangeStart Double
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    protocol String
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    serverId String
    sourceIp String
    Only traffic originating from the respective IPv4 address is allowed.
    sourceMac String
    Only traffic originating from the respective MAC address is allowed.
    targetIp String
    Only traffic directed to the respective IP address of the NIC is allowed.
    type String
    timeouts GetFirewallTimeouts
    datacenterId string
    icmpCode string
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType string
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    id string
    The id of the firewall rule.
    name string
    The name of the firewall rule.
    nicId string
    portRangeEnd number
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    portRangeStart number
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    protocol string
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    serverId string
    sourceIp string
    Only traffic originating from the respective IPv4 address is allowed.
    sourceMac string
    Only traffic originating from the respective MAC address is allowed.
    targetIp string
    Only traffic directed to the respective IP address of the NIC is allowed.
    type string
    timeouts GetFirewallTimeouts
    datacenter_id str
    icmp_code str
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmp_type str
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    id str
    The id of the firewall rule.
    name str
    The name of the firewall rule.
    nic_id str
    port_range_end float
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    port_range_start float
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    protocol str
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    server_id str
    source_ip str
    Only traffic originating from the respective IPv4 address is allowed.
    source_mac str
    Only traffic originating from the respective MAC address is allowed.
    target_ip str
    Only traffic directed to the respective IP address of the NIC is allowed.
    type str
    timeouts GetFirewallTimeouts
    datacenterId String
    icmpCode String
    Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
    icmpType String
    Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
    id String
    The id of the firewall rule.
    name String
    The name of the firewall rule.
    nicId String
    portRangeEnd Number
    Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
    portRangeStart Number
    Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
    protocol String
    The protocol for the rule: TCP, UDP, ICMP, ANY. This property is immutable.
    serverId String
    sourceIp String
    Only traffic originating from the respective IPv4 address is allowed.
    sourceMac String
    Only traffic originating from the respective MAC address is allowed.
    targetIp String
    Only traffic directed to the respective IP address of the NIC is allowed.
    type String
    timeouts Property Map

    Supporting Types

    GetFirewallTimeouts

    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

    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