Provider Configuration

DE-CIX PDM Team Updated by DE-CIX PDM Team

Provider Configuration

The provider block defines how Terraform connects to the IX-API endpoint.

Basic Configuration

terraform {
required_providers {
ixapi = {
source = "registry.terraform.io/ix-api-net/ixapi"
version = "~> 1.0"
}
}
}

provider "ixapi" {
api = "https://ixapi.de-cix.net/api/v2"
api_key = var.api_key
api_secret = var.api_secret
}

Provider Arguments

Argument

Type

Required

Description

api

string

yes*

The IX-API base URL, e.g. https://ixapi.de-cix.net/api/v2

api_key

string

yes*

Your IX-API key

api_secret

string

no

Your IX-API secret. Can be omitted if set via $IX_API_SECRET

auth

string

no

Authentication strategy: legacy (default) or oauth2

oauth2_token_url

string

no

OAuth2 token endpoint. Required when auth = "oauth2"

oauth2_scopes

string

no

Comma-separated OAuth2 scopes. Optional

extension_de_cix_cloud_router_enabled

bool

no

Enables DE-CIX Cloud ROUTER resources and data sources. Defaults to false

* Can be omitted if set via the corresponding environment variable.

Environment Variables

Environment Variable

Corresponding Argument

IX_API_HOST

api

IX_API_KEY

api_key

IX_API_SECRET

api_secret

IX_API_AUTH

auth

IX_API_OAUTH2_TOKEN_URL

oauth2_token_url

IX_API_OAUTH2_SCOPES

oauth2_scopes

Note: extension_de_cix_cloud_router_enabled cannot be set via an environment variable and must always be declared explicitly in the provider block.

Authentication

For authentication setup and examples, see Getting Started.

Enabling the Cloud ROUTER Extension

provider "ixapi" {
api = "https://ixapi.de-cix.net/api/v2"
api_key = var.api_key
api_secret = var.api_secret
extension_de_cix_cloud_router_enabled = true
}

Without extension_de_cix_cloud_router_enabled = true, all ixapi_de_cix_* resources and data sources are unavailable and will produce an error during terraform plan.

When this flag is true, the following resource and data source types become available:

Resources

Data Sources

ixapi_de_cix_cloud_router

ixapi_de_cix_product_offerings_cloud_vrf

ixapi_de_cix_cloud_router_network_service_config_p2p_vc

ixapi_de_cix_cloud_router_network_service_configs_p2p_vc

ixapi_de_cix_cloud_router_network_service_config_cloud_vc

ixapi_de_cix_cloud_router_network_service_configs_cloud_vc

ixapi_de_cix_cloud_router_prefix_list

ixapi_de_cix_cloud_router_prefix_list / _prefix_lists

ixapi_de_cix_cloud_router_policy

ixapi_de_cix_cloud_router_policy / _policies

ixapi_de_cix_cloud_router_static_route

ixapi_de_cix_cloud_router_static_routes

ixapi_de_cix_cloud_router_routes

ixapi_de_cix_cloud_router_bgp_state

ixapi_de_cix_cloud_router_bfd_state

ixapi_de_cix_cloud_router_vrf_arp_table

To find available product offering IDs for your account, use:

data "ixapi_de_cix_product_offerings_cloud_vrf" "available" {}

output "offerings" {
value = data.ixapi_de_cix_product_offerings_cloud_vrf.available.product_offerings
}

The id field of each offering is what you pass as product_offering when creating a Cloud ROUTER resource.

Best Practices

Never hardcode credentials in your Terraform files. Use input variables and supply them via environment variables or a .tfvars file:

variable "api_key" {
description = "IX-API key"
type = string
sensitive = true
}

variable "api_secret" {
description = "IX-API secret"
type = string
sensitive = true
}

provider "ixapi" {
api = "https://ixapi.de-cix.net/api/v2"
api_key = var.api_key
api_secret = var.api_secret
}

Pass values at runtime:

$ TF_VAR_api_key=<your_key> TF_VAR_api_secret=<your_secret> terraform apply

Or use a terraform.tfvars file — add this file to .gitignore to keep secrets out of version control:

api_key    = "<your_key>"
api_secret = "<your_secret>"

How did we do?

Getting Started

Managing Services

Get in touch