Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: hcloud:index/getFirewall:getFirewall
arguments:
# arguments dictionary
The following arguments are supported:
- Apply
Tos 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)
- Most
Recent 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.
- With
Selector string - Label selector
- Apply
Tos []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)
- Most
Recent bool - Return most recent firewall if multiple are found.
- Name string
- Name of the firewall.
- Rules
[]Get
Firewall Rule - (string) Configuration of a Rule from this Firewall.
- With
Selector string - Label selector
- apply
Tos 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)
- most
Recent Boolean - Return most recent firewall if multiple are found.
- name String
- Name of the firewall.
- rules
List<Get
Firewall Rule> - (string) Configuration of a Rule from this Firewall.
- with
Selector String - Label selector
- apply
Tos 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)
- most
Recent boolean - Return most recent firewall if multiple are found.
- name string
- Name of the firewall.
- rules
Get
Firewall Rule[] - (string) Configuration of a Rule from this Firewall.
- with
Selector 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[Get
Firewall Rule] - (string) Configuration of a Rule from this Firewall.
- with_
selector str - Label selector
- apply
Tos List<Property Map> - Configuration of the Applied Resources
- id Number
- ID of the firewall.
- labels Map<String>
- (map) User-defined labels (key-value pairs)
- most
Recent 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.
- with
Selector String - Label selector
getFirewall Result
The following output properties are available:
- Name string
- (string) Name of the Firewall.
- Apply
Tos 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)
- Most
Recent bool - Rules
List<Pulumi.
HCloud. Outputs. Get Firewall Rule> - (string) Configuration of a Rule from this Firewall.
- With
Selector string
- Name string
- (string) Name of the Firewall.
- Apply
Tos []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)
- Most
Recent bool - Rules
[]Get
Firewall Rule - (string) Configuration of a Rule from this Firewall.
- With
Selector string
- name String
- (string) Name of the Firewall.
- apply
Tos 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)
- most
Recent Boolean - rules
List<Get
Firewall Rule> - (string) Configuration of a Rule from this Firewall.
- with
Selector String
- name string
- (string) Name of the Firewall.
- apply
Tos 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)
- most
Recent boolean - rules
Get
Firewall Rule[] - (string) Configuration of a Rule from this Firewall.
- with
Selector 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[Get
Firewall Rule] - (string) Configuration of a Rule from this Firewall.
- with_
selector str
- name String
- (string) Name of the Firewall.
- apply
Tos 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)
- most
Recent Boolean - rules List<Property Map>
- (string) Configuration of a Rule from this Firewall.
- with
Selector String
Supporting Types
GetFirewallApplyTo
- Label
Selector 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
- Label
Selector 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
- label
Selector 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
- label
Selector 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
- label
Selector 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
- Destination
Ips List<string> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isout
) - Port string
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- Protocol string
- (Required, string) Protocol of the Firewall Rule.
tcp
,icmp
,udp
,gre
,esp
- Source
Ips List<string> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isin
)
- Direction string
- (Required, string) Direction of the Firewall Rule.
in
,out
- Description string
- (Optional, string) Description of the firewall rule
- Destination
Ips []string - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isout
) - Port string
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- Protocol string
- (Required, string) Protocol of the Firewall Rule.
tcp
,icmp
,udp
,gre
,esp
- Source
Ips []string - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isin
)
- direction String
- (Required, string) Direction of the Firewall Rule.
in
,out
- description String
- (Optional, string) Description of the firewall rule
- destination
Ips List<String> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isout
) - port String
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- protocol String
- (Required, string) Protocol of the Firewall Rule.
tcp
,icmp
,udp
,gre
,esp
- source
Ips List<String> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isin
)
- direction string
- (Required, string) Direction of the Firewall Rule.
in
,out
- description string
- (Optional, string) Description of the firewall rule
- destination
Ips string[] - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isout
) - port string
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- protocol string
- (Required, string) Protocol of the Firewall Rule.
tcp
,icmp
,udp
,gre
,esp
- source
Ips string[] - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isin
)
- 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
isout
) - port str
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- 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
isin
)
- direction String
- (Required, string) Direction of the Firewall Rule.
in
,out
- description String
- (Optional, string) Description of the firewall rule
- destination
Ips List<String> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isout
) - port String
- (Required, string) Port of the Firewall Rule. Required when
protocol
istcp
orudp
- protocol String
- (Required, string) Protocol of the Firewall Rule.
tcp
,icmp
,udp
,gre
,esp
- source
Ips List<String> - (Required, List) List of CIDRs that are allowed within this Firewall Rule (when
direction
isin
)
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloud
Terraform Provider.