about summary refs log tree commit diff
path: root/ops/buildkite/buildkite.tf
blob: cd747851498f0ef4689f307092ccdcf340a42e21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
locals {
  terraform_service_account = "terraform@fcuny-homelab.iam.gserviceaccount.com"
}

provider "google" {
  alias = "impersonation"
  scopes = [
    "https://www.googleapis.com/auth/cloud-platform",
    "https://www.googleapis.com/auth/userinfo.email",
  ]
}

data "google_service_account_access_token" "default" {
  provider               = google.impersonation
  target_service_account = local.terraform_service_account
  scopes                 = ["userinfo-email", "cloud-platform"]
  lifetime               = "1200s"
}

provider "google" {
  project         = "fcuny-homelab"
  region          = "us-west1"
  zone            = "us-west1-c"
  access_token    = data.google_service_account_access_token.default.access_token
  request_timeout = "60s"
}

terraform {
  required_providers {
    buildkite = {
      source = "buildkite/buildkite"
    }
  }

  backend "gcs" {
    bucket                      = "world-tf-state"
    prefix                      = "buildkite/state"
    impersonate_service_account = "terraform@fcuny-homelab.iam.gserviceaccount.com"
  }
}

provider "buildkite" {
  organization = "fcuny-dot-xyz"
}

resource "buildkite_pipeline" "world" {
  name        = "world"
  description = "CI pipeline for the world repository."
  repository  = "https://cl.fcuny.net/world"
  steps       = file("./steps.yml")
}