Skip to main content
When you create a Stream library, bunny.net automatically provisions a Pull Zone and Storage Zone. To manage these resources with Terraform, you need to import them into your state.
1

Define the stream library

Create or update your Terraform configuration with the stream library resource:
resource "bunnynet_stream_library" "library" {
  name = "my-library"
}
2

Apply the configuration

Run apply to create or sync the library:
terraform apply
3

Add resources with import blocks

Define the associated Pull Zone and Storage Zone resources, along with import blocks:
resource "bunnynet_pullzone" "pullzone" {
  name = "my-library-pullzone"

  origin {
    type        = "StorageZone"
    storagezone = bunnynet_stream_library.library.storage_zone
  }

  routing {
    tier = "Volume"
  }
}

resource "bunnynet_storage_zone" "storage" {
  name      = "my-library-storage"
  region    = "DE"
  zone_tier = "Standard"
}

import {
  to = bunnynet_pullzone.pullzone
  id = bunnynet_stream_library.library.pullzone
}

import {
  to = bunnynet_storage_zone.storage
  id = bunnynet_stream_library.library.storage_zone
}
4

Apply to import

Run apply to import the resources into your Terraform state:
terraform apply
The Pull Zone and Storage Zone are now managed by Terraform.