terraform-provider-stackitp.../docs/resources/network_area_route.md
Ruben Hönle 53a3697850
feat(iaas): support for v2 API (#1070)
relates to STACKITTPR-313
2025-12-17 15:40:46 +01:00

3.8 KiB

page_title subcategory description
stackit_network_area_route Resource - stackit Network area route resource schema. Must have a `region` specified in the provider configuration.

stackit_network_area_route (Resource)

Network area route resource schema. Must have a region specified in the provider configuration.

Example Usage

resource "stackit_network_area_route" "example" {
  organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  destination = {
    type  = "cidrv4"
    value = "192.168.0.0/24"
  }
  next_hop = {
    type  = "ipv4"
    value = "192.168.0.0"
  }
  labels = {
    "key" = "value"
  }
}

# Only use the import statement, if you want to import an existing network area route
import {
  to = stackit_network_area_route.import-example
  id = "${var.organization_id},${var.network_area_id},${var.region},${var.network_area_route_id}"
}

Migration of IaaS resources from versions <= v0.74.0

The release of the STACKIT IaaS API v2 provides a lot of new features, but also includes some breaking changes (when coming from v1 of the STACKIT IaaS API) which must be somehow represented on Terraform side. The stackit_network_area_route resource did undergo some changes. See the example below how to migrate your resources.

Breaking change: Network area route resource (stackit_network_area_route)

Configuration for <= v0.74.0

resource "stackit_network_area_route" "example" {
  organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  prefix          = "192.168.0.0/24" # prefix field got removed for provider versions > v0.74.0, use the new destination field instead
  next_hop        = "192.168.0.0" # schema of the next_hop field changed, see below
}

Configuration for > v0.74.0

resource "stackit_network_area_route" "example" {
  organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  destination = { # the new 'destination' field replaces the old 'prefix' field
    type  = "cidrv4"
    value = "192.168.0.0/24" # migration: put the value of the old 'prefix' field here
  }
  next_hop = {
    type  = "ipv4"
    value = "192.168.0.0" # migration: put the value of the old 'next_hop' field here
  }
}

Schema

Required

  • destination (Attributes) Destination of the route. (see below for nested schema)
  • network_area_id (String) The network area ID to which the network area route is associated.
  • next_hop (Attributes) Next hop destination. (see below for nested schema)
  • organization_id (String) STACKIT organization ID to which the network area is associated.

Optional

  • labels (Map of String) Labels are key-value string pairs which can be attached to a resource container
  • region (String) The resource region. If not defined, the provider region is used.

Read-Only

  • id (String) Terraform's internal resource ID. It is structured as "organization_id,network_area_id,region,network_area_route_id".
  • network_area_route_id (String) The network area route ID.

Nested Schema for destination

Required:

  • type (String) CIDRV type. Possible values are: cidrv4, cidrv6. Only cidrv4 is supported currently.
  • value (String) An CIDR string.

Nested Schema for next_hop

Required:

  • type (String) Type of the next hop. Possible values are: blackhole, internet, ipv4, ipv6. Only ipv4 supported currently.

Optional:

  • value (String) Either IPv4 or IPv6 (not set for blackhole and internet). Only IPv4 supported currently.