digitalocean_vpc

Retrieve information about a VPC for use in other resources.

This data source provides all of the VPC's properties as configured on your DigitalOcean account. This is useful if the VPC in question is not managed by Terraform or you need to utilize any of the VPC's data.

VPCs may be looked up by id or name. Specifying a region will return that that region's default VPC.

Example Usage

VPC By Name

data "digitalocean_vpc" "example" {
  name = "example-network"
}

Reuse the data about a VPC to assign a Droplet to it:

data "digitalocean_vpc" "example" {
  name = "example-network"
}

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

Argument Reference

The following arguments are supported and are mutually exclusive:

Attributes Reference

The following attributes are exported: