digitalocean.ReservedIpAssignment
Explore with Pulumi AI
Provides a resource for assigning an existing DigitalOcean reserved IP to a Droplet. This makes it easy to provision reserved 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 exampleReservedIp = new DigitalOcean.ReservedIp("exampleReservedIp", new()
{
Region = "nyc3",
});
var exampleDroplet = new DigitalOcean.Droplet("exampleDroplet", new()
{
Size = "s-1vcpu-1gb",
Image = "ubuntu-22-04-x64",
Region = "nyc3",
Ipv6 = true,
PrivateNetworking = true,
});
var exampleReservedIpAssignment = new DigitalOcean.ReservedIpAssignment("exampleReservedIpAssignment", new()
{
IpAddress = exampleReservedIp.IpAddress,
DropletId = exampleDroplet.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 {
exampleReservedIp, err := digitalocean.NewReservedIp(ctx, "exampleReservedIp", &digitalocean.ReservedIpArgs{
Region: pulumi.String("nyc3"),
})
if err != nil {
return err
}
exampleDroplet, err := digitalocean.NewDroplet(ctx, "exampleDroplet", &digitalocean.DropletArgs{
Size: pulumi.String("s-1vcpu-1gb"),
Image: pulumi.String("ubuntu-22-04-x64"),
Region: pulumi.String("nyc3"),
Ipv6: pulumi.Bool(true),
PrivateNetworking: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = digitalocean.NewReservedIpAssignment(ctx, "exampleReservedIpAssignment", &digitalocean.ReservedIpAssignmentArgs{
IpAddress: exampleReservedIp.IpAddress,
DropletId: exampleDroplet.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.ReservedIp;
import com.pulumi.digitalocean.ReservedIpArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.ReservedIpAssignment;
import com.pulumi.digitalocean.ReservedIpAssignmentArgs;
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 exampleReservedIp = new ReservedIp("exampleReservedIp", ReservedIpArgs.builder()
.region("nyc3")
.build());
var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
.size("s-1vcpu-1gb")
.image("ubuntu-22-04-x64")
.region("nyc3")
.ipv6(true)
.privateNetworking(true)
.build());
var exampleReservedIpAssignment = new ReservedIpAssignment("exampleReservedIpAssignment", ReservedIpAssignmentArgs.builder()
.ipAddress(exampleReservedIp.ipAddress())
.dropletId(exampleDroplet.id())
.build());
}
}
import pulumi
import pulumi_digitalocean as digitalocean
example_reserved_ip = digitalocean.ReservedIp("exampleReservedIp", region="nyc3")
example_droplet = digitalocean.Droplet("exampleDroplet",
size="s-1vcpu-1gb",
image="ubuntu-22-04-x64",
region="nyc3",
ipv6=True,
private_networking=True)
example_reserved_ip_assignment = digitalocean.ReservedIpAssignment("exampleReservedIpAssignment",
ip_address=example_reserved_ip.ip_address,
droplet_id=example_droplet.id)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const exampleReservedIp = new digitalocean.ReservedIp("exampleReservedIp", {region: "nyc3"});
const exampleDroplet = new digitalocean.Droplet("exampleDroplet", {
size: "s-1vcpu-1gb",
image: "ubuntu-22-04-x64",
region: "nyc3",
ipv6: true,
privateNetworking: true,
});
const exampleReservedIpAssignment = new digitalocean.ReservedIpAssignment("exampleReservedIpAssignment", {
ipAddress: exampleReservedIp.ipAddress,
dropletId: exampleDroplet.id,
});
resources:
exampleReservedIp:
type: digitalocean:ReservedIp
properties:
region: nyc3
exampleDroplet:
type: digitalocean:Droplet
properties:
size: s-1vcpu-1gb
image: ubuntu-22-04-x64
region: nyc3
ipv6: true
privateNetworking: true
exampleReservedIpAssignment:
type: digitalocean:ReservedIpAssignment
properties:
ipAddress: ${exampleReservedIp.ipAddress}
dropletId: ${exampleDroplet.id}
Create ReservedIpAssignment Resource
new ReservedIpAssignment(name: string, args: ReservedIpAssignmentArgs, opts?: CustomResourceOptions);
@overload
def ReservedIpAssignment(resource_name: str,
opts: Optional[ResourceOptions] = None,
droplet_id: Optional[int] = None,
ip_address: Optional[str] = None)
@overload
def ReservedIpAssignment(resource_name: str,
args: ReservedIpAssignmentArgs,
opts: Optional[ResourceOptions] = None)
func NewReservedIpAssignment(ctx *Context, name string, args ReservedIpAssignmentArgs, opts ...ResourceOption) (*ReservedIpAssignment, error)
public ReservedIpAssignment(string name, ReservedIpAssignmentArgs args, CustomResourceOptions? opts = null)
public ReservedIpAssignment(String name, ReservedIpAssignmentArgs args)
public ReservedIpAssignment(String name, ReservedIpAssignmentArgs args, CustomResourceOptions options)
type: digitalocean:ReservedIpAssignment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ReservedIpAssignmentArgs
- 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 ReservedIpAssignmentArgs
- 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 ReservedIpAssignmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ReservedIpAssignmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ReservedIpAssignmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ReservedIpAssignment 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 ReservedIpAssignment resource accepts the following input properties:
- droplet_
id int The ID of Droplet that the reserved IP will be assigned to.
- ip_
address str The reserved IP to assign to the Droplet.
Outputs
All input properties are implicitly available as output properties. Additionally, the ReservedIpAssignment 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 ReservedIpAssignment Resource
Get an existing ReservedIpAssignment 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?: ReservedIpAssignmentState, opts?: CustomResourceOptions): ReservedIpAssignment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
droplet_id: Optional[int] = None,
ip_address: Optional[str] = None) -> ReservedIpAssignment
func GetReservedIpAssignment(ctx *Context, name string, id IDInput, state *ReservedIpAssignmentState, opts ...ResourceOption) (*ReservedIpAssignment, error)
public static ReservedIpAssignment Get(string name, Input<string> id, ReservedIpAssignmentState? state, CustomResourceOptions? opts = null)
public static ReservedIpAssignment get(String name, Output<String> id, ReservedIpAssignmentState 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 reserved IP will be assigned to.
- ip_
address str The reserved IP to assign to the Droplet.
Import
Reserved IP assignments can be imported using the reserved IP itself and the id
of the Droplet joined with a comma. For example
$ pulumi import digitalocean:index/reservedIpAssignment:ReservedIpAssignment 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.