A Golang Terraform provider built using CacheFly Go SDK GoLang SDK for CacheFly v1.1.0. Supports CacheFly API (2.6.0)
CacheFly CDN is the only CDN built for throughput, delivering rich-media content up to 158% faster than other major CDNs.
Add the provider to your Terraform configuration:
terraform {
required_providers {
cachefly = {
source = "cachefly/cachefly"
# Pin to a version or range as needed, e.g.:
# version = ">= 0.1.0"
}
}
}
provider "cachefly" {
# Prefer environment variable: CACHEFLY_API_TOKEN
# api_token = "your-cachefly-api-token"
# Optional: override API base URL (defaults to https://api.cachefly.com/api/2.6)
# base_url = "https://api.cachefly.com/api/2.6"
}Basic examples to get started:
# Create a CacheFly service
resource "cachefly_service" "example" {
name = "Example Service"
unique_name = "example-service-123"
auto_ssl = true
# Configure service options as a map (see docs for full catalog)
# options = {
# cors = { enabled = true }
# }
}
output "service_id" {
value = cachefly_service.example.id
}Or look up an existing service by unique name:
data "cachefly_service" "by_unique_name" {
unique_name = "example-service-123"
response_type = "shallow"
include_features = false
}
output "service_status" {
value = data.cachefly_service.by_unique_name.status
}Explore examples in this repository:
- Provider and basics:
examples/README.md - Service resource:
examples/resources/cachefly_service/resource.tf - Service domain resource:
examples/resources/cachefly_service_domain/resource.tf - Origin resource:
examples/resources/cachefly_origin/resource.tf - Certificate resource:
examples/resources/cachefly_certificate/resource.tf - Script config resource:
examples/resources/cachefly_script_config/resource.tf - User resource:
examples/resources/cachefly_user/resource.tf - Log target resource:
examples/resources/cachefly_log_target/resource.tf
- Service management: Create/update CacheFly services with auto-SSL and rich options
- Origin configuration: HTTP/S3 origins, timeouts, compression, TTLs
- Custom domains: Attach/manage domains with validation and certificates
- SSL certificates: Upload and manage custom TLS/SSL certs
- Script configs: Manage reusable script configurations and activation
- Users: Create/manage users, permissions, and service assignments
- Log targets: Configure S3/Elasticsearch/Google Bucket logging targets
- Data sources: Query services, domains, origins, users, log targets, delivery regions
cachefly_servicecachefly_service_domaincachefly_origincachefly_usercachefly_script_configcachefly_certificatecachefly_log_target
cachefly_servicecachefly_service_domaincachefly_service_domainscachefly_origincachefly_originscachefly_log_targetscachefly_userscachefly_delivery_regions
We have unit tests for the provider at ./internal/provider/.
go test -v -count=1 ./internal/provider/For detailed documentation on all resources and data sources, visit the Terraform Registry documentation.
- Terraform >= 0.13
- Go >= 1.23 (for development)
- Valid CacheFly API token (set
CACHEFLY_API_TOKENorapi_token)
Contributions are welcome! Please read our contributing guidelines and submit pull requests to help improve this provider.
For issues and questions:
- Open an issue on GitHub
- Contact CacheFly support for API-related questions
This project is licensed under the MIT License - see the LICENSE file for details.