1. Packages
  2. DigitalOcean
  3. API Docs
  4. Vpc
DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi

digitalocean.Vpc

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi

    Provides a DigitalOcean VPC resource.

    VPCs are virtual networks containing resources that can communicate with each other in full isolation, using private IP addresses.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new DigitalOcean.Vpc("example", new()
        {
            IpRange = "10.10.10.0/24",
            Region = "nyc3",
        });
    
    });
    
    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 {
    		_, err := digitalocean.NewVpc(ctx, "example", &digitalocean.VpcArgs{
    			IpRange: pulumi.String("10.10.10.0/24"),
    			Region:  pulumi.String("nyc3"),
    		})
    		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.Vpc;
    import com.pulumi.digitalocean.VpcArgs;
    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 example = new Vpc("example", VpcArgs.builder()        
                .ipRange("10.10.10.0/24")
                .region("nyc3")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.Vpc("example",
        ip_range="10.10.10.0/24",
        region="nyc3")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = new digitalocean.Vpc("example", {
        ipRange: "10.10.10.0/24",
        region: "nyc3",
    });
    
    resources:
      example:
        type: digitalocean:Vpc
        properties:
          ipRange: 10.10.10.0/24
          region: nyc3
    

    Resource Assignment

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVpc = new DigitalOcean.Vpc("exampleVpc", new()
        {
            Region = "nyc3",
        });
    
        var exampleDroplet = new DigitalOcean.Droplet("exampleDroplet", new()
        {
            Size = "s-1vcpu-1gb",
            Image = "ubuntu-18-04-x64",
            Region = "nyc3",
            VpcUuid = exampleVpc.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 {
    		exampleVpc, err := digitalocean.NewVpc(ctx, "exampleVpc", &digitalocean.VpcArgs{
    			Region: pulumi.String("nyc3"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDroplet(ctx, "exampleDroplet", &digitalocean.DropletArgs{
    			Size:    pulumi.String("s-1vcpu-1gb"),
    			Image:   pulumi.String("ubuntu-18-04-x64"),
    			Region:  pulumi.String("nyc3"),
    			VpcUuid: exampleVpc.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.Vpc;
    import com.pulumi.digitalocean.VpcArgs;
    import com.pulumi.digitalocean.Droplet;
    import com.pulumi.digitalocean.DropletArgs;
    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 exampleVpc = new Vpc("exampleVpc", VpcArgs.builder()        
                .region("nyc3")
                .build());
    
            var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()        
                .size("s-1vcpu-1gb")
                .image("ubuntu-18-04-x64")
                .region("nyc3")
                .vpcUuid(exampleVpc.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example_vpc = digitalocean.Vpc("exampleVpc", region="nyc3")
    example_droplet = digitalocean.Droplet("exampleDroplet",
        size="s-1vcpu-1gb",
        image="ubuntu-18-04-x64",
        region="nyc3",
        vpc_uuid=example_vpc.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const exampleVpc = new digitalocean.Vpc("exampleVpc", {region: "nyc3"});
    const exampleDroplet = new digitalocean.Droplet("exampleDroplet", {
        size: "s-1vcpu-1gb",
        image: "ubuntu-18-04-x64",
        region: "nyc3",
        vpcUuid: exampleVpc.id,
    });
    
    resources:
      exampleVpc:
        type: digitalocean:Vpc
        properties:
          region: nyc3
      exampleDroplet:
        type: digitalocean:Droplet
        properties:
          size: s-1vcpu-1gb
          image: ubuntu-18-04-x64
          region: nyc3
          vpcUuid: ${exampleVpc.id}
    

    Create Vpc Resource

    new Vpc(name: string, args: VpcArgs, opts?: CustomResourceOptions);
    @overload
    def Vpc(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            ip_range: Optional[str] = None,
            name: Optional[str] = None,
            region: Optional[str] = None)
    @overload
    def Vpc(resource_name: str,
            args: VpcArgs,
            opts: Optional[ResourceOptions] = None)
    func NewVpc(ctx *Context, name string, args VpcArgs, opts ...ResourceOption) (*Vpc, error)
    public Vpc(string name, VpcArgs args, CustomResourceOptions? opts = null)
    public Vpc(String name, VpcArgs args)
    public Vpc(String name, VpcArgs args, CustomResourceOptions options)
    
    type: digitalocean:Vpc
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args VpcArgs
    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 VpcArgs
    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 VpcArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Vpc 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 Vpc resource accepts the following input properties:

    Region string

    The DigitalOcean region slug for the VPC's location.

    Description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    IpRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    Name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    Region string

    The DigitalOcean region slug for the VPC's location.

    Description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    IpRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    Name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region String

    The DigitalOcean region slug for the VPC's location.

    description String

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange String

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name String

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region string

    The DigitalOcean region slug for the VPC's location.

    description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region str

    The DigitalOcean region slug for the VPC's location.

    description str

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ip_range str

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name str

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region String

    The DigitalOcean region slug for the VPC's location.

    description String

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange String

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name String

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    Outputs

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

    CreatedAt string

    The date and time of when the VPC was created.

    Default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    Id string

    The provider-assigned unique ID for this managed resource.

    VpcUrn string

    The uniform resource name (URN) for the VPC.

    CreatedAt string

    The date and time of when the VPC was created.

    Default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    Id string

    The provider-assigned unique ID for this managed resource.

    VpcUrn string

    The uniform resource name (URN) for the VPC.

    createdAt String

    The date and time of when the VPC was created.

    default_ Boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    id String

    The provider-assigned unique ID for this managed resource.

    vpcUrn String

    The uniform resource name (URN) for the VPC.

    createdAt string

    The date and time of when the VPC was created.

    default boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    id string

    The provider-assigned unique ID for this managed resource.

    vpcUrn string

    The uniform resource name (URN) for the VPC.

    created_at str

    The date and time of when the VPC was created.

    default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    id str

    The provider-assigned unique ID for this managed resource.

    vpc_urn str

    The uniform resource name (URN) for the VPC.

    createdAt String

    The date and time of when the VPC was created.

    default Boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    id String

    The provider-assigned unique ID for this managed resource.

    vpcUrn String

    The uniform resource name (URN) for the VPC.

    Look up Existing Vpc Resource

    Get an existing Vpc 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?: VpcState, opts?: CustomResourceOptions): Vpc
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            default: Optional[bool] = None,
            description: Optional[str] = None,
            ip_range: Optional[str] = None,
            name: Optional[str] = None,
            region: Optional[str] = None,
            vpc_urn: Optional[str] = None) -> Vpc
    func GetVpc(ctx *Context, name string, id IDInput, state *VpcState, opts ...ResourceOption) (*Vpc, error)
    public static Vpc Get(string name, Input<string> id, VpcState? state, CustomResourceOptions? opts = null)
    public static Vpc get(String name, Output<String> id, VpcState 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:
    CreatedAt string

    The date and time of when the VPC was created.

    Default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    Description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    IpRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    Name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    Region string

    The DigitalOcean region slug for the VPC's location.

    VpcUrn string

    The uniform resource name (URN) for the VPC.

    CreatedAt string

    The date and time of when the VPC was created.

    Default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    Description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    IpRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    Name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    Region string

    The DigitalOcean region slug for the VPC's location.

    VpcUrn string

    The uniform resource name (URN) for the VPC.

    createdAt String

    The date and time of when the VPC was created.

    default_ Boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    description String

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange String

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name String

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region String

    The DigitalOcean region slug for the VPC's location.

    vpcUrn String

    The uniform resource name (URN) for the VPC.

    createdAt string

    The date and time of when the VPC was created.

    default boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    description string

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange string

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name string

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region string

    The DigitalOcean region slug for the VPC's location.

    vpcUrn string

    The uniform resource name (URN) for the VPC.

    created_at str

    The date and time of when the VPC was created.

    default bool

    A boolean indicating whether or not the VPC is the default one for the region.

    description str

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ip_range str

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name str

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region str

    The DigitalOcean region slug for the VPC's location.

    vpc_urn str

    The uniform resource name (URN) for the VPC.

    createdAt String

    The date and time of when the VPC was created.

    default Boolean

    A boolean indicating whether or not the VPC is the default one for the region.

    description String

    A free-form text field up to a limit of 255 characters to describe the VPC.

    ipRange String

    The range of IP addresses for the VPC in CIDR notation. Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. It may not be larger than /16 or smaller than /24.

    name String

    A name for the VPC. Must be unique and contain alphanumeric characters, dashes, and periods only.

    region String

    The DigitalOcean region slug for the VPC's location.

    vpcUrn String

    The uniform resource name (URN) for the VPC.

    Import

    A VPC can be imported using its id, e.g.

     $ pulumi import digitalocean:index/vpc:Vpc example 506f78a4-e098-11e5-ad9f-000f53306ae1
    

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the digitalocean Terraform Provider.

    digitalocean logo
    DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi