This Terraform module creates Fastly Object Storage access keys and integrates with S3-compatible bucket operations.
- Terraform >= 1.0
- Fastly API key with appropriate permissions
- Fastly account with Object Storage enabled
First, create the Fastly object storage access keys:
-
Comment out the S3 module in
main.tf:# module "s3" { # source = "./modules/s3" # # secret_key_id = fastly_object_storage_access_keys.main.id # secret_key = fastly_object_storage_access_keys.main.secret_key # }
-
Set your Fastly API key in
variables.tfby updating the default value:variable "fastly_api_key" { description = "Fastly API key for authentication" type = string sensitive = true default = "your-fastly-api-key-here" }
-
Apply to create access keys:
terraform init terraform apply
This will create the Fastly access keys and display them as outputs.
After the access keys are created:
-
Uncomment the S3 module in
main.tf:module "s3" { source = "./modules/s3" secret_key_id = fastly_object_storage_access_keys.main.id secret_key = fastly_object_storage_access_keys.main.secret_key }
-
Apply to create S3 bucket:
terraform apply
fastly_api_key- Your Fastly API key (can be set via environment variableTF_VAR_fastly_api_key)
fastly_access_key- The access key ID for S3 operations (sensitive)fastly_secret_key- The secret key for S3 operations (sensitive)
# Update variables.tf with your Fastly API key first
# Initialize and create access keys (with S3 module commented out)
terraform init
terraform apply
# Uncomment the S3 module in main.tf
# Then apply again to create the bucket
terraform apply