Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
Provides details about a Hetzner Cloud Floating IP.
This resource can be useful when you need to determine a Floating IP ID based on the IP address.
Example Usage
Data Source: hcloud.FloatingIp
Provides details about a Hetzner Cloud Floating IP. This resource can be useful when you need to determine a Floating IP ID based on the IP address.
Additional Examples
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const ip1 = hcloud.getFloatingIp({
ipAddress: "1.2.3.4",
});
const ip2 = hcloud.getFloatingIp({
withSelector: "key=value",
});
const main: hcloud.FloatingIpAssignment[] = [];
for (const range = {value: 0}; range.value < counter; range.value++) {
main.push(new hcloud.FloatingIpAssignment(`main-${range.value}`, {
floatingIpId: ip1.then(ip1 => ip1.id),
serverId: mainHcloudServer.id,
}));
}
import pulumi
import pulumi_hcloud as hcloud
ip1 = hcloud.get_floating_ip(ip_address="1.2.3.4")
ip2 = hcloud.get_floating_ip(with_selector="key=value")
main = []
for range in [{"value": i} for i in range(0, counter)]:
main.append(hcloud.FloatingIpAssignment(f"main-{range['value']}",
floating_ip_id=ip1.id,
server_id=main_hcloud_server["id"]))
package main
import (
"fmt"
"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 {
ip1, err := hcloud.LookupFloatingIp(ctx, &hcloud.LookupFloatingIpArgs{
IpAddress: pulumi.StringRef("1.2.3.4"),
}, nil)
if err != nil {
return err
}
_, err = hcloud.LookupFloatingIp(ctx, &hcloud.LookupFloatingIpArgs{
WithSelector: pulumi.StringRef("key=value"),
}, nil)
if err != nil {
return err
}
var main []*hcloud.FloatingIpAssignment
for index := 0; index < counter; index++ {
key0 := index
_ := index
__res, err := hcloud.NewFloatingIpAssignment(ctx, fmt.Sprintf("main-%v", key0), &hcloud.FloatingIpAssignmentArgs{
FloatingIpId: pulumi.Int(ip1.Id),
ServerId: pulumi.Any(mainHcloudServer.Id),
})
if err != nil {
return err
}
main = append(main, __res)
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() =>
{
var ip1 = HCloud.GetFloatingIp.Invoke(new()
{
IpAddress = "1.2.3.4",
});
var ip2 = HCloud.GetFloatingIp.Invoke(new()
{
WithSelector = "key=value",
});
var main = new List<HCloud.FloatingIpAssignment>();
for (var rangeIndex = 0; rangeIndex < counter; rangeIndex++)
{
var range = new { Value = rangeIndex };
main.Add(new HCloud.FloatingIpAssignment($"main-{range.Value}", new()
{
FloatingIpId = ip1.Apply(getFloatingIpResult => getFloatingIpResult.Id),
ServerId = mainHcloudServer.Id,
}));
}
});
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.GetFloatingIpArgs;
import com.pulumi.hcloud.FloatingIpAssignment;
import com.pulumi.hcloud.FloatingIpAssignmentArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 ip1 = HcloudFunctions.getFloatingIp(GetFloatingIpArgs.builder()
.ipAddress("1.2.3.4")
.build());
final var ip2 = HcloudFunctions.getFloatingIp(GetFloatingIpArgs.builder()
.withSelector("key=value")
.build());
for (var i = 0; i < counter; i++) {
new FloatingIpAssignment("main-" + i, FloatingIpAssignmentArgs.builder()
.floatingIpId(ip1.id())
.serverId(mainHcloudServer.id())
.build());
}
}
}
resources:
main:
type: hcloud:FloatingIpAssignment
properties:
floatingIpId: ${ip1.id}
serverId: ${mainHcloudServer.id}
options: {}
variables:
ip1:
fn::invoke:
function: hcloud:getFloatingIp
arguments:
ipAddress: 1.2.3.4
ip2:
fn::invoke:
function: hcloud:getFloatingIp
arguments:
withSelector: key=value
Using getFloatingIp
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 getFloatingIp(args: GetFloatingIpArgs, opts?: InvokeOptions): Promise<GetFloatingIpResult>
function getFloatingIpOutput(args: GetFloatingIpOutputArgs, opts?: InvokeOptions): Output<GetFloatingIpResult>def get_floating_ip(id: Optional[int] = None,
ip_address: Optional[str] = None,
name: Optional[str] = None,
selector: Optional[str] = None,
with_selector: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetFloatingIpResult
def get_floating_ip_output(id: Optional[pulumi.Input[int]] = None,
ip_address: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
selector: Optional[pulumi.Input[str]] = None,
with_selector: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetFloatingIpResult]func LookupFloatingIp(ctx *Context, args *LookupFloatingIpArgs, opts ...InvokeOption) (*LookupFloatingIpResult, error)
func LookupFloatingIpOutput(ctx *Context, args *LookupFloatingIpOutputArgs, opts ...InvokeOption) LookupFloatingIpResultOutput> Note: This function is named LookupFloatingIp in the Go SDK.
public static class GetFloatingIp
{
public static Task<GetFloatingIpResult> InvokeAsync(GetFloatingIpArgs args, InvokeOptions? opts = null)
public static Output<GetFloatingIpResult> Invoke(GetFloatingIpInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetFloatingIpResult> getFloatingIp(GetFloatingIpArgs args, InvokeOptions options)
public static Output<GetFloatingIpResult> getFloatingIp(GetFloatingIpArgs args, InvokeOptions options)
fn::invoke:
function: hcloud:index/getFloatingIp:getFloatingIp
arguments:
# arguments dictionaryThe following arguments are supported:
- Id int
- ID of the Floating IP.
- Ip
Address string - IP address of the Floating IP.
- Name string
- Name of the Floating IP.
- Selector string
- With
Selector string - Label selector
- Id int
- ID of the Floating IP.
- Ip
Address string - IP address of the Floating IP.
- Name string
- Name of the Floating IP.
- Selector string
- With
Selector string - Label selector
- id Integer
- ID of the Floating IP.
- ip
Address String - IP address of the Floating IP.
- name String
- Name of the Floating IP.
- selector String
- with
Selector String - Label selector
- id number
- ID of the Floating IP.
- ip
Address string - IP address of the Floating IP.
- name string
- Name of the Floating IP.
- selector string
- with
Selector string - Label selector
- id int
- ID of the Floating IP.
- ip_
address str - IP address of the Floating IP.
- name str
- Name of the Floating IP.
- selector str
- with_
selector str - Label selector
- id Number
- ID of the Floating IP.
- ip
Address String - IP address of the Floating IP.
- name String
- Name of the Floating IP.
- selector String
- with
Selector String - Label selector
getFloatingIp Result
The following output properties are available:
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Description string
- (string) Description of the Floating IP.
- Home
Location string - (string) Home location.
- Id int
- (int) Unique ID of the Floating IP.
- Ip
Address string - (string) IP Address of the Floating IP.
- Ip
Network string - (string) IPv6 subnet. (Only set if
typeisipv6) - Labels Dictionary<string, string>
- (map) User-defined labels (key-value pairs).
- Server
Id int - (int) Server to assign the Floating IP is assigned to.
- Type string
- (string) Type of the Floating IP.
- Name string
- (string) Name of the Floating IP.
- Selector string
- With
Selector string
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Description string
- (string) Description of the Floating IP.
- Home
Location string - (string) Home location.
- Id int
- (int) Unique ID of the Floating IP.
- Ip
Address string - (string) IP Address of the Floating IP.
- Ip
Network string - (string) IPv6 subnet. (Only set if
typeisipv6) - Labels map[string]string
- (map) User-defined labels (key-value pairs).
- Server
Id int - (int) Server to assign the Floating IP is assigned to.
- Type string
- (string) Type of the Floating IP.
- Name string
- (string) Name of the Floating IP.
- Selector string
- With
Selector string
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- description String
- (string) Description of the Floating IP.
- home
Location String - (string) Home location.
- id Integer
- (int) Unique ID of the Floating IP.
- ip
Address String - (string) IP Address of the Floating IP.
- ip
Network String - (string) IPv6 subnet. (Only set if
typeisipv6) - labels Map<String,String>
- (map) User-defined labels (key-value pairs).
- server
Id Integer - (int) Server to assign the Floating IP is assigned to.
- type String
- (string) Type of the Floating IP.
- name String
- (string) Name of the Floating IP.
- selector String
- with
Selector String
- delete
Protection boolean - (bool) Whether delete protection is enabled.
- description string
- (string) Description of the Floating IP.
- home
Location string - (string) Home location.
- id number
- (int) Unique ID of the Floating IP.
- ip
Address string - (string) IP Address of the Floating IP.
- ip
Network string - (string) IPv6 subnet. (Only set if
typeisipv6) - labels {[key: string]: string}
- (map) User-defined labels (key-value pairs).
- server
Id number - (int) Server to assign the Floating IP is assigned to.
- type string
- (string) Type of the Floating IP.
- name string
- (string) Name of the Floating IP.
- selector string
- with
Selector string
- delete_
protection bool - (bool) Whether delete protection is enabled.
- description str
- (string) Description of the Floating IP.
- home_
location str - (string) Home location.
- id int
- (int) Unique ID of the Floating IP.
- ip_
address str - (string) IP Address of the Floating IP.
- ip_
network str - (string) IPv6 subnet. (Only set if
typeisipv6) - labels Mapping[str, str]
- (map) User-defined labels (key-value pairs).
- server_
id int - (int) Server to assign the Floating IP is assigned to.
- type str
- (string) Type of the Floating IP.
- name str
- (string) Name of the Floating IP.
- selector str
- with_
selector str
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- description String
- (string) Description of the Floating IP.
- home
Location String - (string) Home location.
- id Number
- (int) Unique ID of the Floating IP.
- ip
Address String - (string) IP Address of the Floating IP.
- ip
Network String - (string) IPv6 subnet. (Only set if
typeisipv6) - labels Map<String>
- (map) User-defined labels (key-value pairs).
- server
Id Number - (int) Server to assign the Floating IP is assigned to.
- type String
- (string) Type of the Floating IP.
- name String
- (string) Name of the Floating IP.
- selector String
- with
Selector String
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.
Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
