Importing stream library
This documentation covers the steps required to define and import a stream library and its associated resources using Terraform. Instructions differ slightly depending on your Terraform version (1.5+ or 1.4 and earlier).
Importing stream library for Terraform 1.5+
To import a stream library for Terraform 1.5+, follow the steps below:
- Define a stream library as shown below:
resource "bunnynet_stream_library" "library" {
name = "test"
}
- Run
terraform apply
. - Define the related resources and their import blocks as shown below:
resource "bunnynet_pullzone" "pullzone" {
name = "streamlibrary-pullzone-name"
origin {
type = "StorageZone"
storagezone = bunnynet_stream_library.library.storage_zone
}
routing {
tier = "Volume"
}
}
resource "bunnynet_storage_zone" "storage" {
name = "streamlibrary-storagezone-name"
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
}
- Run
terraform apply
.
Importing stream library for Terraform 1.4 and earlier
To import a stream library for Terraform 1.4 and earlier, follow the steps below:
- Define a stream library as shown below:
resource "bunnynet_stream_library" "library" {
name = "test"
}
- Run
terraform apply
. - Define the related resources as shown below:
resource "bunnynet_pullzone" "pullzone" {
name = "streamlibrary-pullzone-name"
origin {
type = "StorageZone"
storagezone = bunnynet_stream_library.library.storage_zone
}
routing {
tier = "Volume"
}
}
resource "bunnynet_storage_zone" "storage" {
name = "streamlibrary-storagezone-name"
region = "DE"
zone_tier = "Standard"
}
output "pullzone_id" {
value = bunnynet_stream_library.library.pullzone
}
output "storage_zone_id" {
value = bunnynet_stream_library.library.storage_zone
}
- Run
terraform plan
to obtain the storage zone and pull zone IDs. - Run
terraform import
:
terraform import bunnynet_pullzone.pullzone 123456
terraform import bunnynet_storage_zone.storage 123456
Updated 5 months ago