digitalocean_vpc

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

resource "digitalocean_vpc" "example" {
  name     = "example-project-network"
  region   = "nyc3"
  ip_range = "10.10.10.0/24"
}

Resource Assignment

digitalocean_droplet, digitalocean_kubernetes_cluster, digitalocean_load_balancer, and digitalocean_database_cluster resources may be assigned to a VPC by referencing its id. For example:

resource "digitalocean_vpc" "example" {
  name   = "example-project-network"
  region = "nyc3"
}

resource "digitalocean_droplet" "example" {
  name     = "example-01"
  size     = "s-1vcpu-1gb"
  image    = "ubuntu-18-04-x64"
  region   = "nyc3"
  vpc_uuid = digitalocean_vpc.example.id
}

Argument Reference

The following arguments are supported:

Attributes Reference

In addition to the above arguments, the following attributes are exported:

Import

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

terraform import digitalocean_vpc.example 506f78a4-e098-11e5-ad9f-000f53306ae1