Managing Services
Updated
by DE-CIX PDM Team
Creating and Managing Services Using the IX-API Terraform Provider
This page shows how to create and manage DE-CIX Cloud ROUTER resources and related configurations. Please refer to the official provider documentation for the specific version of the provider to learn about the properties of the resources and data sources in more detail.
Recommended order:
- Create the Cloud ROUTER (VRF)
- Attach network services (P2P VC or Cloud VC)
- Configure routing policies and prefix lists
- Add static routes if required
Cloud ROUTER (VRF)
The following terraform code shows a set of data source and a resource. The resource created here is the Cloud ROUTER (VRF), with some properties sources from different data sources for ease of use within the code.
data "ixapi_account" "account" {
name = var.account_name
}
data "ixapi_metro_area_network" "fra" {
name = "FRA"
}
### Cloud Router Product Offering with 100 mbps throughput and a contract period of 1 month
data "ixapi_de_cix_product_offerings_cloud_vrf" "fra_100" {
name = "Cloud ROUTER"
bandwidth = 100
contract_period = "P1M"
service_metro_area_network = data.ixapi_metro_area_network.fra.id
}
resource "ixapi_de_cix_cloud_router" "main" {
managing_account = data.ixapi_account.account.id
consuming_account = data.ixapi_account.account.id
billing_account = data.ixapi_account.account.id
product_offering = data.ixapi_de_cix_product_offerings_cloud_vrf.fra_100.product_offerings[0].id
asn = 65000
capacity = data.ixapi_de_cix_product_offerings_cloud_vrf.fra_100.product_offerings[0].bandwitdh_max
external_ref = "my-cloud-router"
}
|
Argument |
Description |
|
|
ID of the Cloud ROUTER product offering. Here it's taken from the |
|
|
BGP Autonomous System Number for this Cloud Router (VRF) |
|
|
Bandwidth in Mbit/s, within the offering's min/max range. Here it's the maximum bandwidth of the selected product offering |
|
|
Free-form reference field for your own tracking |
Account fields
managing_account, consuming_account, and billing_account appear on every resource. For most customers, all three will have the same value — your DE-CIX account ID. The data source ixapi_account can be useful to look for it via the account name.
They can differ in reseller or sub-account scenarios:
managing_account— the account that owns and manages this resourceconsuming_account— the account that uses the servicebilling_account— the account that is billed for the service
Computed attributes available after creation: id, state.
Network Service Configs (NSC)
A Network Service Config (NSC) attaches a Cloud ROUTER to a network service and defines one BGP session. The Cloud ROUTER must exist before any NSC is created.
There are two types:
- P2P VC (point-to-point virtual circuit)
- Cloud VC (cloud connectivity)
Network Service Config: Point-to-Point Virtual Circuit (P2P VC)
resource "ixapi_de_cix_cloud_router_network_service_config_p2p_vc" "session" {
managing_account = var.account_id
consuming_account = var.account_id
billing_account = var.account_id
cloud_router = ixapi_de_cix_cloud_router.main.id
network_service = var.p2p_vc_network_service_id
network_connection = var.network_connection_id
address = "10.0.1.1/30"
bgp_neighbor = "10.0.1.2"
bgp_neighbor_asn = 64512
bgp_password = var.bgp_password
admin_status = "enabled"
bfd_enabled = true
as_override = false
external_ref = "p2p-session-fra"
vlan_config {
vlan_type = "dot1q"
vlan_id = 100
}
}
VLAN types
|
|
Required attributes |
|
|
|
|
|
|
|
|
— |
Computed attributes available after creation: id, state.
Network Service Config: Cloud Virtual Circuit (Cloud VC)
resource "ixapi_de_cix_cloud_router_network_service_config_cloud_vc" "cloud_session" {
managing_account = var.account_id
consuming_account = var.account_id
billing_account = var.account_id
cloud_router = ixapi_de_cix_cloud_router.main.id
network_service = var.cloud_vc_network_service_id
address = "10.0.2.1/30"
bgp_neighbor = "10.0.2.2"
bgp_neighbor_asn = 64513
bgp_password = var.bgp_password
admin_status = "enabled"
bfd_enabled = true
as_override = false
handover = 1
external_ref = "cloud-session-fra"
}
|
Argument |
Description |
|
|
Cloud side diversity. For most cloud providers this is always |
|
|
Free-form reference field for your own tracking |
Computed attributes available after creation: id, state.
AS Override
as_override is available for both P2P VC and Cloud VC Network Service Configs. It can be enabled when the remote network uses the same ASN at multiple connection endpoints.
A common use case is Oracle Cloud Infrastructure (OCI), which uses ASN 31898 across its regions. When connecting multiple OCI regions to the same Cloud ROUTER, enable as_override on every affected Network Service Config. This prevents OCI from rejecting routes from another region because its own ASN appears in the AS path.
resource "ixapi_de_cix_cloud_router_network_service_config_cloud_vc" "oci_frankfurt" {
# Other connection attributes omitted
bgp_neighbor_asn = 31898
as_override = true
}
resource "ixapi_de_cix_cloud_router_network_service_config_cloud_vc" "oci_amsterdam" {
# Other connection attributes omitted
bgp_neighbor_asn = 31898
as_override = true
}
as_override is optional and defaults to false. Because it is configured when the Network Service Config is created, changing its value causes Terraform to replace that configuration.
For details on the BGP behavior and recommended routing-policy safeguards, see AS Override for Cloud ROUTER connections.
Prefix Lists
A prefix list is a named set of IP prefixes used as match conditions in routing policies.
resource "ixapi_de_cix_cloud_router_prefix_list" "customer_nets" {
name = "customer-networks"
managing_account = var.account_id
consuming_account = var.account_id
match_list {
prefix = "10.0.0.0/8"
min_length = 16
max_length = 24
}
match_list {
prefix = "192.168.0.0/16"
max_length = 24
}
}
Each match_list entry accepts:
|
Argument |
Description |
|
|
IP prefix in CIDR notation (required) |
|
|
Minimum prefix length to match. Defaults to the prefix length. |
|
|
Maximum prefix length to match |
Routing Policies
A routing policy is an ordered list of entries. Each entry optionally matches a prefix list and applies an action.
resource "ixapi_de_cix_cloud_router_policy" "inbound" {
name = "inbound-policy"
managing_account = var.account_id
consuming_account = var.account_id
entries {
sequence_number = 10
match_prefix_list = ixapi_de_cix_cloud_router_prefix_list.customer_nets.name
action {
filter = "accept"
local_preference = 200
}
}
entries {
sequence_number = 20
action {
filter = "reject"
}
}
}
Policy action attributes:
|
Argument |
Values |
Description |
|
|
|
Whether to accept or reject matched routes (required) |
|
|
integer |
Set BGP local preference (accept only) |
|
|
integer |
Number of times to prepend the local AS (accept only) |
An entry without match_prefix_list matches all routes. This is typically used as a final catch-all reject entry.
Static Routes
Static routes are added to a Cloud ROUTER VRF and can be scoped to specific NSCs.
resource "ixapi_de_cix_cloud_router_static_route" "aggregate" {
name = "default-aggregate"
prefix = "10.0.0.0/8"
next_hop = "aggregate"
network_service_configs = [ixapi_de_cix_cloud_router_network_service_config_p2p_vc.session.id]
}
The next_hop field accepts:
"aggregate"— summarizes the prefix without forwarding to a specific next hop- An IP address — forwards traffic to a specific next hop address
Data Sources
Data sources let you query existing IX-API objects without managing them as resources.
Discover available product offerings
data "ixapi_de_cix_product_offerings_cloud_vrf" "available" {}
Advertised routes
data "ixapi_de_cix_cloud_router_network_service_config_advertised_routes" "p2p" {
network_service_config_id = ixapi_de_cix_cloud_router_network_service_config_p2p_vc.session.id
}
Received routes
data "ixapi_de_cix_cloud_router_network_service_config_received_routes" "p2p" {
network_service_config_id = ixapi_de_cix_cloud_router_network_service_config_p2p_vc.session.id
}
VRF routing table
data "ixapi_de_cix_cloud_router_routes" "main" {
vrf = ixapi_de_cix_cloud_router.main.id
}
BGP session state
data "ixapi_de_cix_cloud_router_bgp_state" "session" {
nsc_id = ixapi_de_cix_cloud_router_network_service_config_p2p_vc.session.id
}
BFD session state
data "ixapi_de_cix_cloud_router_bfd_state" "session" {
nsc_id = ixapi_de_cix_cloud_router_network_service_config_p2p_vc.session.id
}
VRF ARP table
data "ixapi_de_cix_cloud_router_vrf_arp_table" "main" {
vrf = ixapi_de_cix_cloud_router.main.id
}