OpenStack

Pulumi Official
Package maintained by Pulumi
v3.8.0 published on Monday, Feb 7, 2022 by Pulumi

FloatingIpAssociate

Associate a floating IP to an instance.

Example Usage

Automatically detect the correct network

using Pulumi;
using OpenStack = Pulumi.OpenStack;

class MyStack : Stack
{
    public MyStack()
    {
        var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
        {
            FlavorId = "3",
            ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
            KeyPair = "my_key_pair_name",
            SecurityGroups = 
            {
                "default",
            },
        });
        var fip1FloatingIp = new OpenStack.Networking.FloatingIp("fip1FloatingIp", new OpenStack.Networking.FloatingIpArgs
        {
            Pool = "my_pool",
        });
        var fip1FloatingIpAssociate = new OpenStack.Compute.FloatingIpAssociate("fip1FloatingIpAssociate", new OpenStack.Compute.FloatingIpAssociateArgs
        {
            FloatingIp = fip1FloatingIp.Address,
            InstanceId = instance1.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance1, err := compute.NewInstance(ctx, "instance1", &compute.InstanceArgs{
			FlavorId: pulumi.String("3"),
			ImageId:  pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
			KeyPair:  pulumi.String("my_key_pair_name"),
			SecurityGroups: pulumi.StringArray{
				pulumi.String("default"),
			},
		})
		if err != nil {
			return err
		}
		fip1FloatingIp, err := networking.NewFloatingIp(ctx, "fip1FloatingIp", &networking.FloatingIpArgs{
			Pool: pulumi.String("my_pool"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewFloatingIpAssociate(ctx, "fip1FloatingIpAssociate", &compute.FloatingIpAssociateArgs{
			FloatingIp: fip1FloatingIp.Address,
			InstanceId: instance1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_openstack as openstack

instance1 = openstack.compute.Instance("instance1",
    flavor_id="3",
    image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
    key_pair="my_key_pair_name",
    security_groups=["default"])
fip1_floating_ip = openstack.networking.FloatingIp("fip1FloatingIp", pool="my_pool")
fip1_floating_ip_associate = openstack.compute.FloatingIpAssociate("fip1FloatingIpAssociate",
    floating_ip=fip1_floating_ip.address,
    instance_id=instance1.id)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const instance1 = new openstack.compute.Instance("instance_1", {
    flavorId: "3",
    imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
    keyPair: "my_key_pair_name",
    securityGroups: ["default"],
});
const fip1FloatingIp = new openstack.networking.FloatingIp("fip_1", {
    pool: "my_pool",
});
const fip1FloatingIpAssociate = new openstack.compute.FloatingIpAssociate("fip_1", {
    floatingIp: fip1FloatingIp.address,
    instanceId: instance1.id,
});

Coming soon!

Explicitly set the network to attach to

using Pulumi;
using OpenStack = Pulumi.OpenStack;

class MyStack : Stack
{
    public MyStack()
    {
        var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
        {
            FlavorId = "3",
            ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
            KeyPair = "my_key_pair_name",
            Networks = 
            {
                new OpenStack.Compute.Inputs.InstanceNetworkArgs
                {
                    Name = "my_network",
                },
                new OpenStack.Compute.Inputs.InstanceNetworkArgs
                {
                    Name = "default",
                },
            },
            SecurityGroups = 
            {
                "default",
            },
        });
        var fip1FloatingIp = new OpenStack.Networking.FloatingIp("fip1FloatingIp", new OpenStack.Networking.FloatingIpArgs
        {
            Pool = "my_pool",
        });
        var fip1FloatingIpAssociate = new OpenStack.Compute.FloatingIpAssociate("fip1FloatingIpAssociate", new OpenStack.Compute.FloatingIpAssociateArgs
        {
            FixedIp = instance1.Networks.Apply(networks => networks[1].FixedIpV4),
            FloatingIp = fip1FloatingIp.Address,
            InstanceId = instance1.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance1, err := compute.NewInstance(ctx, "instance1", &compute.InstanceArgs{
			FlavorId: pulumi.String("3"),
			ImageId:  pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
			KeyPair:  pulumi.String("my_key_pair_name"),
			Networks: compute.InstanceNetworkArray{
				&compute.InstanceNetworkArgs{
					Name: pulumi.String("my_network"),
				},
				&compute.InstanceNetworkArgs{
					Name: pulumi.String("default"),
				},
			},
			SecurityGroups: pulumi.StringArray{
				pulumi.String("default"),
			},
		})
		if err != nil {
			return err
		}
		fip1FloatingIp, err := networking.NewFloatingIp(ctx, "fip1FloatingIp", &networking.FloatingIpArgs{
			Pool: pulumi.String("my_pool"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewFloatingIpAssociate(ctx, "fip1FloatingIpAssociate", &compute.FloatingIpAssociateArgs{
			FixedIp: instance1.Networks.ApplyT(func(networks []compute.InstanceNetwork) (string, error) {
				return networks[1].FixedIpV4, nil
			}).(pulumi.StringOutput),
			FloatingIp: fip1FloatingIp.Address,
			InstanceId: instance1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_openstack as openstack

instance1 = openstack.compute.Instance("instance1",
    flavor_id="3",
    image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
    key_pair="my_key_pair_name",
    networks=[
        openstack.compute.InstanceNetworkArgs(
            name="my_network",
        ),
        openstack.compute.InstanceNetworkArgs(
            name="default",
        ),
    ],
    security_groups=["default"])
fip1_floating_ip = openstack.networking.FloatingIp("fip1FloatingIp", pool="my_pool")
fip1_floating_ip_associate = openstack.compute.FloatingIpAssociate("fip1FloatingIpAssociate",
    fixed_ip=instance1.networks[1].fixed_ip_v4,
    floating_ip=fip1_floating_ip.address,
    instance_id=instance1.id)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const instance1 = new openstack.compute.Instance("instance_1", {
    flavorId: "3",
    imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
    keyPair: "my_key_pair_name",
    networks: [
        {
            name: "my_network",
        },
        {
            name: "default",
        },
    ],
    securityGroups: ["default"],
});
const fip1FloatingIp = new openstack.networking.FloatingIp("fip_1", {
    pool: "my_pool",
});
const fip1FloatingIpAssociate = new openstack.compute.FloatingIpAssociate("fip_1", {
    fixedIp: instance1.networks.apply(networks => networks[1].fixedIpV4!),
    floatingIp: fip1FloatingIp.address,
    instanceId: instance1.id,
});

Coming soon!

Create a FloatingIpAssociate Resource

new FloatingIpAssociate(name: string, args: FloatingIpAssociateArgs, opts?: CustomResourceOptions);
@overload
def FloatingIpAssociate(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        fixed_ip: Optional[str] = None,
                        floating_ip: Optional[str] = None,
                        instance_id: Optional[str] = None,
                        region: Optional[str] = None,
                        wait_until_associated: Optional[bool] = None)
@overload
def FloatingIpAssociate(resource_name: str,
                        args: FloatingIpAssociateArgs,
                        opts: Optional[ResourceOptions] = None)
func NewFloatingIpAssociate(ctx *Context, name string, args FloatingIpAssociateArgs, opts ...ResourceOption) (*FloatingIpAssociate, error)
public FloatingIpAssociate(string name, FloatingIpAssociateArgs args, CustomResourceOptions? opts = null)
public FloatingIpAssociate(String name, FloatingIpAssociateArgs args)
public FloatingIpAssociate(String name, FloatingIpAssociateArgs args, CustomResourceOptions options)
type: openstack:compute:FloatingIpAssociate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FloatingIpAssociateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FloatingIpAssociateArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FloatingIpAssociateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FloatingIpAssociateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FloatingIpAssociateArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

FloatingIpAssociate Resource Properties

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

Inputs

The FloatingIpAssociate resource accepts the following input properties:

FloatingIp string

The floating IP to associate.

InstanceId string

The instance to associte the floating IP with.

FixedIp string

The specific IP address to direct traffic to.

Region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

WaitUntilAssociated bool
FloatingIp string

The floating IP to associate.

InstanceId string

The instance to associte the floating IP with.

FixedIp string

The specific IP address to direct traffic to.

Region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

WaitUntilAssociated bool
floatingIp String

The floating IP to associate.

instanceId String

The instance to associte the floating IP with.

fixedIp String

The specific IP address to direct traffic to.

region String

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated Boolean
floatingIp string

The floating IP to associate.

instanceId string

The instance to associte the floating IP with.

fixedIp string

The specific IP address to direct traffic to.

region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated boolean
floating_ip str

The floating IP to associate.

instance_id str

The instance to associte the floating IP with.

fixed_ip str

The specific IP address to direct traffic to.

region str

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

wait_until_associated bool
floatingIp String

The floating IP to associate.

instanceId String

The instance to associte the floating IP with.

fixedIp String

The specific IP address to direct traffic to.

region String

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated Boolean

Outputs

All input properties are implicitly available as output properties. Additionally, the FloatingIpAssociate 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 string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing FloatingIpAssociate Resource

Get an existing FloatingIpAssociate 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?: FloatingIpAssociateState, opts?: CustomResourceOptions): FloatingIpAssociate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        fixed_ip: Optional[str] = None,
        floating_ip: Optional[str] = None,
        instance_id: Optional[str] = None,
        region: Optional[str] = None,
        wait_until_associated: Optional[bool] = None) -> FloatingIpAssociate
func GetFloatingIpAssociate(ctx *Context, name string, id IDInput, state *FloatingIpAssociateState, opts ...ResourceOption) (*FloatingIpAssociate, error)
public static FloatingIpAssociate Get(string name, Input<string> id, FloatingIpAssociateState? state, CustomResourceOptions? opts = null)
public static FloatingIpAssociate get(String name, Output<String> id, FloatingIpAssociateState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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:
FixedIp string

The specific IP address to direct traffic to.

FloatingIp string

The floating IP to associate.

InstanceId string

The instance to associte the floating IP with.

Region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

WaitUntilAssociated bool
FixedIp string

The specific IP address to direct traffic to.

FloatingIp string

The floating IP to associate.

InstanceId string

The instance to associte the floating IP with.

Region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

WaitUntilAssociated bool
fixedIp String

The specific IP address to direct traffic to.

floatingIp String

The floating IP to associate.

instanceId String

The instance to associte the floating IP with.

region String

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated Boolean
fixedIp string

The specific IP address to direct traffic to.

floatingIp string

The floating IP to associate.

instanceId string

The instance to associte the floating IP with.

region string

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated boolean
fixed_ip str

The specific IP address to direct traffic to.

floating_ip str

The floating IP to associate.

instance_id str

The instance to associte the floating IP with.

region str

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

wait_until_associated bool
fixedIp String

The specific IP address to direct traffic to.

floatingIp String

The floating IP to associate.

instanceId String

The instance to associte the floating IP with.

region String

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new floatingip_associate.

waitUntilAssociated Boolean

Import

This resource can be imported by specifying all three arguments, separated by a forward slash

 $ pulumi import openstack:compute/floatingIpAssociate:FloatingIpAssociate fip_1 <floating_ip>/<instance_id>/<fixed_ip>

Package Details

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

This Pulumi package is based on the openstack Terraform Provider.