1. Packages
  2. Opentelekomcloud Provider
  3. API Docs
  4. NetworkingFloatingipAssociateV2
opentelekomcloud 1.36.35 published on Monday, Apr 14, 2025 by opentelekomcloud

opentelekomcloud.NetworkingFloatingipAssociateV2

Explore with Pulumi AI

Up-to-date reference of API arguments for VPC floating ip association you can get at documentation portal

Associates a floating IP to a port. This is useful for situations where you have a pre-allocated floating IP or are unable to use the resource/opentelekomcloud_networking_floatingip_v2 to create a floating IP.

Example Usage

Basic FloatingIP associate

import * as pulumi from "@pulumi/pulumi";
import * as opentelekomcloud from "@pulumi/opentelekomcloud";

const port1 = new opentelekomcloud.NetworkingPortV2("port1", {networkId: "a5bbd213-e1d3-49b6-aed1-9df60ea94b9a"});
const fip1 = new opentelekomcloud.NetworkingFloatingipAssociateV2("fip1", {
    floatingIp: "1.2.3.4",
    portId: port1.networkingPortV2Id,
});
Copy
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud

port1 = opentelekomcloud.NetworkingPortV2("port1", network_id="a5bbd213-e1d3-49b6-aed1-9df60ea94b9a")
fip1 = opentelekomcloud.NetworkingFloatingipAssociateV2("fip1",
    floating_ip="1.2.3.4",
    port_id=port1.networking_port_v2_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		port1, err := opentelekomcloud.NewNetworkingPortV2(ctx, "port1", &opentelekomcloud.NetworkingPortV2Args{
			NetworkId: pulumi.String("a5bbd213-e1d3-49b6-aed1-9df60ea94b9a"),
		})
		if err != nil {
			return err
		}
		_, err = opentelekomcloud.NewNetworkingFloatingipAssociateV2(ctx, "fip1", &opentelekomcloud.NetworkingFloatingipAssociateV2Args{
			FloatingIp: pulumi.String("1.2.3.4"),
			PortId:     port1.NetworkingPortV2Id,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;

return await Deployment.RunAsync(() => 
{
    var port1 = new Opentelekomcloud.NetworkingPortV2("port1", new()
    {
        NetworkId = "a5bbd213-e1d3-49b6-aed1-9df60ea94b9a",
    });

    var fip1 = new Opentelekomcloud.NetworkingFloatingipAssociateV2("fip1", new()
    {
        FloatingIp = "1.2.3.4",
        PortId = port1.NetworkingPortV2Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.NetworkingPortV2;
import com.pulumi.opentelekomcloud.NetworkingPortV2Args;
import com.pulumi.opentelekomcloud.NetworkingFloatingipAssociateV2;
import com.pulumi.opentelekomcloud.NetworkingFloatingipAssociateV2Args;
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) {
        var port1 = new NetworkingPortV2("port1", NetworkingPortV2Args.builder()
            .networkId("a5bbd213-e1d3-49b6-aed1-9df60ea94b9a")
            .build());

        var fip1 = new NetworkingFloatingipAssociateV2("fip1", NetworkingFloatingipAssociateV2Args.builder()
            .floatingIp("1.2.3.4")
            .portId(port1.networkingPortV2Id())
            .build());

    }
}
Copy
resources:
  port1:
    type: opentelekomcloud:NetworkingPortV2
    properties:
      networkId: a5bbd213-e1d3-49b6-aed1-9df60ea94b9a
  fip1:
    type: opentelekomcloud:NetworkingFloatingipAssociateV2
    properties:
      floatingIp: 1.2.3.4
      portId: ${port1.networkingPortV2Id}
Copy

Associate an instance with port_id

import * as pulumi from "@pulumi/pulumi";
import * as opentelekomcloud from "@pulumi/opentelekomcloud";

const config = new pulumi.Config();
const keypair = config.requireObject("keypair");
const imageId = config.requireObject("imageId");
const networkName = config.requireObject("networkName");
const thisNetworkingFloatingipV2 = new opentelekomcloud.NetworkingFloatingipV2("thisNetworkingFloatingipV2", {pool: "admin_external_net"});
const thisComputeInstanceV2 = new opentelekomcloud.ComputeInstanceV2("thisComputeInstanceV2", {
    imageId: imageId,
    flavorId: "s2.large.4",
    keyPair: keypair,
    securityGroups: ["default"],
    networks: [{
        name: networkName,
    }],
});
const thisNetworkingFloatingipAssociateV2 = new opentelekomcloud.NetworkingFloatingipAssociateV2("thisNetworkingFloatingipAssociateV2", {
    floatingIp: thisNetworkingFloatingipV2.address,
    portId: thisComputeInstanceV2.networks.apply(networks => networks?.[0]?.port),
});
Copy
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud

config = pulumi.Config()
keypair = config.require_object("keypair")
image_id = config.require_object("imageId")
network_name = config.require_object("networkName")
this_networking_floatingip_v2 = opentelekomcloud.NetworkingFloatingipV2("thisNetworkingFloatingipV2", pool="admin_external_net")
this_compute_instance_v2 = opentelekomcloud.ComputeInstanceV2("thisComputeInstanceV2",
    image_id=image_id,
    flavor_id="s2.large.4",
    key_pair=keypair,
    security_groups=["default"],
    networks=[{
        "name": network_name,
    }])
this_networking_floatingip_associate_v2 = opentelekomcloud.NetworkingFloatingipAssociateV2("thisNetworkingFloatingipAssociateV2",
    floating_ip=this_networking_floatingip_v2.address,
    port_id=this_compute_instance_v2.networks[0].port)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		keypair := cfg.RequireObject("keypair")
		imageId := cfg.RequireObject("imageId")
		networkName := cfg.RequireObject("networkName")
		thisNetworkingFloatingipV2, err := opentelekomcloud.NewNetworkingFloatingipV2(ctx, "thisNetworkingFloatingipV2", &opentelekomcloud.NetworkingFloatingipV2Args{
			Pool: pulumi.String("admin_external_net"),
		})
		if err != nil {
			return err
		}
		thisComputeInstanceV2, err := opentelekomcloud.NewComputeInstanceV2(ctx, "thisComputeInstanceV2", &opentelekomcloud.ComputeInstanceV2Args{
			ImageId:  pulumi.Any(imageId),
			FlavorId: pulumi.String("s2.large.4"),
			KeyPair:  pulumi.Any(keypair),
			SecurityGroups: pulumi.StringArray{
				pulumi.String("default"),
			},
			Networks: opentelekomcloud.ComputeInstanceV2NetworkArray{
				&opentelekomcloud.ComputeInstanceV2NetworkArgs{
					Name: pulumi.Any(networkName),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = opentelekomcloud.NewNetworkingFloatingipAssociateV2(ctx, "thisNetworkingFloatingipAssociateV2", &opentelekomcloud.NetworkingFloatingipAssociateV2Args{
			FloatingIp: thisNetworkingFloatingipV2.Address,
			PortId: pulumi.String(thisComputeInstanceV2.Networks.ApplyT(func(networks []opentelekomcloud.ComputeInstanceV2Network) (*string, error) {
				return &networks[0].Port, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var keypair = config.RequireObject<dynamic>("keypair");
    var imageId = config.RequireObject<dynamic>("imageId");
    var networkName = config.RequireObject<dynamic>("networkName");
    var thisNetworkingFloatingipV2 = new Opentelekomcloud.NetworkingFloatingipV2("thisNetworkingFloatingipV2", new()
    {
        Pool = "admin_external_net",
    });

    var thisComputeInstanceV2 = new Opentelekomcloud.ComputeInstanceV2("thisComputeInstanceV2", new()
    {
        ImageId = imageId,
        FlavorId = "s2.large.4",
        KeyPair = keypair,
        SecurityGroups = new[]
        {
            "default",
        },
        Networks = new[]
        {
            new Opentelekomcloud.Inputs.ComputeInstanceV2NetworkArgs
            {
                Name = networkName,
            },
        },
    });

    var thisNetworkingFloatingipAssociateV2 = new Opentelekomcloud.NetworkingFloatingipAssociateV2("thisNetworkingFloatingipAssociateV2", new()
    {
        FloatingIp = thisNetworkingFloatingipV2.Address,
        PortId = thisComputeInstanceV2.Networks.Apply(networks => networks[0]?.Port),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.NetworkingFloatingipV2;
import com.pulumi.opentelekomcloud.NetworkingFloatingipV2Args;
import com.pulumi.opentelekomcloud.ComputeInstanceV2;
import com.pulumi.opentelekomcloud.ComputeInstanceV2Args;
import com.pulumi.opentelekomcloud.inputs.ComputeInstanceV2NetworkArgs;
import com.pulumi.opentelekomcloud.NetworkingFloatingipAssociateV2;
import com.pulumi.opentelekomcloud.NetworkingFloatingipAssociateV2Args;
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 config = ctx.config();
        final var keypair = config.get("keypair");
        final var imageId = config.get("imageId");
        final var networkName = config.get("networkName");
        var thisNetworkingFloatingipV2 = new NetworkingFloatingipV2("thisNetworkingFloatingipV2", NetworkingFloatingipV2Args.builder()
            .pool("admin_external_net")
            .build());

        var thisComputeInstanceV2 = new ComputeInstanceV2("thisComputeInstanceV2", ComputeInstanceV2Args.builder()
            .imageId(imageId)
            .flavorId("s2.large.4")
            .keyPair(keypair)
            .securityGroups("default")
            .networks(ComputeInstanceV2NetworkArgs.builder()
                .name(networkName)
                .build())
            .build());

        var thisNetworkingFloatingipAssociateV2 = new NetworkingFloatingipAssociateV2("thisNetworkingFloatingipAssociateV2", NetworkingFloatingipAssociateV2Args.builder()
            .floatingIp(thisNetworkingFloatingipV2.address())
            .portId(thisComputeInstanceV2.networks().applyValue(networks -> networks[0].port()))
            .build());

    }
}
Copy
configuration:
  keypair:
    type: dynamic
  imageId:
    type: dynamic
  networkName:
    type: dynamic
resources:
  thisNetworkingFloatingipV2:
    type: opentelekomcloud:NetworkingFloatingipV2
    properties:
      pool: admin_external_net
  thisComputeInstanceV2:
    type: opentelekomcloud:ComputeInstanceV2
    properties:
      imageId: ${imageId}
      flavorId: s2.large.4
      keyPair: ${keypair}
      securityGroups:
        - default
      networks:
        - name: ${networkName}
  thisNetworkingFloatingipAssociateV2:
    type: opentelekomcloud:NetworkingFloatingipAssociateV2
    properties:
      floatingIp: ${thisNetworkingFloatingipV2.address}
      portId: ${thisComputeInstanceV2.networks[0].port}
Copy

Create NetworkingFloatingipAssociateV2 Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NetworkingFloatingipAssociateV2(name: string, args: NetworkingFloatingipAssociateV2Args, opts?: CustomResourceOptions);
@overload
def NetworkingFloatingipAssociateV2(resource_name: str,
                                    args: NetworkingFloatingipAssociateV2Args,
                                    opts: Optional[ResourceOptions] = None)

@overload
def NetworkingFloatingipAssociateV2(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    floating_ip: Optional[str] = None,
                                    port_id: Optional[str] = None,
                                    networking_floatingip_associate_v2_id: Optional[str] = None,
                                    region: Optional[str] = None)
func NewNetworkingFloatingipAssociateV2(ctx *Context, name string, args NetworkingFloatingipAssociateV2Args, opts ...ResourceOption) (*NetworkingFloatingipAssociateV2, error)
public NetworkingFloatingipAssociateV2(string name, NetworkingFloatingipAssociateV2Args args, CustomResourceOptions? opts = null)
public NetworkingFloatingipAssociateV2(String name, NetworkingFloatingipAssociateV2Args args)
public NetworkingFloatingipAssociateV2(String name, NetworkingFloatingipAssociateV2Args args, CustomResourceOptions options)
type: opentelekomcloud:NetworkingFloatingipAssociateV2
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

The following reference example uses placeholder values for all input properties.

var networkingFloatingipAssociateV2Resource = new Opentelekomcloud.NetworkingFloatingipAssociateV2("networkingFloatingipAssociateV2Resource", new()
{
    FloatingIp = "string",
    PortId = "string",
    NetworkingFloatingipAssociateV2Id = "string",
    Region = "string",
});
Copy
example, err := opentelekomcloud.NewNetworkingFloatingipAssociateV2(ctx, "networkingFloatingipAssociateV2Resource", &opentelekomcloud.NetworkingFloatingipAssociateV2Args{
	FloatingIp:                        pulumi.String("string"),
	PortId:                            pulumi.String("string"),
	NetworkingFloatingipAssociateV2Id: pulumi.String("string"),
	Region:                            pulumi.String("string"),
})
Copy
var networkingFloatingipAssociateV2Resource = new NetworkingFloatingipAssociateV2("networkingFloatingipAssociateV2Resource", NetworkingFloatingipAssociateV2Args.builder()
    .floatingIp("string")
    .portId("string")
    .networkingFloatingipAssociateV2Id("string")
    .region("string")
    .build());
Copy
networking_floatingip_associate_v2_resource = opentelekomcloud.NetworkingFloatingipAssociateV2("networkingFloatingipAssociateV2Resource",
    floating_ip="string",
    port_id="string",
    networking_floatingip_associate_v2_id="string",
    region="string")
Copy
const networkingFloatingipAssociateV2Resource = new opentelekomcloud.NetworkingFloatingipAssociateV2("networkingFloatingipAssociateV2Resource", {
    floatingIp: "string",
    portId: "string",
    networkingFloatingipAssociateV2Id: "string",
    region: "string",
});
Copy
type: opentelekomcloud:NetworkingFloatingipAssociateV2
properties:
    floatingIp: string
    networkingFloatingipAssociateV2Id: string
    portId: string
    region: string
Copy

NetworkingFloatingipAssociateV2 Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The NetworkingFloatingipAssociateV2 resource accepts the following input properties:

FloatingIp This property is required. string
IP Address of an existing floating IP.
PortId This property is required. string
ID of an existing port with at least one IP address to associate with this floating IP.
NetworkingFloatingipAssociateV2Id string
Region string
FloatingIp This property is required. string
IP Address of an existing floating IP.
PortId This property is required. string
ID of an existing port with at least one IP address to associate with this floating IP.
NetworkingFloatingipAssociateV2Id string
Region string
floatingIp This property is required. String
IP Address of an existing floating IP.
portId This property is required. String
ID of an existing port with at least one IP address to associate with this floating IP.
networkingFloatingipAssociateV2Id String
region String
floatingIp This property is required. string
IP Address of an existing floating IP.
portId This property is required. string
ID of an existing port with at least one IP address to associate with this floating IP.
networkingFloatingipAssociateV2Id string
region string
floating_ip This property is required. str
IP Address of an existing floating IP.
port_id This property is required. str
ID of an existing port with at least one IP address to associate with this floating IP.
networking_floatingip_associate_v2_id str
region str
floatingIp This property is required. String
IP Address of an existing floating IP.
portId This property is required. String
ID of an existing port with at least one IP address to associate with this floating IP.
networkingFloatingipAssociateV2Id String
region String

Outputs

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

Get an existing NetworkingFloatingipAssociateV2 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?: NetworkingFloatingipAssociateV2State, opts?: CustomResourceOptions): NetworkingFloatingipAssociateV2
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        floating_ip: Optional[str] = None,
        networking_floatingip_associate_v2_id: Optional[str] = None,
        port_id: Optional[str] = None,
        region: Optional[str] = None) -> NetworkingFloatingipAssociateV2
func GetNetworkingFloatingipAssociateV2(ctx *Context, name string, id IDInput, state *NetworkingFloatingipAssociateV2State, opts ...ResourceOption) (*NetworkingFloatingipAssociateV2, error)
public static NetworkingFloatingipAssociateV2 Get(string name, Input<string> id, NetworkingFloatingipAssociateV2State? state, CustomResourceOptions? opts = null)
public static NetworkingFloatingipAssociateV2 get(String name, Output<String> id, NetworkingFloatingipAssociateV2State state, CustomResourceOptions options)
resources:  _:    type: opentelekomcloud:NetworkingFloatingipAssociateV2    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
FloatingIp string
IP Address of an existing floating IP.
NetworkingFloatingipAssociateV2Id string
PortId string
ID of an existing port with at least one IP address to associate with this floating IP.
Region string
FloatingIp string
IP Address of an existing floating IP.
NetworkingFloatingipAssociateV2Id string
PortId string
ID of an existing port with at least one IP address to associate with this floating IP.
Region string
floatingIp String
IP Address of an existing floating IP.
networkingFloatingipAssociateV2Id String
portId String
ID of an existing port with at least one IP address to associate with this floating IP.
region String
floatingIp string
IP Address of an existing floating IP.
networkingFloatingipAssociateV2Id string
portId string
ID of an existing port with at least one IP address to associate with this floating IP.
region string
floating_ip str
IP Address of an existing floating IP.
networking_floatingip_associate_v2_id str
port_id str
ID of an existing port with at least one IP address to associate with this floating IP.
region str
floatingIp String
IP Address of an existing floating IP.
networkingFloatingipAssociateV2Id String
portId String
ID of an existing port with at least one IP address to associate with this floating IP.
region String

Import

Floating IP associations can be imported using the id of the floating IP, e.g.

$ pulumi import opentelekomcloud:index/networkingFloatingipAssociateV2:NetworkingFloatingipAssociateV2 fip 2c7f39f3-702b-48d1-940c-b50384177ee1
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
opentelekomcloud opentelekomcloud/terraform-provider-opentelekomcloud
License
Notes
This Pulumi package is based on the opentelekomcloud Terraform Provider.