HCP Terraform and Terraform Enterprise Provider

This provider is used to interact with the many resources supported by HCP Terraform. As Terraform Enterprise is a self-hosted distribution of HCP Terraform, this provider supports both Cloud and Enterprise.

Use the navigation to the left to read about the available resources.

Since v0.24.0, this provider requires Terraform >= 0.12.

Authentication

This provider requires a HCP Terraform and Terraform Enterprise API token in order to manage resources.

To manage the full selection of resources, provide a user token from an account with appropriate permissions. This user should belong to the "owners" team of every organization you wish to manage. Alternatively, you can use an organization or team token instead of a user token, but it will limit which resources you can manage. Organization and team tokens cannot manage resources across multiple organizations, and organization tokens cannot manage certain resource types (like SSH keys). See the API token documentation for more details about access to specific resources.

There are several ways to provide the required token:

When configuring the input variable for either of these options, mark them as sensitive.

If you are using this provider on your local command line without remote operations (i.e. only using HCP Terraform as a remote state backend), there are two more options available to you:

Versions

For production use, you should constrain the acceptable provider versions via configuration, to ensure that new versions with breaking changes will not be automatically installed by terraform init in the future:

terraform {
  required_providers {
    tfe = {
      version = "~> 0.55.0"
    }
  }
}

As this provider is still at version zero, you should constrain the acceptable provider versions on the minor version.

The above snippet using required_providers is for Terraform 0.13+; if you are using Terraform version 0.12, you can constrain by adding the version constraint to the provider block instead:

provider "tfe" {
  version = "~> 0.53.0"
  ...
}

For more information on provider installation and constraining provider versions, see the Provider Requirements documentation.

Example Usage

provider "tfe" {
  hostname = var.hostname # Optional, defaults to HCP Terraform `app.terraform.io`
  token    = var.token
  version  = "~> 0.53.0"
}

# Create an organization
resource "tfe_organization" "org" {
  # ...
}

Argument Reference

The following arguments are supported: