GCP resources¶
The generated terraform/main.tf creates three service accounts and the IAM
bindings that let them work. It creates no registry and no bucket: those are
yours, named in the install spec, and Terraform grants access to them.
What it renders¶
terraform {
required_providers {
google = { source = "hashicorp/google", version = "~> 5.0" }
}
}
provider "google" {
project = "<gcp-project-id>"
region = "<region>"
}
resource "google_service_account" "runtime" {
account_id = "dp-eu-west1-runtime"
display_name = "Xratu dataplane runtime"
}
resource "google_service_account" "build" {
account_id = "dp-eu-west1-build"
display_name = "Xratu dataplane build"
}
resource "google_service_account" "publish_delegate" {
account_id = "dp-eu-west1-build-publish"
display_name = "Xratu dataplane publish delegate"
}
Then the grants:
resource "google_project_iam_member" "runtime_artifact_registry_writer" {
project = "<gcp-project-id>"
role = "roles/artifactregistry.writer"
member = "serviceAccount:dp-eu-west1-runtime@<gcp-project-id>.iam.gserviceaccount.com"
}
resource "google_artifact_registry_repository_iam_member" "publish_delegate_repository_writer" {
project = "<gcp-project-id>"
location = "<region>"
repository = "<repository>"
role = "roles/artifactregistry.writer"
member = "serviceAccount:dp-eu-west1-build-publish@<gcp-project-id>.iam.gserviceaccount.com"
}
resource "google_service_account_iam_member" "build_publish_delegate_token_creator" {
service_account_id = google_service_account.publish_delegate.name
role = "roles/iam.serviceAccountTokenCreator"
member = "serviceAccount:dp-eu-west1-build@<gcp-project-id>.iam.gserviceaccount.com"
}
resource "google_storage_bucket_iam_member" "runtime_bucket_object_admin" {
bucket = "<bucket>"
role = "roles/storage.objectAdmin"
member = "serviceAccount:dp-eu-west1-runtime@<gcp-project-id>.iam.gserviceaccount.com"
}
Bucket access for build follows the same shape, then the two Workload Identity bindings.
The three identities¶
| Identity | Name | Used by |
|---|---|---|
| Runtime | dp-eu-west1-runtime |
xratud and the workloads it runs |
| Build | dp-eu-west1-build |
Builds |
| Publish delegate | dp-eu-west1-build-publish |
The identity build impersonates to push |
Publishing is delegated rather than granted to build directly: build holds
roles/iam.serviceAccountTokenCreator on the delegate, and the delegate holds
the repository-scoped writer role. That keeps the push grant on a separate
principal from the one running build workloads.
Every name derives from dp_install, so two installations in one project do not
collide. See dp_install.
What you bring¶
| Resource | Created by |
|---|---|
| The GCP project | You |
| The Artifact Registry repository | You |
| The GCS bucket | You |
| The GKE cluster | You |
| Service accounts and IAM | This Terraform |
An Artifact Registry repository or bucket that does not exist makes the IAM
binding fail at terraform apply, which is where a wrong path surfaces.
Related¶
- GCP IAM roles for what each grant allows.
- Workload Identity for the cluster binding.