Terraform module to manage ArvanCloud CDN Cache resource.
| Name | Version |
|---|---|
| terraform | >= 1.5 |
| arvancloud | >= 0.2.2 |
Warning
Import Required: This resource cannot be created from scratch. The cache settings already exist for your domain. You must import the existing resource before applying changes.
terraform import "module.cdn_cache.arvancloud_cdn_domain_cache.this" example.irNo Deletion: Due to API limitations, destroying this resource will remove it from Terraform state but will not delete the actual cache settings.
module "cdn_cache" {
source = "git@github.com:terraform-r1c-modules/Terraform-R1C-CDN-Cache.git?ref=main"
domain = "example.ir"
developer_mode = false
consistent_uptime = true
max_size = 104857600 # 100MB
}module "cdn_cache" {
source = "git@github.com:terraform-r1c-modules/Terraform-R1C-CDN-Cache.git?ref=main"
domain = "production.example.ir"
developer_mode = false # Keep disabled in production
consistent_uptime = true # Serve stale content if origin is down
max_size = 524288000 # 500MB - adjust based on your content
}module "cdn_cache" {
source = "git@github.com:terraform-r1c-modules/Terraform-R1C-CDN-Cache.git?ref=main"
domain = "dev.example.ir"
developer_mode = true # Bypass cache for testing
consistent_uptime = false
max_size = 10485760 # 10MB
}| Name | Description | Type | Default | Required |
|---|---|---|---|---|
domain |
UUID or the name of the CDN domain | string |
n/a | Yes |
developer_mode |
Enable or disable developer mode (bypasses cache) | bool |
false |
No |
consistent_uptime |
Enable consistent uptime mode for improved availability | bool |
true |
No |
max_size |
Maximum size of cacheable content in bytes (0 - 2147483648) | number |
104857600 |
No |
| Name | Description |
|---|---|
domain |
The domain name or UUID for which cache settings are configured |
developer_mode |
Whether developer mode is enabled for the domain |
consistent_uptime |
Whether consistent uptime mode is enabled for the domain |
max_size |
Maximum size of cacheable content in bytes |
last_updated |
The timestamp of the last update to the cache settings (RFC3339) |
| Size | Bytes |
|---|---|
| 10 MB | 10485760 |
| 50 MB | 52428800 |
| 100 MB | 104857600 |
| 250 MB | 262144000 |
| 500 MB | 524288000 |
| 1 GB | 1073741824 |
| 2 GB | 2147483648 |
Note
The maximum allowed cache size is 2 GB (2147483648 bytes). Please refer to domain plans for specific limits.
terraform {
required_version = ">= 1.5"
required_providers {
arvancloud = {
source = "terraform.arvancloud.ir/arvancloud/arvancloud"
version = ">= 0.2.2"
}
}
}
provider "arvancloud" {
api_key = var.arvancloud_api_key
}
module "cdn_cache" {
source = "git@github.com:terraform-r1c-modules/Terraform-R1C-CDN-Cache.git?ref=main"
domain = "example.ir"
developer_mode = false
consistent_uptime = true
max_size = 104857600
}
output "cdn_cache_last_updated" {
value = module.cdn_cache.last_updated
}Apache 2.0 Licensed. See LICENSE for full details.