Hetzner Cloud

v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

getFirewall

Provides details about a specific Hetzner Cloud Firewall.

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const sampleFirewall1 = pulumi.output(hcloud.getFirewall({
    name: "sample-firewall-1",
}));
const sampleFirewall2 = pulumi.output(hcloud.getFirewall({
    id: 4711,
}));
import pulumi
import pulumi_hcloud as hcloud

sample_firewall1 = hcloud.get_firewall(name="sample-firewall-1")
sample_firewall2 = hcloud.get_firewall(id=4711)
using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var sampleFirewall1 = Output.Create(HCloud.GetFirewall.InvokeAsync(new HCloud.GetFirewallArgs
        {
            Name = "sample-firewall-1",
        }));
        var sampleFirewall2 = Output.Create(HCloud.GetFirewall.InvokeAsync(new HCloud.GetFirewallArgs
        {
            Id = 4711,
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := hcloud.LookupFirewall(ctx, &GetFirewallArgs{
			Name: pulumi.StringRef("sample-firewall-1"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.LookupFirewall(ctx, &GetFirewallArgs{
			Id: pulumi.IntRef(4711),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var sampleFirewall1 = Output.of(HcloudFunctions.getFirewall(GetFirewallArgs.builder()
            .name("sample-firewall-1")
            .build()));

        final var sampleFirewall2 = Output.of(HcloudFunctions.getFirewall(GetFirewallArgs.builder()
            .id("4711")
            .build()));

    }
}
variables:
  sampleFirewall1:
    Fn::Invoke:
      Function: hcloud:getFirewall
      Arguments:
        name: sample-firewall-1
  sampleFirewall2:
    Fn::Invoke:
      Function: hcloud:getFirewall
      Arguments:
        id: 4711

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(apply_tos: Optional[Sequence[GetFirewallApplyTo]] = None,
                 id: Optional[int] = None,
                 labels: Optional[Mapping[str, Any]] = None,
                 most_recent: Optional[bool] = None,
                 name: Optional[str] = None,
                 rules: Optional[Sequence[GetFirewallRule]] = None,
                 with_selector: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFirewallResult
def get_firewall_output(apply_tos: Optional[pulumi.Input[Sequence[pulumi.Input[GetFirewallApplyToArgs]]]] = None,
                 id: Optional[pulumi.Input[int]] = None,
                 labels: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                 most_recent: Optional[pulumi.Input[bool]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 rules: Optional[pulumi.Input[Sequence[pulumi.Input[GetFirewallRuleArgs]]]] = None,
                 with_selector: Optional[pulumi.Input[str]] = 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: hcloud:index/getFirewall:getFirewall
  arguments:
    # arguments dictionary

The following arguments are supported:

ApplyTos List<Pulumi.HCloud.Inputs.GetFirewallApplyTo>

Configuration of the Applied Resources

Id int

ID of the firewall.

Labels Dictionary<string, object>

(map) User-defined labels (key-value pairs)

MostRecent bool

Return most recent firewall if multiple are found.

Name string

Name of the firewall.

Rules List<Pulumi.HCloud.Inputs.GetFirewallRule>

(string) Configuration of a Rule from this Firewall.

WithSelector string

Label selector

ApplyTos []GetFirewallApplyTo

Configuration of the Applied Resources

Id int

ID of the firewall.

Labels map[string]interface{}

(map) User-defined labels (key-value pairs)

MostRecent bool

Return most recent firewall if multiple are found.

Name string

Name of the firewall.

Rules []GetFirewallRule

(string) Configuration of a Rule from this Firewall.

WithSelector string

Label selector

applyTos List<GetFirewallApplyTo>

Configuration of the Applied Resources

id Integer

ID of the firewall.

labels Map<String,Object>

(map) User-defined labels (key-value pairs)

mostRecent Boolean

Return most recent firewall if multiple are found.

name String

Name of the firewall.

rules List<GetFirewallRule>

(string) Configuration of a Rule from this Firewall.

withSelector String

Label selector

applyTos GetFirewallApplyTo[]

Configuration of the Applied Resources

id number

ID of the firewall.

labels {[key: string]: any}

(map) User-defined labels (key-value pairs)

mostRecent boolean

Return most recent firewall if multiple are found.

name string

Name of the firewall.

rules GetFirewallRule[]

(string) Configuration of a Rule from this Firewall.

withSelector string

Label selector

apply_tos Sequence[GetFirewallApplyTo]

Configuration of the Applied Resources

id int

ID of the firewall.

labels Mapping[str, Any]

(map) User-defined labels (key-value pairs)

most_recent bool

Return most recent firewall if multiple are found.

name str

Name of the firewall.

rules Sequence[GetFirewallRule]

(string) Configuration of a Rule from this Firewall.

with_selector str

Label selector

applyTos List<Property Map>

Configuration of the Applied Resources

id Number

ID of the firewall.

labels Map<Any>

(map) User-defined labels (key-value pairs)

mostRecent Boolean

Return most recent firewall if multiple are found.

name String

Name of the firewall.

rules List<Property Map>

(string) Configuration of a Rule from this Firewall.

withSelector String

Label selector

getFirewall Result

The following output properties are available:

Name string

(string) Name of the Firewall.

ApplyTos List<Pulumi.HCloud.Outputs.GetFirewallApplyTo>

Configuration of the Applied Resources

Id int

(int) Unique ID of the Firewall.

Labels Dictionary<string, object>

(map) User-defined labels (key-value pairs)

MostRecent bool
Rules List<Pulumi.HCloud.Outputs.GetFirewallRule>

(string) Configuration of a Rule from this Firewall.

WithSelector string
Name string

(string) Name of the Firewall.

ApplyTos []GetFirewallApplyTo

Configuration of the Applied Resources

Id int

(int) Unique ID of the Firewall.

Labels map[string]interface{}

(map) User-defined labels (key-value pairs)

MostRecent bool
Rules []GetFirewallRule

(string) Configuration of a Rule from this Firewall.

WithSelector string
name String

(string) Name of the Firewall.

applyTos List<GetFirewallApplyTo>

Configuration of the Applied Resources

id Integer

(int) Unique ID of the Firewall.

labels Map<String,Object>

(map) User-defined labels (key-value pairs)

mostRecent Boolean
rules List<GetFirewallRule>

(string) Configuration of a Rule from this Firewall.

withSelector String
name string

(string) Name of the Firewall.

applyTos GetFirewallApplyTo[]

Configuration of the Applied Resources

id number

(int) Unique ID of the Firewall.

labels {[key: string]: any}

(map) User-defined labels (key-value pairs)

mostRecent boolean
rules GetFirewallRule[]

(string) Configuration of a Rule from this Firewall.

withSelector string
name str

(string) Name of the Firewall.

apply_tos Sequence[GetFirewallApplyTo]

Configuration of the Applied Resources

id int

(int) Unique ID of the Firewall.

labels Mapping[str, Any]

(map) User-defined labels (key-value pairs)

most_recent bool
rules Sequence[GetFirewallRule]

(string) Configuration of a Rule from this Firewall.

with_selector str
name String

(string) Name of the Firewall.

applyTos List<Property Map>

Configuration of the Applied Resources

id Number

(int) Unique ID of the Firewall.

labels Map<Any>

(map) User-defined labels (key-value pairs)

mostRecent Boolean
rules List<Property Map>

(string) Configuration of a Rule from this Firewall.

withSelector String

Supporting Types

GetFirewallApplyTo

LabelSelector string

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

Server int

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

LabelSelector string

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

Server int

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

labelSelector String

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

server Integer

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

labelSelector string

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

server number

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

label_selector str

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

server int

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

labelSelector String

(string) Label Selector to select servers the firewall is applied to. Empty if a server is directly referenced

server Number

(int) ID of a server where the firewall is applied to. 0 if applied to a label_selector

GetFirewallRule

Direction string

(Required, string) Direction of the Firewall Rule. in, out

Description string

(Optional, string) Description of the firewall rule

DestinationIps List<string>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

Port string

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

Protocol string

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

SourceIps List<string>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

Direction string

(Required, string) Direction of the Firewall Rule. in, out

Description string

(Optional, string) Description of the firewall rule

DestinationIps []string

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

Port string

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

Protocol string

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

SourceIps []string

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

direction String

(Required, string) Direction of the Firewall Rule. in, out

description String

(Optional, string) Description of the firewall rule

destinationIps List<String>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

port String

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

protocol String

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

sourceIps List<String>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

direction string

(Required, string) Direction of the Firewall Rule. in, out

description string

(Optional, string) Description of the firewall rule

destinationIps string[]

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

port string

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

protocol string

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

sourceIps string[]

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

direction str

(Required, string) Direction of the Firewall Rule. in, out

description str

(Optional, string) Description of the firewall rule

destination_ips Sequence[str]

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

port str

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

protocol str

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

source_ips Sequence[str]

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

direction String

(Required, string) Direction of the Firewall Rule. in, out

description String

(Optional, string) Description of the firewall rule

destinationIps List<String>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is out)

port String

(Required, string) Port of the Firewall Rule. Required when protocol is tcp or udp

protocol String

(Required, string) Protocol of the Firewall Rule. tcp, icmp, udp, gre, esp

sourceIps List<String>

(Required, List) List of CIDRs that are allowed within this Firewall Rule (when direction is in)

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.