Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

FloatingIpAssignment

Provides a Hetzner Cloud Floating IP Assignment to assign a Floating IP to a Hetzner Cloud Server. Deleting a Floating IP Assignment will unassign the Floating IP from the Server.

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var node1 = new HCloud.Server("node1", new HCloud.ServerArgs
        {
            Image = "debian-9",
            ServerType = "cx11",
            Datacenter = "fsn1-dc8",
        });
        var master = new HCloud.FloatingIp("master", new HCloud.FloatingIpArgs
        {
            Type = "ipv4",
            HomeLocation = "nbg1",
        });
        var main = new HCloud.FloatingIpAssignment("main", new HCloud.FloatingIpAssignmentArgs
        {
            FloatingIpId = master.Id,
            ServerId = node1.Id,
        });
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        node1, err := hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
            Image:      pulumi.String("debian-9"),
            ServerType: pulumi.String("cx11"),
            Datacenter: pulumi.String("fsn1-dc8"),
        })
        if err != nil {
            return err
        }
        master, err := hcloud.NewFloatingIp(ctx, "master", &hcloud.FloatingIpArgs{
            Type:         pulumi.String("ipv4"),
            HomeLocation: pulumi.String("nbg1"),
        })
        if err != nil {
            return err
        }
        _, err = hcloud.NewFloatingIpAssignment(ctx, "main", &hcloud.FloatingIpAssignmentArgs{
            FloatingIpId: master.ID(),
            ServerId:     node1.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11",
    datacenter="fsn1-dc8")
master = hcloud.FloatingIp("master",
    type="ipv4",
    home_location="nbg1")
main = hcloud.FloatingIpAssignment("main",
    floating_ip_id=master.id,
    server_id=node1.id)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const node1 = new hcloud.Server("node1", {
    image: "debian-9",
    serverType: "cx11",
    datacenter: "fsn1-dc8",
});
const master = new hcloud.FloatingIp("master", {
    type: "ipv4",
    homeLocation: "nbg1",
});
const main = new hcloud.FloatingIpAssignment("main", {
    floatingIpId: master.id,
    serverId: node1.id,
});

Create a FloatingIpAssignment Resource

new FloatingIpAssignment(name: string, args: FloatingIpAssignmentArgs, opts?: CustomResourceOptions);
def FloatingIpAssignment(resource_name: str, opts: Optional[ResourceOptions] = None, floating_ip_id: Optional[int] = None, server_id: Optional[int] = None)
func NewFloatingIpAssignment(ctx *Context, name string, args FloatingIpAssignmentArgs, opts ...ResourceOption) (*FloatingIpAssignment, error)
public FloatingIpAssignment(string name, FloatingIpAssignmentArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args FloatingIpAssignmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FloatingIpAssignmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FloatingIpAssignmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

FloatingIpAssignment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The FloatingIpAssignment resource accepts the following input properties:

FloatingIpId int

ID of the Floating IP.

ServerId int

Server to assign the Floating IP to.

FloatingIpId int

ID of the Floating IP.

ServerId int

Server to assign the Floating IP to.

floatingIpId number

ID of the Floating IP.

serverId number

Server to assign the Floating IP to.

floating_ip_id int

ID of the Floating IP.

server_id int

Server to assign the Floating IP to.

Outputs

All input properties are implicitly available as output properties. Additionally, the FloatingIpAssignment resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing FloatingIpAssignment Resource

Get an existing FloatingIpAssignment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FloatingIpAssignmentState, opts?: CustomResourceOptions): FloatingIpAssignment
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, floating_ip_id: Optional[int] = None, server_id: Optional[int] = None) -> FloatingIpAssignment
func GetFloatingIpAssignment(ctx *Context, name string, id IDInput, state *FloatingIpAssignmentState, opts ...ResourceOption) (*FloatingIpAssignment, error)
public static FloatingIpAssignment Get(string name, Input<string> id, FloatingIpAssignmentState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

FloatingIpId int

ID of the Floating IP.

ServerId int

Server to assign the Floating IP to.

FloatingIpId int

ID of the Floating IP.

ServerId int

Server to assign the Floating IP to.

floatingIpId number

ID of the Floating IP.

serverId number

Server to assign the Floating IP to.

floating_ip_id int

ID of the Floating IP.

server_id int

Server to assign the Floating IP to.

Import

Floating IP Assignments can be imported using the floating_ip_id

 $ pulumi import hcloud:index/floatingIpAssignment:FloatingIpAssignment myfloatingipassignment <floating_ip_id>

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.