Skip to content

Fastly

Imported from Confluence

Content may be outdated. Verify before following any procedures. View original | Last updated: November 2024

You should be able to see Fastly application in the OKTA page, in case if it's missing please create ticket for CIT.

Fastly documentation - Documentation

Gitlab repo - appgrowthplatform (Gitlab)

Configuration

  1. Issue certificate for your domain in Security → TLS Management → Domains
  2. Specify Origin which is basically your asset backend (S3, GCS, etc)
    Screenshot 2024-11-04 at 16.03.57.png
  3. In order to override Header, Response, etc use Content/Headers sections
    Screenshot 2024-11-04 at 16.05.08.png
  4. For Condition statement use VCS, which supports Snippet creation.
    Screenshot 2024-11-04 at 16.05.17.png
  5. Point your CDN DNS to SSL Fastly endpoint according to this - Working With Cname Records And Your Dns Provider

Terraform

Structure is same for all projects. We use terraform mostly as a backup tool for all CDN configurations. We found it's way easier to configure CDN via UI and import to terraform.

Screenshot 2024-11-04 at 13.05.20.png

It consists of needed providers, backend bucket and secret with api key to interact with Fastly.

#### Create import.tf resourse 
import {
    to = fastly_service_vcl.scale-assets-staging-fyber-com
    id = "fastly_cdn_id"
}
#### Genarate terraform code for remote resources
terraform plan -generate-config-out=generated1.tf 

#### Import fastly resource with specific id to terraform state
terraform import fastly_service_vcl.scale-assets-staging-fyber-com <fastly_cdn_id>