HCP Terraform

This configuration will work with both Terraform Cloud and Terraform Enterprise.

Configure Campaigns Agent for HCP Terraform state backend

The Campaigns Agent needs an Organization level API token in order to access the state file in HCP Terraform. To do this in the HCP Terraform UI, navigate to your Organization > API tokens > Organization Tokens > Create an Organization Token.

Set this token in the environment variable TF_API_TOKEN in the Campaigns Agent container.

Configure HCP Terraform state backend in .resourcely.yaml

The following block will configure an HCP Terraform state backend:

# Required
version: "2"

# Array of Terraform config roots that Resourcely should care about
terraform_config_roots:
  -
    name: basic
    default_file: main.tf
    path: .
    skip: false
    campaign_config:
      state_file_config:
        hcp_terraform:
          workspace_id: <workspace_id>
          enterprise_url: <enterprise_url> # only needed for TFE customers with a custom URL

Last updated