> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ibee.co.in/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ibee.co.in/docs/_mcp/server.

# Terraform

> Install the IBEE Terraform provider, authenticate to a workspace, and manage infrastructure as code.

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](https://developer.hashicorp.com/terraform/install) 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. 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](/docs/tools/api-tokens) for token setup and scope details.

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

### 2. Build and configure the provider

The provider is currently installed from source. Clone the [Terraform provider repository](https://github.com/devs-ibee/terraform-provider-ibee) and build it:

```bash
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:

```hcl
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:

```bash
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. Create a Terraform project

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

```bash
mkdir ibee-terraform
cd ibee-terraform
```

Add this configuration to `main.tf`:

```hcl
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](https://github.com/devs-ibee/terraform-provider-ibee/blob/main/docs/data-sources/network_sites.md).

### 4. Review and apply

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

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

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

```bash
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. Clean up

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

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

## Next steps

* Browse the [Terraform provider documentation](https://github.com/devs-ibee/terraform-provider-ibee/tree/main/docs).
* Explore the [Terraform example stacks](https://github.com/devs-ibee/examples/tree/main/terraform).
* Read about [API token scopes](/docs/tools/api-tokens) and [network site availability](https://github.com/devs-ibee/terraform-provider-ibee/blob/main/docs/data-sources/network_sites.md).