> ## Documentation Index
> Fetch the complete documentation index at: https://bunny.net/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with the bunny.net Terraform provider to manage your infrastructure as code.

# What you'll need

Before you begin, make sure you have:

* A [bunny.net account](https://dash.bunny.net/auth/register)
* [Terraform](https://developer.hashicorp.com/terraform/install) installed on your machine
* Your [bunny.net API key](https://dash.bunny.net/account/api-key)

## Quickstart

**1. Set up your project**

**New project**

Create a new directory and add the provider configuration:

```bash theme={null}
mkdir my-terraform-project
cd my-terraform-project
```

Create a `provider.tf` file with the following content:

```hcl theme={null}
terraform {
  required_providers {
    bunnynet = {
      source = "BunnyWay/bunnynet"
    }
  }
}

provider "bunnynet" {
  api_key = "your-api-key"
}
```

**Existing project**

Add the bunny.net provider to your existing `provider.tf`:

```hcl theme={null}
terraform {
  required_providers {
    bunnynet = {
      source = "BunnyWay/bunnynet"
    }
    # ... your other providers
  }
}

provider "bunnynet" {
  api_key = "your-api-key"
}
```

**From template**

Clone the official template repository:

```bash theme={null}
git clone https://github.com/BunnyWay/terraform-provider-bunnynet-template.git my-terraform-project
cd my-terraform-project
```

Update the `api_key` in the configuration file with your API key.

> [!NOTE]
>
> You can also use the `BUNNYNET_API_KEY` environment variable instead of
> hardcoding your API key. See [Authentication](/docs/integrations/terraform/authentication.md) for
> more options.

**2. Initialize Terraform**

Run the init command to download the bunny.net provider:

```bash theme={null}
terraform init
```

**3. Define your resources**

Create a `main.tf` file with your infrastructure. This example creates a Storage Zone with an index file and a Pull Zone:

```hcl theme={null}
resource "bunnynet_storage_zone" "my_storage" {
  name      = "my-project-name"
  zone_tier = "Edge"
  region    = "DE"
}

resource "bunnynet_storage_file" "index" {
  zone    = bunnynet_storage_zone.my_storage.id
  path    = "index.html"
  content = "<h1>Hello world!</h1><p>Deployed with Terraform.</p>"
}

resource "bunnynet_pullzone" "my_cdn" {
  name = bunnynet_storage_zone.my_storage.name

  origin {
    type        = "StorageZone"
    storagezone = bunnynet_storage_zone.my_storage.id
  }

  routing {
    tier = "Standard"
  }
}
```

Replace `my-project-name` with your desired project name.

**4. Preview and apply**

Preview the changes Terraform will make:

```bash theme={null}
terraform plan
```

Apply the configuration to create your resources:

```bash theme={null}
terraform apply
```

Type `yes` when prompted to confirm.

```
bunnynet_storage_zone.my_storage: Creating...
bunnynet_storage_zone.my_storage: Creation complete after 3s
bunnynet_pullzone.my_cdn: Creating...
bunnynet_pullzone.my_cdn: Creation complete after 0s
bunnynet_storage_file.index: Creating...
bunnynet_storage_file.index: Creation complete after 0s

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
```

**5. Verify your deployment**

Open the [bunny.net dashboard](https://dash.bunny.net) to see your new resources. Your content is now being served through the bunny.net CDN.

## Next steps

> **[Resources](/docs/integrations/terraform/resources.md)**
>
> Explore all available Terraform resources

> **[Data Sources](/docs/integrations/terraform/data-sources.md)**
>
> Query existing bunny.net resources

> **[Authentication](/docs/integrations/terraform/authentication.md)**
>
> Configure provider authentication options

> **[Provider docs](https://registry.terraform.io/providers/BunnyWay/bunnynet/latest/docs)**
>
> Official Terraform Registry documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.