« Back to Index

Terraform: Fastly Service]

View original Gist on GitHub

Tags: #fastly #terraform

main.tf

resource "fastly_service_v1" "test_service" {
  name = "My Test Service"

  domain {
    name = "training.fastly.com"
  }

  backend {
    address = "httpbin.org"
    name    = "test-backend"
  }
  
  vcl {
    content = file("vcl/main.vcl")
    main    = true
    name    = "custom_vcl"
  }

  force_destroy = true
}

outputs.tf

output "active" {
  value = fastly_service_v1.test_service.active_version
}

provider.tf

terraform {
  required_providers {
    fastly = {
      source  = "fastly/fastly"
      version = "0.27.0"
    }
  }
}