List VCL services linked with Next-Gen WAF (NGWAF) Edge Deployment using Terraform

If you are looking of the list of VCL services that are linked to a Fastly Next-Gen WAF edge deployment, then you may call on the API endpoint described in our online documentation, Edge deployment.

You may also use Terraform to collect the linked deployments as well. The following terraform configuration will allow you to send a request to the same endpoint described in the above documentation to collect the VCL services that are linked to a Fastly Next-Gen WAF edge deployment.

Happy terraforming!

terraform {
  required_providers {
    http = {
      source = "hashicorp/http"
    }
  }
}

provider "http" {}

#### Edge deploy linked data - start
data "http" "linked_fastly_services" {
  url = "https://dashboard.signalsciences.net/api/v0/corps/${var.NGWAF_CORP}/sites/${var.NGWAF_SITE}/edgeDeployment"

  request_headers = {
    x-api-user  = var.NGWAF_EMAIL
    x-api-token = var.NGWAF_TOKEN
    Content-Type =  "application/json"
  }
}
#### Edge deploy linked data - end

output "response_body" {
  value = [for item in jsondecode(data.http.linked_fastly_services.response_body)["ServicesAttached"] : item.id]
}