Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

GCP Dynamic Provider Credentials

Requirements

The dynamic provider credential setup in GCP can be done with the Terrraform code available in the following link:

https://github.com/terrakube-io/terrakube/tree/main/dynamic-credential-setup/gcp

Make sure to mount your public and private key to the API container as explained here

Mare sure the private key is in "pkcs8" format

Validate the following terrakube api endpoints are working:

Set terraform variables using: "variables.auto.tfvars"

terrakube_token = "TERRAKUBE_PERSONAL_ACCESS_TOKEN"
terrakube_hostname = "terrakube-api.mydomain.com"
terrakube_organization_name = "simple"
terrakube_workspace_name = "dynamic-workspace"
gcp_project_id = "my-gcp-project"

To generate the API token check here

Run Terraform apply to create all the federated credential setup in GCP and a sample workspace in terrakube for testing

To test the following terraform code can be used:

Running Example

Workspace trust boundary

The 2.34.0 setup example matches assertion.sub exactly and also pins assertion.terrakube_workspace_id to the created workspace. A prefix check such as startsWith could trust production2 when configured for production; checking the ID also prevents a different workspace reusing the name from inheriting access.

Use the updated 2.34.0 setup example when reviewing your provider's attribute condition. Upgrading Terrakube does not change existing GCP trust configuration; apply the change there too.

Last updated

Was this helpful?