Least privilege
The exact permissions the person or CI that runs the install needs, and the ones the engine holds at runtime, with no roles/owner.
On this page
The install never needs roles/owner. Two identities need permissions, and each gets exactly the set for what it does:
- The installer: whoever runs
terraform apply, a person or your CI's service account. - The engine at runtime: its Workload Identity service account, which manages VPN tunnels.
The lists ship in the release bundle, one file per part of the install, under terraform/gke/modules/medhook/iam/. Terraform, the preflight check and these docs all read the same files. Each file also names the predefined roles that cover it and the Google APIs it uses.
The installer
What the installer needs follows your Terraform settings. terraform output install_features lists the parts your configuration installs.
| Part | Needed when | Predefined roles that cover it |
|---|---|---|
core | always: service accounts, custom roles, secrets, registry, buckets, VPN gateway | project IAM admin, service account admin, role admin, Secret Manager admin, Artifact Registry admin, Storage admin, network admin |
apis | Terraform enables the Google APIs (the default) | Service Usage admin |
network | Terraform creates the VPC | network admin |
cloud-nat | Terraform creates Cloud NAT (the default) | network admin |
cluster | Terraform creates the GKE cluster | cluster admin, service account user, Cloud KMS admin, container developer |
cloudsql | Terraform creates Cloud SQL (the default) | Cloud SQL admin, Service Networking admin |
alerts | Terraform creates Cloud Monitoring alerts (the default) | alert policy, uptime check and notification channel editors, logging config writer |
ha-vpn, memorystore, cloud-armor, fhir-store, bigquery, cmek, github, sql-verify | you turn those features on | named in each file |
Bring your own VPC, cluster, database or monitoring and the matching parts drop out. See Bring your own infrastructure.
Grant it
Use the installer module from your own IAM Terraform, run by your IAM admin before the first apply:
module "medhook_installer" {
source = "./terraform/gke/modules/medhook-iam"
project_id = "demohealth-medhook"
installer_members = ["serviceAccount:tf-ci@demohealth-platform.iam.gserviceaccount.com"]
features = ["core", "network", "cloud-nat", "cluster", "cloudsql", "alerts"]
role_suffix = "dh01" # the same iam_role_suffix as the MedHook module
expires = "2027-01-31T00:00:00Z" # optional: every grant ends then
}It creates one custom role with exactly those permissions, except the right to change project IAM. That one can grant anything, so it comes from a separate project IAM admin grant whose IAM condition lets the installer grant only the roles MedHook grants. For organizations that do not allow custom roles, grant_mode = "predefined_roles" grants the predefined roles instead.
Without Terraform, print the role as a file for gcloud:
deploy/iam.sh role-yaml install --features core,cluster,cloudsql > role.yaml
gcloud iam roles create medhook_installer --project "$PROJECT_ID" --file role.yamlCheck it before the first apply
Run the preflight as the identity that will apply, or name it with --member:
PROJECT_ID="$PROJECT_ID" deploy/preflight.sh --iam install --features core,network,cloud-nat,cluster,cloudsql,alertsIt lists every missing permission under its part, with the role that covers it, and exits with an error. If your platform team enables APIs (enable_project_apis = false), it also lists the APIs that are still off, with the command that enables them.
The engine at runtime
| Set | What it is for | Granted |
|---|---|---|
classic-vpn | create and delete VPN tunnels and their routes in the chosen VPC, read tunnel traffic | unless vpn_mode = "none" |
ha-vpn | HA VPN peer gateways and BGP sessions | with HA VPN |
diagnostics | the tunnel diagnosis's IKE log, and secret expiry in Settings · Diagnostics (metadata, never values) | engine_diagnostics_access |
cloudsql-client | only with the Cloud SQL Auth Proxy; the chart connects over private IP | engine_cloudsql_client |
On top of those, single-resource grants: write and read on the audit archive bucket (never delete), and whatever optional features add. The engine creates no firewall rules, so it holds no firewall rights. Check the engine's account the same way:
PROJECT_ID="$PROJECT_ID" deploy/preflight.sh --iam runtime --member serviceAccount:<engine service account>Settings › Resources
Settings › Resources lists what MedHook created in the project with the engine's account, and asks for nothing more: each list the account can't read shows the permission and a read-only role that grants it. Grant those read-only roles only if you want the page to show everything; deploy/inventory.sh lists it all as you either way. See Uninstall and inventory.
Scope the VPN rights in a shared project
By default the engine's VPN role reaches every tunnel and route in the project. Set engine_vpn_scope_condition = true and the rights to create, read and delete a tunnel, route or peer gateway are bound with an IAM condition on this environment's name prefix, the prefix the engine gives everything it creates. Listing, and the gateway and network rights, stay project-wide. Create a test tunnel after you turn it on. A dedicated project, or at least a dedicated VPC, is still the strongest boundary.
Owner is break-glass only
If an apply fails on a permission the lists miss, the preflight output names it; tell your MedHook contact so the list is fixed. A time-boxed roles/owner grant, logged and with a written reason, is the last resort, never the install path.