Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi
hcloud.getFirewall
Explore with Pulumi AI
Provides details about a specific Hetzner Cloud Firewall.
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const sampleFirewall1 = hcloud.getFirewall({
    name: "sample-firewall-1",
});
const sampleFirewall2 = 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)
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, &hcloud.LookupFirewallArgs{
			Name: pulumi.StringRef("sample-firewall-1"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.LookupFirewall(ctx, &hcloud.LookupFirewallArgs{
			Id: pulumi.IntRef(4711),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() => 
{
    var sampleFirewall1 = HCloud.GetFirewall.Invoke(new()
    {
        Name = "sample-firewall-1",
    });
    var sampleFirewall2 = HCloud.GetFirewall.Invoke(new()
    {
        Id = 4711,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.HcloudFunctions;
import com.pulumi.hcloud.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 sampleFirewall1 = HcloudFunctions.getFirewall(GetFirewallArgs.builder()
            .name("sample-firewall-1")
            .build());
        final var sampleFirewall2 = 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, str]] = 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, pulumi.Input[str]]]] = 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)
public static Output<GetFirewallResult> getFirewall(GetFirewallArgs args, InvokeOptions options)
fn::invoke:
  function: hcloud:index/getFirewall:getFirewall
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ApplyTos List<Pulumi.HCloud. Inputs. Get Firewall Apply To> 
- Configuration of the Applied Resources
- Id int
- ID of the firewall.
- Labels Dictionary<string, string>
- (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. Get Firewall Rule> 
- (string) Configuration of a Rule from this Firewall.
- WithSelector string
- Label selector
- ApplyTos []GetFirewall Apply To 
- Configuration of the Applied Resources
- Id int
- ID of the firewall.
- Labels map[string]string
- (map) User-defined labels (key-value pairs)
- MostRecent bool
- Return most recent firewall if multiple are found.
- Name string
- Name of the firewall.
- Rules
[]GetFirewall Rule 
- (string) Configuration of a Rule from this Firewall.
- WithSelector string
- Label selector
- applyTos List<GetFirewall Apply To> 
- Configuration of the Applied Resources
- id Integer
- ID of the firewall.
- labels Map<String,String>
- (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<GetFirewall Rule> 
- (string) Configuration of a Rule from this Firewall.
- withSelector String
- Label selector
- applyTos GetFirewall Apply To[] 
- Configuration of the Applied Resources
- id number
- ID of the firewall.
- labels {[key: string]: string}
- (map) User-defined labels (key-value pairs)
- mostRecent boolean
- Return most recent firewall if multiple are found.
- name string
- Name of the firewall.
- rules
GetFirewall Rule[] 
- (string) Configuration of a Rule from this Firewall.
- withSelector string
- Label selector
- apply_tos Sequence[GetFirewall Apply To] 
- Configuration of the Applied Resources
- id int
- ID of the firewall.
- labels Mapping[str, str]
- (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[GetFirewall Rule] 
- (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<String>
- (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. Get Firewall Apply To> 
- Configuration of the Applied Resources
- Id int
- (int) Unique ID of the Firewall.
- Labels Dictionary<string, string>
- (map) User-defined labels (key-value pairs)
- MostRecent bool
- Rules
List<Pulumi.HCloud. Outputs. Get Firewall Rule> 
- (string) Configuration of a Rule from this Firewall.
- WithSelector string
- Name string
- (string) Name of the Firewall.
- ApplyTos []GetFirewall Apply To 
- Configuration of the Applied Resources
- Id int
- (int) Unique ID of the Firewall.
- Labels map[string]string
- (map) User-defined labels (key-value pairs)
- MostRecent bool
- Rules
[]GetFirewall Rule 
- (string) Configuration of a Rule from this Firewall.
- WithSelector string
- name String
- (string) Name of the Firewall.
- applyTos List<GetFirewall Apply To> 
- Configuration of the Applied Resources
- id Integer
- (int) Unique ID of the Firewall.
- labels Map<String,String>
- (map) User-defined labels (key-value pairs)
- mostRecent Boolean
- rules
List<GetFirewall Rule> 
- (string) Configuration of a Rule from this Firewall.
- withSelector String
- name string
- (string) Name of the Firewall.
- applyTos GetFirewall Apply To[] 
- Configuration of the Applied Resources
- id number
- (int) Unique ID of the Firewall.
- labels {[key: string]: string}
- (map) User-defined labels (key-value pairs)
- mostRecent boolean
- rules
GetFirewall Rule[] 
- (string) Configuration of a Rule from this Firewall.
- withSelector string
- name str
- (string) Name of the Firewall.
- apply_tos Sequence[GetFirewall Apply To] 
- Configuration of the Applied Resources
- id int
- (int) Unique ID of the Firewall.
- labels Mapping[str, str]
- (map) User-defined labels (key-value pairs)
- most_recent bool
- rules
Sequence[GetFirewall Rule] 
- (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<String>
- (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. 0if 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. 0if 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. 0if 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. 0if 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. 0if 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. 0if 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 directionisout)
- Port string
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
- 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 directionisout)
- Port string
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
- 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 directionisout)
- port String
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
- 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 directionisout)
- port string
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
- 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 directionisout)
- port str
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
- 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 directionisout)
- port String
- (Required, string) Port of the Firewall Rule. Required when protocolistcporudp
- 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 directionisin)
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the hcloudTerraform Provider.