This example shows how to deploy Terraform Cloud agents on Google Kubernetes Engine (GKE) using the tfc-agent-gke
module.
It creates the Terraform Cloud agent pool, registers the agent to that pool and creates a project and an empty workspace with the agent attached.
The tools needed to build this example are available by default in Google Cloud Shell.
If running from your own system, you will need:
-
Create terraform.tfvars file with the necessary values.
The Terraform Cloud agent token you would like to use. NOTE: This is a secret and should be marked as sensitive in Terraform Cloud.
project_id = "your-project-id" tfc_org_name = "your-tfc-org-name"
-
Create the infrastructure.
terraform init terraform plan terraform apply
-
Your Terraform Cloud agents should become active at Organization Setting > Security > Agents.
-
Create additonal workspaces or use the existing workspace to run Terraform through the Terraform Cloud agent. Click here for more info on running the workspace.
Name | Description | Type | Default | Required |
---|---|---|---|---|
project_id | The Google Cloud Platform project ID to deploy Terraform Cloud agent cluster | string |
n/a | yes |
tfc_agent_pool_name | Terraform Cloud agent pool name to be created | string |
"tfc-agent-gke-simple-pool" |
no |
tfc_agent_pool_token_description | Terraform Cloud agent pool token description | string |
"tfc-agent-gke-simple-pool-token" |
no |
tfc_org_name | Terraform Cloud org name where the agent pool will be created | string |
n/a | yes |
tfc_project_name | Terraform Cloud project to use | string |
"GCP agents" |
no |
tfc_workspace_name | Terraform Cloud workspace name to be created | string |
"tfc-agent-gke-simple" |
no |
Name | Description |
---|---|
ca_certificate | The cluster CA certificate (base64 encoded) |
cluster_name | GKE cluster name |
kubernetes_endpoint | The GKE cluster endpoint |
location | GKE cluster location |
network_name | Name of the VPC |
project_id | The Google Cloud Platform project ID to deploy Terraform Cloud agent cluster |
service_account | The default service account used for TFC agent nodes |
subnet_name | Name of the subnet in the VPC |