Skip to navigation

Terraform

Use Terraform to describe IBEE infrastructure in configuration files and review changes before applying them. The IBEE provider supports resources across compute, networking, storage, secrets, and CDN.

Before you begin

  • Install Terraform CLI 1.11 or later. Terraform 1.14 or later is required for Terraform actions.
  • Have an IBEE organization and workspace.
  • Install Go if you need to build the provider from source.

Get started

1

1. Create an API token

In the IBEE portal, open Settings → API Tokens and create a token authorized for the workspace you want Terraform to manage. Grant Billing: Read for billing checks and the read/write permissions required by the resources in your configuration. See API Tokens for token setup and scope details.

Copy the token when it is created. It is shown only once.

2

2. Build and configure the provider

The provider is currently installed from source. Clone the Terraform provider repository and build it:

git clone https://github.com/devs-ibee/terraform-provider-ibee.git
cd terraform-provider-ibee
make build

Create a Terraform CLI configuration file (for example, dev.tfrc) that points to the provider binary directory. Replace the path with the absolute path to your checkout:

provider_installation {
dev_overrides {
"devs-ibee/ibee" = "/absolute/path/to/terraform-provider-ibee/bin"
}
direct {}
}

Export the CLI configuration, token, and workspace ID in your shell:

export TF_CLI_CONFIG_FILE="/absolute/path/to/dev.tfrc"
export IBEE_TOKEN="your-api-token"
export IBEE_WORKSPACE_ID="your-workspace-id"

Production is the default environment. To use the development environment, also set IBEE_ENV=dev and use a development token. Keep the token in your shell or secret manager; do not put it in Terraform files or source control.

When using this local development override, skip terraform init. After a Registry release is available, configure the published provider version and run terraform init normally.

3

3. Create a Terraform project

Create a directory for your configuration, change into it, and add a file named main.tf:

mkdir ibee-terraform
cd ibee-terraform

Add this configuration to main.tf:

terraform {
required_version = ">= 1.11.0"
required_providers {
ibee = {
source = "devs-ibee/ibee"
}
}
}
provider "ibee" {}
variable "site_id" {
description = "An available network site ID"
type = string
}
resource "ibee_vpc" "example" {
name = "terraform-example"
site_id = var.site_id
}
output "vpc_id" {
value = ibee_vpc.example.id
}

Set site_id to an available network site. You can find site IDs in the IBEE portal or with the ibee_network_sites data source.

4

4. Review and apply

From the project directory, preview the change with your site ID:

terraform plan -var="site_id=your-network-site-id"

Review the plan. If it is correct, create the VPC:

terraform apply -var="site_id=your-network-site-id"

Creating some resources incurs charges. Review every plan before applying it; Terraform may replace or destroy resources when their configuration changes.

5

5. Clean up

When you no longer need the example VPC, destroy it with the same site ID:

terraform destroy -var="site_id=your-network-site-id"

Next steps