vultr.Vpc
Explore with Pulumi AI
Provides a Vultr VPC resource. This can be used to create, read, and delete VPCs on your Vultr account.
Example Usage
Create a new VPC with an automatically generated CIDR block:
import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";
const myVpc = new vultr.Vpc("myVpc", {
description: "my vpc",
region: "ewr",
});
import pulumi
import ediri_vultr as vultr
my_vpc = vultr.Vpc("myVpc",
description="my vpc",
region="ewr")
package main
import (
"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vultr.NewVpc(ctx, "myVpc", &vultr.VpcArgs{
Description: pulumi.String("my vpc"),
Region: pulumi.String("ewr"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;
return await Deployment.RunAsync(() =>
{
var myVpc = new Vultr.Vpc("myVpc", new()
{
Description = "my vpc",
Region = "ewr",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.Vpc;
import com.pulumi.vultr.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 myVpc = new Vpc("myVpc", VpcArgs.builder()
.description("my vpc")
.region("ewr")
.build());
}
}
resources:
myVpc:
type: vultr:Vpc
properties:
description: my vpc
region: ewr
Create a new VPC with a specified CIDR block:
import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";
const myVpc = new vultr.Vpc("myVpc", {
description: "my private vpc",
region: "ewr",
v4Subnet: "10.0.0.0",
v4SubnetMask: 24,
});
import pulumi
import ediri_vultr as vultr
my_vpc = vultr.Vpc("myVpc",
description="my private vpc",
region="ewr",
v4_subnet="10.0.0.0",
v4_subnet_mask=24)
package main
import (
"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vultr.NewVpc(ctx, "myVpc", &vultr.VpcArgs{
Description: pulumi.String("my private vpc"),
Region: pulumi.String("ewr"),
V4Subnet: pulumi.String("10.0.0.0"),
V4SubnetMask: pulumi.Int(24),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;
return await Deployment.RunAsync(() =>
{
var myVpc = new Vultr.Vpc("myVpc", new()
{
Description = "my private vpc",
Region = "ewr",
V4Subnet = "10.0.0.0",
V4SubnetMask = 24,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.Vpc;
import com.pulumi.vultr.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 myVpc = new Vpc("myVpc", VpcArgs.builder()
.description("my private vpc")
.region("ewr")
.v4Subnet("10.0.0.0")
.v4SubnetMask(24)
.build());
}
}
resources:
myVpc:
type: vultr:Vpc
properties:
description: my private vpc
region: ewr
v4Subnet: 10.0.0.0
v4SubnetMask: 24
Create Vpc Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Vpc(name: string, args: VpcArgs, opts?: CustomResourceOptions);
@overload
def Vpc(resource_name: str,
args: VpcArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Vpc(resource_name: str,
opts: Optional[ResourceOptions] = None,
region: Optional[str] = None,
description: Optional[str] = None,
v4_subnet: Optional[str] = None,
v4_subnet_mask: Optional[int] = None)
func NewVpc(ctx *Context, name string, args VpcArgs, opts ...ResourceOption) (*Vpc, error)
public Vpc(string name, VpcArgs args, CustomResourceOptions? opts = null)
type: vultr:Vpc
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var vpcResource = new Vultr.Vpc("vpcResource", new()
{
Region = "string",
Description = "string",
V4Subnet = "string",
V4SubnetMask = 0,
});
example, err := vultr.NewVpc(ctx, "vpcResource", &vultr.VpcArgs{
Region: pulumi.String("string"),
Description: pulumi.String("string"),
V4Subnet: pulumi.String("string"),
V4SubnetMask: pulumi.Int(0),
})
var vpcResource = new Vpc("vpcResource", VpcArgs.builder()
.region("string")
.description("string")
.v4Subnet("string")
.v4SubnetMask(0)
.build());
vpc_resource = vultr.Vpc("vpcResource",
region="string",
description="string",
v4_subnet="string",
v4_subnet_mask=0)
const vpcResource = new vultr.Vpc("vpcResource", {
region: "string",
description: "string",
v4Subnet: "string",
v4SubnetMask: 0,
});
type: vultr:Vpc
properties:
description: string
region: string
v4Subnet: string
v4SubnetMask: 0
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 region ID that you want the VPC to be created in.
- Description string
- The description you want to give your VPC.
- V4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- V4Subnet
Mask int - The number of bits for the netmask in CIDR notation. Example: 32
- Region string
- The region ID that you want the VPC to be created in.
- Description string
- The description you want to give your VPC.
- V4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- V4Subnet
Mask int - The number of bits for the netmask in CIDR notation. Example: 32
- region String
- The region ID that you want the VPC to be created in.
- description String
- The description you want to give your VPC.
- v4Subnet String
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask Integer - The number of bits for the netmask in CIDR notation. Example: 32
- region string
- The region ID that you want the VPC to be created in.
- description string
- The description you want to give your VPC.
- v4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask number - The number of bits for the netmask in CIDR notation. Example: 32
- region str
- The region ID that you want the VPC to be created in.
- description str
- The description you want to give your VPC.
- v4_
subnet str - The IPv4 subnet to be used when attaching instances to this VPC.
- v4_
subnet_ intmask - The number of bits for the netmask in CIDR notation. Example: 32
- region String
- The region ID that you want the VPC to be created in.
- description String
- The description you want to give your VPC.
- v4Subnet String
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask Number - The number of bits for the netmask in CIDR notation. Example: 32
Outputs
All input properties are implicitly available as output properties. Additionally, the Vpc resource produces the following output properties:
- Date
Created string - The date that the VPC was added to your Vultr account.
- Id string
- The provider-assigned unique ID for this managed resource.
- Date
Created string - The date that the VPC was added to your Vultr account.
- Id string
- The provider-assigned unique ID for this managed resource.
- date
Created String - The date that the VPC was added to your Vultr account.
- id String
- The provider-assigned unique ID for this managed resource.
- date
Created string - The date that the VPC was added to your Vultr account.
- id string
- The provider-assigned unique ID for this managed resource.
- date_
created str - The date that the VPC was added to your Vultr account.
- id str
- The provider-assigned unique ID for this managed resource.
- date
Created String - The date that the VPC was added to your Vultr account.
- id String
- The provider-assigned unique ID for this managed resource.
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,
date_created: Optional[str] = None,
description: Optional[str] = None,
region: Optional[str] = None,
v4_subnet: Optional[str] = None,
v4_subnet_mask: Optional[int] = 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.
- Date
Created string - The date that the VPC was added to your Vultr account.
- Description string
- The description you want to give your VPC.
- Region string
- The region ID that you want the VPC to be created in.
- V4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- V4Subnet
Mask int - The number of bits for the netmask in CIDR notation. Example: 32
- Date
Created string - The date that the VPC was added to your Vultr account.
- Description string
- The description you want to give your VPC.
- Region string
- The region ID that you want the VPC to be created in.
- V4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- V4Subnet
Mask int - The number of bits for the netmask in CIDR notation. Example: 32
- date
Created String - The date that the VPC was added to your Vultr account.
- description String
- The description you want to give your VPC.
- region String
- The region ID that you want the VPC to be created in.
- v4Subnet String
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask Integer - The number of bits for the netmask in CIDR notation. Example: 32
- date
Created string - The date that the VPC was added to your Vultr account.
- description string
- The description you want to give your VPC.
- region string
- The region ID that you want the VPC to be created in.
- v4Subnet string
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask number - The number of bits for the netmask in CIDR notation. Example: 32
- date_
created str - The date that the VPC was added to your Vultr account.
- description str
- The description you want to give your VPC.
- region str
- The region ID that you want the VPC to be created in.
- v4_
subnet str - The IPv4 subnet to be used when attaching instances to this VPC.
- v4_
subnet_ intmask - The number of bits for the netmask in CIDR notation. Example: 32
- date
Created String - The date that the VPC was added to your Vultr account.
- description String
- The description you want to give your VPC.
- region String
- The region ID that you want the VPC to be created in.
- v4Subnet String
- The IPv4 subnet to be used when attaching instances to this VPC.
- v4Subnet
Mask Number - The number of bits for the netmask in CIDR notation. Example: 32
Import
VPCs can be imported using the VPC ID
, e.g.
$ pulumi import vultr:index/vpc:Vpc my_vpc 0e04f918-575e-41cb-86f6-d729b354a5a1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- vultr dirien/pulumi-vultr
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vultr
Terraform Provider.