digitalocean.FloatingIpAssignment
Explore with Pulumi AI
Deprecated: DigitalOcean Floating IPs have been renamed reserved IPs. This resource will be removed in a future release. Please use
digitalocean.ReservedIpAssignment
instead.
Provides a resource for assigning an existing DigitalOcean Floating IP to a Droplet. This makes it easy to provision floating IP addresses that are not tied to the lifecycle of your Droplet.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var foobarFloatingIp = new DigitalOcean.FloatingIp("foobarFloatingIp", new()
{
Region = "sgp1",
});
var foobarDroplet = new DigitalOcean.Droplet("foobarDroplet", new()
{
Size = "s-1vcpu-1gb",
Image = "ubuntu-18-04-x64",
Region = "sgp1",
Ipv6 = true,
PrivateNetworking = true,
});
var foobarFloatingIpAssignment = new DigitalOcean.FloatingIpAssignment("foobarFloatingIpAssignment", new()
{
IpAddress = foobarFloatingIp.IpAddress,
DropletId = foobarDroplet.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
foobarFloatingIp, err := digitalocean.NewFloatingIp(ctx, "foobarFloatingIp", &digitalocean.FloatingIpArgs{
Region: pulumi.String("sgp1"),
})
if err != nil {
return err
}
foobarDroplet, err := digitalocean.NewDroplet(ctx, "foobarDroplet", &digitalocean.DropletArgs{
Size: pulumi.String("s-1vcpu-1gb"),
Image: pulumi.String("ubuntu-18-04-x64"),
Region: pulumi.String("sgp1"),
Ipv6: pulumi.Bool(true),
PrivateNetworking: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = digitalocean.NewFloatingIpAssignment(ctx, "foobarFloatingIpAssignment", &digitalocean.FloatingIpAssignmentArgs{
IpAddress: foobarFloatingIp.IpAddress,
DropletId: foobarDroplet.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.FloatingIp;
import com.pulumi.digitalocean.FloatingIpArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.FloatingIpAssignment;
import com.pulumi.digitalocean.FloatingIpAssignmentArgs;
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 foobarFloatingIp = new FloatingIp("foobarFloatingIp", FloatingIpArgs.builder()
.region("sgp1")
.build());
var foobarDroplet = new Droplet("foobarDroplet", DropletArgs.builder()
.size("s-1vcpu-1gb")
.image("ubuntu-18-04-x64")
.region("sgp1")
.ipv6(true)
.privateNetworking(true)
.build());
var foobarFloatingIpAssignment = new FloatingIpAssignment("foobarFloatingIpAssignment", FloatingIpAssignmentArgs.builder()
.ipAddress(foobarFloatingIp.ipAddress())
.dropletId(foobarDroplet.id())
.build());
}
}
import pulumi
import pulumi_digitalocean as digitalocean
foobar_floating_ip = digitalocean.FloatingIp("foobarFloatingIp", region="sgp1")
foobar_droplet = digitalocean.Droplet("foobarDroplet",
size="s-1vcpu-1gb",
image="ubuntu-18-04-x64",
region="sgp1",
ipv6=True,
private_networking=True)
foobar_floating_ip_assignment = digitalocean.FloatingIpAssignment("foobarFloatingIpAssignment",
ip_address=foobar_floating_ip.ip_address,
droplet_id=foobar_droplet.id)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const foobarFloatingIp = new digitalocean.FloatingIp("foobarFloatingIp", {region: "sgp1"});
const foobarDroplet = new digitalocean.Droplet("foobarDroplet", {
size: "s-1vcpu-1gb",
image: "ubuntu-18-04-x64",
region: "sgp1",
ipv6: true,
privateNetworking: true,
});
const foobarFloatingIpAssignment = new digitalocean.FloatingIpAssignment("foobarFloatingIpAssignment", {
ipAddress: foobarFloatingIp.ipAddress,
dropletId: foobarDroplet.id,
});
resources:
foobarFloatingIp:
type: digitalocean:FloatingIp
properties:
region: sgp1
foobarDroplet:
type: digitalocean:Droplet
properties:
size: s-1vcpu-1gb
image: ubuntu-18-04-x64
region: sgp1
ipv6: true
privateNetworking: true
foobarFloatingIpAssignment:
type: digitalocean:FloatingIpAssignment
properties:
ipAddress: ${foobarFloatingIp.ipAddress}
dropletId: ${foobarDroplet.id}
Create FloatingIpAssignment Resource
new FloatingIpAssignment(name: string, args: FloatingIpAssignmentArgs, opts?: CustomResourceOptions);
@overload
def FloatingIpAssignment(resource_name: str,
opts: Optional[ResourceOptions] = None,
droplet_id: Optional[int] = None,
ip_address: Optional[str] = None)
@overload
def FloatingIpAssignment(resource_name: str,
args: FloatingIpAssignmentArgs,
opts: Optional[ResourceOptions] = None)
func NewFloatingIpAssignment(ctx *Context, name string, args FloatingIpAssignmentArgs, opts ...ResourceOption) (*FloatingIpAssignment, error)
public FloatingIpAssignment(string name, FloatingIpAssignmentArgs args, CustomResourceOptions? opts = null)
public FloatingIpAssignment(String name, FloatingIpAssignmentArgs args)
public FloatingIpAssignment(String name, FloatingIpAssignmentArgs args, CustomResourceOptions options)
type: digitalocean:FloatingIpAssignment
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args FloatingIpAssignmentArgs
- 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 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.
- name String
- The unique name of the resource.
- args FloatingIpAssignmentArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The FloatingIpAssignment resource accepts the following input properties:
- droplet_
id int The ID of Droplet that the Floating IP will be assigned to.
- ip_
address str The Floating IP to assign to the Droplet.
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 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 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,
droplet_id: Optional[int] = None,
ip_address: Optional[str] = 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)
public static FloatingIpAssignment get(String name, Output<String> id, FloatingIpAssignmentState 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.
- droplet_
id int The ID of Droplet that the Floating IP will be assigned to.
- ip_
address str The Floating IP to assign to the Droplet.
Import
Floating IP assignments can be imported using the Floating IP itself and the id
of the Droplet joined with a comma. For example
$ pulumi import digitalocean:index/floatingIpAssignment:FloatingIpAssignment foobar 192.0.2.1,123456
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
digitalocean
Terraform Provider.