Resource

dcloud_subnet

A share of a VPC's addresses in one availability zone. A VPC holds several, as long as their ranges do not overlap. Deleting one is refused while an instance or database still holds an address in it.

Example Usage

# Two subnets of one VPC, in different availability zones.
resource "dcloud_subnet" "a" {
  vpc_id     = dcloud_vpc.main.id
  cidr_block = "10.10.1.0/24"
  name       = "app-a"
}

resource "dcloud_subnet" "b" {
  vpc_id               = dcloud_vpc.main.id
  cidr_block           = "10.10.2.0/24"
  availability_zone_id = "de1b"
  name                 = "app-b"
  tags                 = { tier = "app" }
}

Schema

Required

  • cidr_block (String) IPv4 range inside the VPC, e.g. 10.0.1.0/24. 9 to 18 characters. Changing it replaces the resource.
  • vpc_id (String) The VPC whose range the subnet takes its addresses from. Changing it replaces the resource.

Optional

  • availability_zone_id (String) The zone (e.g. de1b); default de1a. Must match ^[a-z]+[0-9]+[a-z]$. Changing it replaces the resource.
  • name (String) A display name; omitted: none. Up to 64 characters. Changing it replaces the resource.
  • project (String) The project (its slug) the resource lives in. At create: this, else the provider's project, else Default. Changing it moves the resource and its parts; it is never replaced.
  • tags (Map of String) Tags, key → value. Once set here, only these keys are managed; tags Deutsche Cloud adds itself are left alone.

Read-Only

  • available_ip_count (Number) Usable addresses in the range.
  • id (String) The resource's id.
  • is_public (Boolean) Whether it is public.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_subnet.a <subnet-id>

Generated from the provider's schema.