Add or modify DNS records to Sourcegraph owned domains

Sourcegraph follows an Infrastructure as Code (IaC) model. To make changes to Sourcegraph owned DNS records you should make the change to the code in Terraform in our sourcegraph/infrastructure repo.

  1. Clone sourcegraph/infrastructure

  2. Navigate to the dns folder

  3. Create a file, add the record near the most relevant DNS entries, or modify the existing record

    1. For domains with a large number of TXT records like Sourcegraph.com, we typically create a file sourcegraph.$TXT_PROVIDER.tf
  4. Create a pull request in the repo with your changes

  5. Open Buildkite

    1. Check status of ci/terraform.sh dns job and it should pass without error.
    2. If there is any error, you should consult the logs or reach out to #cloud-devops
  6. Wait for Buildkite to finish your build

  7. Get approve from the cloud-devops team

  8. terraform apply the PR or drop a message in #cloud-devops and DevOps team will apply it for you (if you’re not a DevOps or Security teammate, you most likely don’t have sufficient access to apply the dns terraform module)

  9. Merge the PR after the apply succeeds

FAQ

Are you adding a DNS record for a Netlify site?

You should create a CNAME record pointing to sourcegraph.netlifyglobalcdn.com. In terraform, it looks something like

example

resource "cloudflare_record" "about-sourcegraph-com" {
  zone_id = data.cloudflare_zones.sourcegraph_com.zones[0].id
  name    = "about"
  type    = "CNAME"
  value   = var.netlify-enterprise-cdn-cname
  proxied = false
}