| page_title | subcategory | description |
|---|---|---|
stackit_cdn_distribution Resource - stackit |
CDN distribution data source schema.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources. |
CDN distribution data source schema.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide for how to opt-in to use beta resources.
resource "stackit_cdn_distribution" "example_distribution" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
config = {
backend = {
type = "http"
origin_url = "https://mybackend.onstackit.cloud"
geofencing = {
"https://mybackend.onstackit.cloud" = ["DE"]
}
}
regions = ["EU", "US", "ASIA", "AF", "SA"]
blocked_countries = ["DE", "AT", "CH"]
optimizer = {
enabled = true
}
}
}
resource "stackit_cdn_distribution" "example_bucket_distribution" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
config = {
backend = {
type = "bucket"
bucket_url = "https://my-test.object.storage.eu01.onstackit.cloud"
region = "eu01"
# Credentials are required for bucket backends
# It is strongly recommended to use variables for secrets
credentials = {
access_key_id = var.bucket_access_key
secret_access_key = var.bucket_secret_key
}
}
regions = ["EU", "US"]
blocked_countries = ["CN", "RU"]
optimizer = {
enabled = false
}
}
}
# Only use the import statement, if you want to import an existing cdn distribution
import {
to = stackit_cdn_distribution.import-example
id = "${var.project_id},${var.distribution_id}"
}config(Attributes) The distribution configuration (see below for nested schema)project_id(String) STACKIT project ID associated with the distribution
created_at(String) Time when the distribution was createddistribution_id(String) CDN distribution IDdomains(Attributes List) List of configured domains for the distribution (see below for nested schema)errors(List of String) List of distribution errorsid(String) Terraform's internal resource identifier. It is structured as "project_id,distribution_id".status(String) Status of the distributionupdated_at(String) Time when the distribution was last updated
Required:
backend(Attributes) The configured backend for the distribution (see below for nested schema)regions(List of String) The configured regions where content will be hosted
Optional:
blocked_countries(List of String) The configured countries where distribution of content is blockedoptimizer(Attributes) Configuration for the Image Optimizer. This is a paid feature that automatically optimizes images to reduce their file size for faster delivery, leading to improved website performance and a better user experience. (see below for nested schema)
Required:
type(String) The configured backend type. Possible values are:http,bucket.
Optional:
bucket_url(String) The URL of the bucket (e.g. https://s3.example.com). Required if type is 'bucket'.credentials(Attributes) The credentials for the bucket. Required if type is 'bucket'. (see below for nested schema)geofencing(Map of List of String) The configured type http to configure countries where content is allowed. A map of URLs to a list of countriesorigin_request_headers(Map of String) The configured type http origin request headers for the backendorigin_url(String) The configured backend type http for the distributionregion(String) The region where the bucket is hosted. Required if type is 'bucket'.
Required:
access_key_id(String, Sensitive) The access key for the bucket. Required if type is 'bucket'.secret_access_key(String, Sensitive) The access key for the bucket. Required if type is 'bucket'.
Optional:
enabled(Boolean)
Read-Only:
errors(List of String) List of domain errorsname(String) The name of the domainstatus(String) The status of the domaintype(String) The type of the domain. Each distribution has one domain of type "managed", and domains of type "custom" may be additionally created by the user