Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 2.52 KB

File metadata and controls

52 lines (37 loc) · 2.52 KB

Example Terraform Cloud agent on Managed Instance Group

Overview

This example showcases how to use startup scripts to deploy a Terraform Cloud agent using the tfc-agent-mig-vm 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 using startup/shutdown scripts to install the Terraform Cloud agent binary, register the agent when it comes online.

Steps to deploy this example

  1. 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"
  2. Create the infrastructure.

    terraform init
    terraform plan
    terraform apply
  3. Your Terraform Cloud agents should become active at Organization Setting > Security > Agents.

  4. 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.

Inputs

Name Description Type Default Required
project_id The Google Cloud Platform project ID to deploy Terraform Cloud agent MIG string n/a yes
tfc_agent_pool_name Terraform Cloud agent pool name to be created string "tfc-agent-mig-vm-simple-pool" no
tfc_agent_pool_token_description Terraform Cloud agent pool token description string "tfc-agent-mig-vm-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 name to be created string "GCP agents" no
tfc_workspace_name Terraform Cloud workspace name to be created string "tfc-agent-mig-vm-simple" no

Outputs

Name Description
mig_instance_group The instance group url of the created MIG
mig_instance_template The name of the MIG Instance Template
mig_name The name of the MIG
project_id The Google Cloud Platform project ID to deploy Terraform Cloud agent MIG
service_account_email Service account email used with the MIG template