« Back to Index

Simple Fastly Terraform Subscription

View original Gist on GitHub

Tags: #tls #fastly #iac

main.tf

terraform {
  required_providers {
    fastly = {
      source  = "fastly/fastly"
      version = "7.0.0"
    }
  }
  required_version = ">= 1.0"
}

# data "fastly_tls_configuration" "http3_tls13" {
# 	id = "QqO0FM8CvrMCSr94yODlTw"
# }
#
# output "tls_config" {
# 	value = data.fastly_tls_configuration.http3_tls13
# }

resource "fastly_tls_subscription" "fastly_dev" {
  domains               = ["www.fastly-dev.com"]
  certificate_authority = "certainly"
  configuration_id      = "QqO0FM8CvrMCSr94yODlTw"
}

resource "fastly_service_vcl" "fastly_dev" {
  name = "fastly_dev"

  domain {
    name = "www.fastly-dev.com"
  }

  backend {
    address           = "www.fastly-debug.com"
    name              = "fastly_debug"
    override_host     = "www.fastly-debug.com"
    port              = 443
    ssl_cert_hostname = "fastly-debug.com"
    ssl_sni_hostname  = "fastly-debug.com"
    use_ssl           = true
  }

  force_destroy = true
}