content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4 values | source large_stringclasses 42 values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
# Dynamic provider credentials ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). Using static credentials in your workspaces or Stacks to authenticate providers presents a security risk, even if you rotate your credentials regularly. Dynamic provider credentials improve your security posture by letting you provision new, temporary credentials for each run. You can configure dynamic credentials for each HCP Terraform workspace or Stack. This workflow eliminates the need to manually manage and rotate credentials across your organization. It also lets you use the cloud platform’s authentication and authorization tools to scope permissions based on metadata, such as a run’s phase, its workspace, or its organization. ## How dynamic credentials work You configure a trust relationship between your cloud platform and HCP Terraform. As part of that process, you can define rules that let HCP Terraform workspaces and runs access specific resources. Then, the following process occurs for each Terraform plan and apply: 1. HCP Terraform generates a [workload identity token](/terraform/cloud-docs/dynamic-provider-credentials/workload-identity-tokens). The token is compliant with OpenID Connect protocol (OIDC) standards and includes information about the organization, workspace or Stack, and run stage. 2. When a plan or apply begins, HCP Terraform sends the workload identity token to the cloud platform, along with any other information needed to authenticate. 3. The cloud platform uses HCP Terraform’s public signing key to verify the workload identity token. 4. If verification succeeds, the cloud platform returns a set of fresh temporary credentials for HCP Terraform to use. 5. HCP Terraform sets up these credentials within the run environment for the Terraform provider to use. 6. The Terraform plan or apply proceeds. 7. When the plan or apply completes, the run environment is torn down and the temporary credentials are discarded. ## Configure Dynamic Credentials for workspaces Using dynamic credentials in a workspace requires the following steps for each cloud platform: 1. \*\*Set up a Trust Relationship:\*\* You must configure a relationship between HCP Terraform and the other cloud platform. The exact details of this process will be different depending on the cloud platform. 2. \*\*Configure Cloud Platform Access:\*\* You must configure roles and policies for the cloud platform to define the workspace’s access to infrastructure resources. 3. \*\*Configure HCP Terraform\*\*: You must add specific environment variables to that workspace to tell HCP Terraform how to authenticate to the other cloud platform during plans and applies. Each cloud platform has its own set of environment variables to configure dynamic credentials. The process for each step is different for each cloud platform. Refer to the cloud platform configuration instructions for full details. You can configure dynamic credentials for the following platforms: - [Vault](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration) - [Amazon Web Services](/terraform/cloud-docs/dynamic-provider-credentials/aws-configuration) - [Google Cloud Platform](/terraform/cloud-docs/dynamic-provider-credentials/gcp-configuration) - [Azure](/terraform/cloud-docs/dynamic-provider-credentials/azure-configuration) - [Kubernetes](/terraform/cloud-docs/dynamic-provider-credentials/kubernetes-configuration) You can also use Vault to generate credentials for AWS, GCP, or Azure by setting up [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed), which take advantage of Vault's [secrets engines](/vault/docs/secrets) to generate temporary credentials. ## Configure dynamic credentials for queries To use dynamic credentials for queries, complete the steps for [configuring dynamic credentials for workspaces](#configure-dynamic-credentials-for-workspaces). When using dynamic credentials to run queries, you must configure the run-specific environment variables for the corresponding cloud platform. HCP Terraform doesn't support using phase-specific variables, such as variables for plan and apply operations, when providing dynamic credentials to run a query. The following variables are examples of run-specific environment variables you can use to configure dynamic provider credentials for queries: - [Amazon Web Services](/terraform/cloud-docs/dynamic-provider-credentials/aws-configuration#required-environment-variables): `TFC\_AWS\_RUN\_ROLE\_ARN` - [Azure](/terraform/cloud-docs/dynamic-provider-credentials/azure-configuration#required-environment-variables): `TFC\_AZURE\_RUN\_CLIENT\_ID` - [Google Cloud Platform](/terraform/cloud-docs/dynamic-provider-credentials/gcp-configuration#required-environment-variables): `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` - [HCP](/terraform/cloud-docs/dynamic-provider-credentials/hcp-configuration#required-environment-variables): `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` - | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/index.mdx | main | terraform | [
-0.0492151640355587,
-0.002654530107975006,
0.00826761033385992,
-0.013177512213587761,
-0.07404568046331406,
0.01290604006499052,
-0.011097967624664307,
-0.011161694303154945,
0.042996201664209366,
0.03079199232161045,
-0.04736968129873276,
-0.03797033056616783,
0.08810069411993027,
0.022... | -0.007951 |
variables for plan and apply operations, when providing dynamic credentials to run a query. The following variables are examples of run-specific environment variables you can use to configure dynamic provider credentials for queries: - [Amazon Web Services](/terraform/cloud-docs/dynamic-provider-credentials/aws-configuration#required-environment-variables): `TFC\_AWS\_RUN\_ROLE\_ARN` - [Azure](/terraform/cloud-docs/dynamic-provider-credentials/azure-configuration#required-environment-variables): `TFC\_AZURE\_RUN\_CLIENT\_ID` - [Google Cloud Platform](/terraform/cloud-docs/dynamic-provider-credentials/gcp-configuration#required-environment-variables): `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` - [HCP](/terraform/cloud-docs/dynamic-provider-credentials/hcp-configuration#required-environment-variables): `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` - [Kubernetes](/terraform/cloud-docs/dynamic-provider-credentials/kubernetes-configuration#required-environment-variables): `TFC\_KUBERNETES\_WORKLOAD\_IDENTITY\_AUDIENCE` - [Vault](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration#required-environment-variables): `TFC\_VAULT\_RUN\_ROLE` Refer to the cloud platform configuration instructions for full details. ## Configure dynamic credentials for a Stack If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn the workflow of authenticating your Stack deployments with dynamic credentials. ## Terraform Enterprise Specific Requirements ### External Access to Metadata Endpoints In order to verify signed JWTs, cloud platforms must have network access to the following static OIDC metadata endpoints within TFE: 1. `/.well-known/openid-configuration` - standard OIDC metadata. 2. `/.well-known/jwks` - TFE’s public key(s) that cloud platforms use to verify the authenticity of tokens that claim to come from TFE. ### External Vault Policy If you are using an external Vault instance, you must ensure that your Vault instance has the correct policies setup as detailed in the [External Vault Requirements for Terraform Enterprise](/terraform/enterprise/requirements/data-storage/vault) documentation. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/index.mdx | main | terraform | [
-0.011093318462371826,
0.015654275193810463,
0.025975096970796585,
-0.010021486319601536,
-0.06849592179059982,
0.007131531368941069,
0.03255482390522957,
0.0003158358740620315,
0.02229858934879303,
0.058681316673755646,
-0.0484359972178936,
-0.10675270110368729,
0.03626660630106926,
-0.00... | -0.049115 |
# Use dynamic credentials with the Kubernetes and Helm providers ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.13.1](/terraform/cloud-docs/agents/changelog#1-13-1-10-25-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with Kubernetes to use [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for the Kubernetes and Helm providers in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Kubernetes](#configure-kubernetes):\*\* Set up a trust configuration between Kubernetes and HCP Terraform. Next, create Kubernetes role bindings for your HCP Terraform identities. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate). 3. \*\*[Configure the Kubernetes or Helm provider](#configure-the-provider)\*\*: Set the required attributes on the provider block. Once you complete the setup, HCP Terraform automatically authenticates to Kubernetes during each run. The Kubernetes and Helm providers' authentication is valid for the length of a plan or apply operation. ## Configure Kubernetes You must enable and configure an OIDC identity provider in the Kubernetes API. This workflow changes based on the platform hosting your Kubernetes cluster. HCP Terraform only supports dynamic credentials with Kubernetes in AWS and GCP. ### Configure an OIDC identity provider Refer to the AWS documentation for guidance on [setting up an EKS cluster for OIDC authentication](https://docs.aws.amazon.com/eks/latest/userguide/authenticate-oidc-identity-provider.html). You can also refer to our [example configuration](https://github.com/hashicorp-education/learn-terraform-dynamic-credentials/tree/main/eks/trust). Refer to the GCP documentation for guidance on [setting up a GKE cluster for OIDC authentication](https://cloud.google.com/kubernetes-engine/docs/how-to/oidc). You can also refer to our [example configuration](https://github.com/hashicorp-education/learn-terraform-dynamic-credentials/tree/main/gke/trust). When inputting an "issuer URL", use the address of HCP Terraform (`https://app.terraform.io` \_without\_ a trailing slash) or the URL of your Terraform Enterprise instance. The value of "client ID" is your audience in OIDC terminology, and it should match the value of the `TFC\_KUBERNETES\_WORKLOAD\_IDENTITY\_AUDIENCE` environment variable in your workspace. The OIDC identity resolves authentication to the Kubernetes API, but it first requires authorization to interact with that API. So, you must bind RBAC roles to the OIDC identity in Kubernetes. You can use both "User" and "Group" subjects in your role bindings. For OIDC identities coming from TFC, the "User" value is formatted like so: `organization::project::workspace::run\_phase:`. You can extract the "Group" value from the token claim you configured in your cluster OIDC configuration. For details on the structure of the HCP Terraform token, refer to [Workload Identity](/terraform/cloud-docs/dynamic-provider-credentials/workload-identity-tokens). Below, we show an example of a `RoleBinding` for the HCP Terraform OIDC identity. ```hcl resource "kubernetes\_cluster\_role\_binding\_v1" "oidc\_role" { metadata { name = "odic-identity" } role\_ref { api\_group = "rbac.authorization.k8s.io" kind = "ClusterRole" name = var.rbac\_group\_cluster\_role } // Option A - Bind RBAC roles to groups // // Groups are extracted from the token claim designated by 'rbac\_group\_oidc\_claim' // subject { api\_group = "rbac.authorization.k8s.io" kind = "Group" name = var.tfc\_organization\_name } // Option B - Bind RBAC roles to user identities // // Users are extracted from the 'sub' token claim. // Plan and apply phases get assigned different users identities. // For HCP Terraform tokens, the format of the user id is always the one described bellow. // subject { api\_group = "rbac.authorization.k8s.io" kind = "User" name = "${var.tfc\_hostname}#organization:${var.tfc\_organization\_name}:project:${var.tfc\_project\_name}:workspace:${var.tfc\_workspace\_name}:run\_phase:plan" } subject { api\_group = "rbac.authorization.k8s.io" kind = "User" name = "${var.tfc\_hostname}#organization:${var.tfc\_organization\_name}:project:${var.tfc\_project\_name}:workspace:${var.tfc\_workspace\_name}:run\_phase:apply" } } ``` If binding with "User" subjects, be aware that plan and apply phases are assigned different identities, each requiring specific bindings. Meaning you can tailor permissions for each Terraform operation. Planning operations usually require "read-only" permissions, while apply operations also require "write" access. !> \*\*Warning\*\*: Always check, at minimum, the audience and the organization's | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/kubernetes-configuration.mdx | main | terraform | [
-0.01127429399639368,
0.013626912608742714,
0.011405296623706818,
-0.028584731742739677,
-0.0748453140258789,
0.05586477369070053,
-0.01961088925600052,
-0.007943772710859776,
0.06178657338023186,
0.028902532532811165,
-0.05772353708744049,
-0.09975028783082962,
0.08527559787034988,
-0.014... | 0.034218 |
"User" subjects, be aware that plan and apply phases are assigned different identities, each requiring specific bindings. Meaning you can tailor permissions for each Terraform operation. Planning operations usually require "read-only" permissions, while apply operations also require "write" access. !> \*\*Warning\*\*: Always check, at minimum, the audience and the organization's name to prevent unauthorized access from other HCP Terraform organizations. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You must set certain environment variables in your HCP Terraform workspace to configure HCP Terraform to authenticate with Kubernetes or Helm using dynamic credentials. You can set these as workspace variables, or if you’d like to share one Kubernetes role across multiple workspaces, you can use a variable set. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_KUBERNETES\_PROVIDER\_AUTH` `TFC\_KUBERNETES\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.14.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate to Kubernetes. | | `TFC\_KUBERNETES\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_KUBERNETES\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_KUBERNETES\_WORKLOAD\_IDENTITY\_AUDIENCE` | The audience name in your cluster's OIDC configuration, such as `kubernetes`. | Requires \*\*v1.14.0\*\* or later if self-managing agents. | ## Configure the provider The Kubernetes and Helm providers share the same schema of configuration attributes for the provider block. The example below illustrates using the Kubernetes provider but the same configuration applies to the Helm provider. Make sure that you are not using any of the other arguments or methods listed in the [authentication](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#authentication) section of the provider documentation as these settings may interfere with dynamic provider credentials. The only allowed provider attributes are `host` and `cluster\_ca\_certificate`. ### Single provider instance HCP Terraform automatically sets the `KUBE\_TOKEN` environment variable and includes the workload identity token. The provider needs to be configured with the URL of the API endpoint using the `host` attribute (or `KUBE\_HOST` environment variable). In most cases, the `cluster\_ca\_certificate` (or `KUBE\_CLUSTER\_CA\_CERT\_DATA` environment variable) is also required. #### Example Usage ```hcl provider "kubernetes" { host = var.cluster-endpoint-url cluster\_ca\_certificate = base64decode(var.cluster-endpoint-ca) } ``` ### Multiple aliases You can add additional variables to handle multiple distinct Kubernetes clusters, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_kubernetes\_dynamic\_credentials" { description = "Object containing Kubernetes dynamic credentials configuration" type = object({ default = object({ token\_path = string }) aliases = map(object({ token\_path = string })) }) } ``` #### Example Usage ```hcl provider "kubernetes" { alias = "ALIAS1" host = var.alias1-endpoint-url cluster\_ca\_certificate = base64decode(var.alias1-cluster-ca) token = file(var.tfc\_kubernetes\_dynamic\_credentials.aliases["ALIAS1"].token\_path) } provider "kubernetes" { alias = "ALIAS2" host = var.alias1-endpoint-url cluster\_ca\_certificate = base64decode(var.alias1-cluster-ca) token = file(var.tfc\_kubernetes\_dynamic\_credentials.aliases["ALIAS2"].token\_path) } ``` The `tfc\_kubernetes\_dynamic\_credentials` variable is also available to use for single provider configurations, instead of the `KUBE\_TOKEN` environment variable. ```hcl provider "kubernetes" { host = var.cluster-endpoint-url cluster\_ca\_certificate = base64decode(var.cluster-endpoint-ca) token = file(var.tfc\_kubernetes\_dynamic\_credentials.default.token\_path) } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/kubernetes-configuration.mdx | main | terraform | [
-0.015597444027662277,
0.0164646003395319,
0.04971443489193916,
-0.03261764347553253,
-0.08265197277069092,
0.008905396796762943,
0.017395740374922752,
-0.0075732688419520855,
0.017509646713733673,
0.02295827306807041,
-0.07426249235868454,
-0.1253804862499237,
0.057833779603242874,
0.0023... | 0.044929 |
} ``` The `tfc\_kubernetes\_dynamic\_credentials` variable is also available to use for single provider configurations, instead of the `KUBE\_TOKEN` environment variable. ```hcl provider "kubernetes" { host = var.cluster-endpoint-url cluster\_ca\_certificate = base64decode(var.cluster-endpoint-ca) token = file(var.tfc\_kubernetes\_dynamic\_credentials.default.token\_path) } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/kubernetes-configuration.mdx | main | terraform | [
0.034979283809661865,
-0.00017034650954883546,
-0.018729669973254204,
-0.006515672896057367,
-0.08197104185819626,
0.04179270938038826,
0.019390638917684555,
0.06542782485485077,
0.07250785827636719,
-0.0018358987290412188,
-0.03868813440203667,
-0.11069846153259277,
0.01784701831638813,
0... | 0.037906 |
# Use dynamic credentials with the Vault provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with Vault to get [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for the Vault provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Vault](#configure-vault):\*\* Set up a trust configuration between Vault and HCP Terraform. Then, you must create Vault roles and policies for your HCP Terraform workspaces. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete the setup, HCP Terraform automatically authenticates to Vault during each run. The Vault provider authentication is valid for the length of the plan or apply. Vault does not revoke authentication until the run is complete. If you are using Vault's [secrets engines](/vault/docs/secrets), you must complete the following set up before continuing to configure [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed). ## Configure Vault You must enable and configure the JWT backend in Vault. These instructions use the Vault CLI commands, but you can also use Terraform to configure Vault. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/vault). ### Enable the JWT Auth Backend Run the following command to enable the JWT auth backend in Vault: ```shell vault auth enable jwt ``` ### Configure Trust with HCP Terraform You must configure Vault to trust HCP Terraform’s identity tokens and verify them using HCP Terraform’s public key. The following command configures the `jwt` auth backend in Vault to trust HCP Terraform as an OIDC identity provider: ```shell vault write auth/jwt/config \ oidc\_discovery\_url="https://app.terraform.io" \ bound\_issuer="https://app.terraform.io" ``` The `oidc\_discovery\_url` and `bound\_issuer` should both be the root address of HCP Terraform, including the scheme and without a trailing slash. #### Terraform Enterprise Specific Requirements If you are using a custom or self-signed CA certificate you may need to specify the CA certificate or chain of certificates, in PEM format, via the [`oidc\_discovery\_ca\_pem`](/vault/api-docs/auth/jwt#oidc\_discovery\_ca\_pem) argument as shown in the following example command: ```shell vault write auth/jwt/config \ oidc\_discovery\_url="https://app.terraform.io" \ bound\_issuer="https://app.terraform.io" \ oidc\_discovery\_ca\_pem=@my-cert.pem ``` In the example above, `my-cert.pem` is a PEM formatted file containing the certificate. ### Create a Vault Policy You must create a Vault policy that controls what paths and secrets your HCP Terraform workspace can access in Vault. Create a file called tfc-policy.hcl with the following content: ```hcl # Allow tokens to query themselves path "auth/token/lookup-self" { capabilities = ["read"] } # Allow tokens to renew themselves path "auth/token/renew-self" { capabilities = ["update"] } # Allow tokens to revoke themselves path "auth/token/revoke-self" { capabilities = ["update"] } # Configure the actual secrets the token should have access to path "secret/\*" { capabilities = ["read"] } ``` Then create the policy in Vault: ```shell vault policy write tfc-policy tfc-policy.hcl ``` ### Create a JWT Auth Role Create a Vault role that HCP Terraform can use when authenticating to Vault. Vault offers a lot of flexibility in determining how to map roles and permissions in Vault to workspaces in HCP Terraform. You can have one role for each workspace, one role for a group of workspaces, or one role for all workspaces in an organization. You can also configure different roles for the plan and apply phases of a run. -> \*\*Note:\*\* If you set your `user\_claim` to be per workspace, then Vault ties the entity it creates to that workspace's | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-configuration.mdx | main | terraform | [
-0.003398524597287178,
0.027659377083182335,
-0.015465221367776394,
-0.03082803450524807,
-0.06950604915618896,
0.0233598779886961,
-0.0465150810778141,
0.007619073148816824,
0.03188526630401611,
0.010046477429568768,
-0.0427706241607666,
-0.07058175653219223,
0.1006648987531662,
-0.003065... | -0.056386 |
for a group of workspaces, or one role for all workspaces in an organization. You can also configure different roles for the plan and apply phases of a run. -> \*\*Note:\*\* If you set your `user\_claim` to be per workspace, then Vault ties the entity it creates to that workspace's name. If you rename the workspace tied to your `user\_claim`, Vault will create an additional identity object. To avoid this, update the alias name in Vault to your new workspace name before you update it in HCP Terraform. The following example creates a role called `tfc-role`. The role is mapped to a single workspace and HCP Terraform can use it for both plan and apply runs. Create a file called `vault-jwt-auth-role.json` with the following content: ```json { "policies": ["tfc-policy"], "bound\_audiences": ["vault.workload.identity"], "bound\_claims\_type": "glob", "bound\_claims": { "sub": "organization:my-org-name:project:my-project-name:workspace:my-workspace-name:run\_phase:\*" }, "user\_claim": "terraform\_full\_workspace", "role\_type": "jwt", "token\_ttl": "20m" } ``` Then run the following command to create a role named `tfc-role` with this configuration in Vault: ```shell vault write auth/jwt/role/tfc-role @vault-jwt-auth-role.json ``` To understand all the available options for matching bound claims, refer to the [Terraform workload identity claim specification](/terraform/cloud-docs/dynamic-provider-credentials) and the [Vault documentation on configuring bound claims](/vault/docs/auth/jwt#bound-claims). To understand all the options available when configuring Vault JWT auth roles, refer to the [Vault API documentation](/vault/api-docs/auth/jwt#create-role). !> \*\*Warning:\*\* you should always check, at minimum, the audience and the name of the organization in order to prevent unauthorized access from other HCP Terraform organizations! #### Token TTLs We recommend creating a role which issues a renewable token, and setting `token\_ttl` to a relatively short value, such as 20 minutes. HCP Terraform can renew the token periodically until the plan or apply is complete, then revoke it to prevent it from being used further. If you use a non-renewable token with HCP Terraform, the `token\_ttl` has a maximum limit of 2 hours. If you use a non-renewable token with Terraform Enterprise, then the `token\_ttl` of that token must match or exceed the [run phase timeout](/terraform/enterprise/application-administration/general#terraform-run-timeout-settings). ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You’ll need to set some environment variables in your HCP Terraform workspace in order to configure HCP Terraform to authenticate with Vault using dynamic credentials. You can set these as workspace variables, or if you’d like to share one Vault role across multiple workspaces, you can use a variable set. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_PROVIDER\_AUTH` `TFC\_VAULT\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate to Vault. | | `TFC\_VAULT\_ADDR` `TFC\_VAULT\_ADDR[\_TAG]` `TFC\_DEFAULT\_VAULT\_ADDR` | The address of the Vault instance to authenticate against. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will also be used to set `VAULT\_ADDR` in the run environment. | | `TFC\_VAULT\_RUN\_ROLE` `TFC\_VAULT\_RUN\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_RUN\_ROLE` | The name of the Vault role to authenticate against (`tfc-role`, in our example). | Requires \*\*v1.7.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_PLAN\_ROLE` and `TFC\_VAULT\_APPLY\_ROLE` are both provided. These variables are described [below](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration#optional-environment-variables) | ### Optional Environment Variables You may need to set these variables, depending on your Vault configuration and use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_NAMESPACE` `TFC\_VAULT\_NAMESPACE[\_TAG]` `TFC\_DEFAULT\_VAULT\_NAMESPACE` | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-configuration.mdx | main | terraform | [
-0.0122004933655262,
0.021251896396279335,
0.0308690145611763,
-0.01801442541182041,
-0.03095010668039322,
-0.02879183739423752,
-0.012192202731966972,
-0.045967843383550644,
0.045312073081731796,
-0.014186869375407696,
-0.024251023307442665,
-0.09130167216062546,
0.07796572893857956,
0.00... | -0.0404 |
later if self-managing agents. Optional if `TFC\_VAULT\_PLAN\_ROLE` and `TFC\_VAULT\_APPLY\_ROLE` are both provided. These variables are described [below](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration#optional-environment-variables) | ### Optional Environment Variables You may need to set these variables, depending on your Vault configuration and use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_NAMESPACE` `TFC\_VAULT\_NAMESPACE[\_TAG]` `TFC\_DEFAULT\_VAULT\_NAMESPACE` | The namespace to use when authenticating to Vault. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will also be used to set `VAULT\_NAMESPACE` in the run environment. | | `TFC\_VAULT\_AUTH\_PATH` `TFC\_VAULT\_AUTH\_PATH[\_TAG]` `TFC\_DEFAULT\_VAULT\_AUTH\_PATH` | The path where the JWT auth backend is mounted in Vault. Defaults to jwt. | Requires \*\*v1.7.0\*\* or later if self-managing agents. | | `TFC\_VAULT\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_VAULT\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_VAULT\_WORKLOAD\_IDENTITY\_AUDIENCE` | Will be used as the `aud` claim for the identity token. Defaults to `vault.workload.identity`. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must match the `bound\_audiences` configured for the role in Vault. | | `TFC\_VAULT\_PLAN\_ROLE` `TFC\_VAULT\_PLAN\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_PLAN\_ROLE` | The Vault role to use for the plan phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_RUN\_ROLE` if not provided. | | `TFC\_VAULT\_APPLY\_ROLE` `TFC\_VAULT\_APPLY\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_APPLY\_ROLE` | The Vault role to use for the apply phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_RUN\_ROLE` if not provided. | | `TFC\_VAULT\_ENCODED\_CACERT` `TFC\_VAULT\_ENCODED\_CACERT[\_TAG]` `TFC\_DEFAULT\_VAULT\_ENCODED\_CACERT` | A PEM-encoded CA certificate that has been Base64 encoded. | Requires \*\*v1.9.0\*\* or later if self-managing agents. This certificate will be used when connecting to Vault. May be required when connecting to Vault instances that use a custom or self-signed certificate. | ## Vault Provider Configuration Once you set up dynamic credentials for a workspace, HCP Terraform automatically authenticates to Vault for each run. Do not pass the `address`, `token`, or `namespace` arguments into the provider configuration block. HCP Terraform sets these values as environment variables in the run environment. You can use the Vault provider to read static secrets from Vault and use them with other Terraform resources. You can also access the other resources and data sources available in the [Vault provider documentation](https://registry.terraform.io/providers/hashicorp/vault/latest). You must adjust your [Vault policy](#create-a-vault-policy) to give your HCP Terraform workspace access to all required Vault paths. ~> \*\*Important:\*\* data sources that use secrets engines to generate dynamic secrets must not be used with Vault dynamic credentials. You can use Vault's dynamic secrets engines for AWS, GCP, and Azure by adding additional configurations. For more details, see [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed). ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). ~> \*\*Important:\*\* Ensure you are using version \*\*3.18.0\*\* or later of the \*\*Vault provider\*\* as the required [`auth\_login\_token\_file`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs#token-file) block was introduced in this provider version. You can add additional variables to handle multiple distinct Vault setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_vault\_dynamic\_credentials" { description = "Object containing Vault dynamic credentials configuration" type = object({ default = object({ token\_filename = string address = string namespace = string ca\_cert\_file = string }) aliases = map(object({ token\_filename = string address = string namespace = string ca\_cert\_file = | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-configuration.mdx | main | terraform | [
0.07114052772521973,
0.0710831955075264,
-0.017542637884616852,
-0.01470402255654335,
-0.03189465031027794,
0.0023994629736989737,
-0.01249787025153637,
-0.005980002228170633,
0.03125463426113129,
-0.0016730461502447724,
0.055904045701026917,
-0.1138748824596405,
0.04098604619503021,
0.028... | -0.078714 |
to the correct provider blocks. ```hcl variable "tfc\_vault\_dynamic\_credentials" { description = "Object containing Vault dynamic credentials configuration" type = object({ default = object({ token\_filename = string address = string namespace = string ca\_cert\_file = string }) aliases = map(object({ token\_filename = string address = string namespace = string ca\_cert\_file = string })) }) } ``` #### Example Usage ```hcl provider "vault" { // skip\_child\_token must be explicitly set to true as HCP Terraform manages the token lifecycle skip\_child\_token = true address = var.tfc\_vault\_dynamic\_credentials.default.address namespace = var.tfc\_vault\_dynamic\_credentials.default.namespace auth\_login\_token\_file { filename = var.tfc\_vault\_dynamic\_credentials.default.token\_filename } } provider "vault" { // skip\_child\_token must be explicitly set to true as HCP Terraform manages the token lifecycle skip\_child\_token = true alias = "ALIAS1" address = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].address namespace = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].namespace auth\_login\_token\_file { filename = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].token\_filename } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-configuration.mdx | main | terraform | [
0.013217534869909286,
0.06957259774208069,
0.007906957529485226,
-0.027024060487747192,
-0.059361010789871216,
-0.011393491178750992,
-0.01897462084889412,
0.019856106489896774,
0.019314933568239212,
-0.033353958278894424,
0.008815983310341835,
-0.12032198905944824,
0.05769118294119835,
0.... | -0.133217 |
# Dynamic Credentials with the HCP Provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.15.1](/terraform/cloud-docs/agents/changelog#1-15-1-05-01-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with HCP to authenticate with the HCP provider using [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) in your HCP Terraform runs. Configuring dynamic credentials for the HCP provider requires the following steps: 1. \*\*[Configure HCP](#configure-hcp):\*\* Set up a trust configuration between HCP and HCP Terraform. Then, you must create a [service principal in HPC](/hcp/docs/hcp/iam/service-principal) for your HCP Terraform workspaces. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete the setup, HCP Terraform automatically authenticates to HCP during each run. ## Configure HCP You must enable and configure a workload identity pool and provider on HCP. These instructions use the HCP CLI, but you can also use Terraform to configure HCP. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/hcp). #### Create a Service Principal Create a service principal for HCP Terraform to assume during runs by running the following HCP command. Note the ID of the service principal you create because you will need it in the following steps. For all remaining steps, replace `HCP\_PROJECT\_ID` with the ID of the project that contains all the resources and workspaces that you want to manage with this service principal. If you wish to manage more than one project with dynamic credentials, it is recommended that you create multiple service principals, one for each project. ```shell hcp iam service-principals create hcp-terraform --project=HCP\_PROJECT\_ID ``` Grant your service principal the necessary permissions to manage your infrastructure during runs. ```shell hcp projects iam add-binding \ --project=HCP\_PROJECT\_ID \ --member=HCP\_PRINCIPAL\_ID \ --role=roles/contributor ``` #### Add a Workload Identity Provider Next, create a workload identity provider that HCP uses to authenticate the HCP Terraform run. Make sure to replace `HCP\_PROJECT\_ID`, `ORG\_NAME`, `PROJECT\_NAME`, and `WORKSPACE\_NAME` with their respective values before running the command. ```shell hcp iam workload-identity-providers create-oidc hcp-terraform-dynamic-credentials \ --service-principal=iam/project/HCP\_PROJECT\_ID/service-principal/hcp-terraform \ --issuer=https://app.terraform.io \ --allowed-audience=hcp.workload.identity \ --conditional-access='jwt\_claims.sub matches `^organization:ORG\_NAME:project:PROJECT\_NAME:workspace:WORKSPACE\_NAME:run\_phase:.\*`' \ --description="Allow HCP Terraform agents to act as the hcp-terraform service principal" ``` ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set environment variables in your HCP Terraform workspace to configure HCP Terraform to authenticate with HCP using dynamic credentials. You can set these as workspace variables or use a variable set to share one HCP service principal across multiple workspaces. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HCP\_PROVIDER\_AUTH` `TFC\_HCP\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.15.1\*\* or later if you use self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to use dynamic credentials to authenticate to HCP. | | `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME[\_TAG]` `TFC\_DEFAULT\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` | The resource name of the workload identity provider that will be used to assume the service principal | Requires \*\*v1.15.1\*\* or later if you use self-managing agents. Optional if you provide `PLAN\_PROVIDER\_RESOURCE\_NAME` and `APPLY\_PROVIDER\_RESOURCE\_NAME`. [Learn more](#optional-environment-variables). | ### Optional Environment Variables You may | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-configuration.mdx | main | terraform | [
-0.04348991811275482,
0.023877833038568497,
0.012909901328384876,
-0.04109303280711174,
-0.07352220267057419,
0.05194440484046936,
-0.021968316286802292,
0.000528225558809936,
0.006495021749287844,
0.008067148737609386,
-0.042310211807489395,
-0.08243252336978912,
0.09121406823396683,
-0.0... | -0.032705 |
HCP. | | `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` `TFC\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME[\_TAG]` `TFC\_DEFAULT\_HCP\_RUN\_PROVIDER\_RESOURCE\_NAME` | The resource name of the workload identity provider that will be used to assume the service principal | Requires \*\*v1.15.1\*\* or later if you use self-managing agents. Optional if you provide `PLAN\_PROVIDER\_RESOURCE\_NAME` and `APPLY\_PROVIDER\_RESOURCE\_NAME`. [Learn more](#optional-environment-variables). | ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HCP\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_HCP\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_HCP\_WORKLOAD\_IDENTITY\_AUDIENCE` | HCP Terraform uses this as the `aud` claim for the identity token. Defaults to the provider resource name for the current run phase, which HCP Terraform derives from the values you provide for `RUN\_PROVIDER\_RESOURCE\_NAME`, `PLAN\_PROVIDER\_RESOURCE\_NAME`, and `APPLY\_PROVIDER\_RESOURCE\_NAME`. | Requires \*\*v1.15.1\*\* or later if you use self-managing agents. This is one of the default `aud` formats that HCP accepts. | | `TFC\_HCP\_PLAN\_PROVIDER\_RESOURCE\_NAME` `TFC\_HCP\_PLAN\_PROVIDER\_RESOURCE\_NAME[\_TAG]` `TFC\_DEFAULT\_HCP\_PLAN\_PROVIDER\_RESOURCE\_NAME` | The resource name of the workload identity provider that will HCP Terraform will use to authenticate the agent during the plan phase of a run. | Requires \*\*v1.15.1\*\* or later if self-managing agents. Will fall back to the value of `RUN\_PROVIDER\_RESOURCE\_NAME` if not provided. | | `TFC\_HCP\_APPLY\_PROVIDER\_RESOURCE\_NAME` `TFC\_HCP\_APPLY\_PROVIDER\_RESOURCE\_NAME[\_TAG]` `TFC\_DEFAULT\_HCP\_APPLY\_PROVIDER\_RESOURCE\_NAME` | The resource name of the workload identity provider that will HCP Terraform will use to authenticate the agent during the apply phase of a run. | Requires \*\*v1.15.1\*\* or later if self-managing agents. Will fall back to the value of `RUN\_PROVIDER\_RESOURCE\_NAME` if not provided. | ## Configure the HCP Provider Do not set the `HCP\_CRED\_FILE` environment variable when configuring the HCP provider, or `HCP\_CRED\_FILE` will conflict with the dynamic credentials authentication process. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.15.1](/terraform/cloud-docs/agents/changelog#1-15-1-05-01-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct HCP setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, refer to [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable Add the following variable to your Terraform configuration to set up additional dynamic credential configurations with the HCP provider. This variable lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_hcp\_dynamic\_credentials" { description = "Object containing HCP dynamic credentials configuration" type = object({ default = object({ credential\_file = string }) aliases = map(object({ credential\_file = string })) }) } ``` #### Example Usage ```hcl provider "hcp" { credential\_file = var.tfc\_hcp\_dynamic\_credentials.default.credential\_file } provider "hcp" { alias = "ALIAS1" credential\_file = var.tfc\_hcp\_dynamic\_credentials.aliases["ALIAS1"].credential\_file } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-configuration.mdx | main | terraform | [
-0.027372734621167183,
0.041677456349134445,
-0.07022037357091904,
-0.020219525322318077,
-0.07580447942018509,
0.06057308241724968,
0.07777706533670425,
0.07125192135572433,
-0.05264292284846306,
-0.023924367502331734,
0.06510547548532486,
-0.11416730284690857,
0.026128338649868965,
0.001... | 0.006987 |
# Specify multiple dynamic credential configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can create multiple dynamic credential configurations of the same provider in a workspace. Each configuration generates a distinct [workload identity token](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/workload-identity-tokens), allowing you to create [aliases for different provider configurations](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can specify unique audience values per configuration, and [manually generate multiple tokens](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/manual-generation). Specifying multiple dynamic credential configurations in HCP Terraform builds on the existing method of providing each provider's environment variables to a workspace. The process requires mapping well-known authentication [input variables](/terraform/language/values/variables) to the correct providers. ## Configure HCP Terraform You can specify additional dynamic credentials configurations by defining and appending a “tag” to the end of your existing required environment variables: `[DYNAMIC\_CREDENTIALS\_VAR\_NAME]\_[YOUR\_TAG]`. Your tag can only contain letters, numbers, and underscores and can not use reserved keywords. The following keywords are reserved: `TYPE`. ### Example Using [Vault's dynamic credentials](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/vault-configuration) setup as an example, we can create additional configurations by setting new tagged variables that match Vault's [required environment variables](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/vault-configuration#required-environment-variables). So, if you want to add a configuration with the tag `ALIAS1`, you must set environment variables for `TFC\_VAULT\_PROVIDER\_AUTH\_ALIAS1`, `TFC\_VAULT\_ADDR\_ALIAS1`, and `TFC\_VAULT\_RUN\_ROLE\_ALIAS1`. ### Default Values for Multiple Configurations Each environment variable has a corresponding default variable which you can use to share values across multiple configurations. In this way, you can set values common to multiple configurations a single time, rather than repeating them for each configuration. If you explicitly set the corresponding environment variable in addition to the default variable, the explicit value is given precedence. #### Example In the [example above](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/specifying-multiple-configurations#example), if each of your Vault configurations used the same underlying Vault instance, you could define the Vault address a single time using the `TFC\_DEFAULT\_VAULT\_ADDR` variable, and omit `TFC\_VAULT\_ADDR` and `TFC\_VAULT\_ADDR\_ALIAS1`. If you add a third Vault configuration for a different Vault instance with the tag `ALIAS2`, you could set the variable `TFC\_VAULT\_ADDR\_ALIAS2` to override the Vault address specifically for the `ALIAS2` configuration. ## Configure Terraform Code Each supported provider has input variables you must declare in your Terraform code to use dynamic credentials with that provider. Each dynamic provider's documentation page lists the required variables for that provider. HCP Terraform provides values for these variables during runs, which you can use to authenticate HCP Terraform with providers using dynamic credentials. Use the input variable values that HCP Terraform provides to map configuration values to the correct provider blocks. Authentication information for the default provider exists in a variable's top-level `default` object, while each additional configuration exists under a variable's `aliases` map. HCP Terraform generates the keys of the `aliases` map based on the tag you define in your HCP Terraform configuration. ~> \*\*Important:\*\* If you add additional configurations to a workspace, you need to manually map authentication information for all providers \*including\* the default provider. ### Example Continuing from the [example above](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/specifying-multiple-configurations#example), after setting the required environment variables for your provider, [add the following code to your Terraform configuration](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/vault-configuration#required-terraform-variable). This lets HCP Terraform supply variable values that you can use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_vault\_dynamic\_credentials" { description = "Object containing Vault dynamic credentials configuration" type = object({ default = object({ token\_filename = string address = string namespace = string ca\_cert\_file = string }) aliases = map(object({ token\_filename = string address = string namespace = string ca\_cert\_file = string })) }) } ``` Use the above object to map authentication information to the correct provider block. For | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations.mdx | main | terraform | [
-0.02171122469007969,
-0.043039750307798386,
-0.006572933401912451,
-0.01348190475255251,
-0.07196318358182907,
0.001227623550221324,
0.03849094733595848,
-0.03293207660317421,
0.04908477142453194,
0.04398477077484131,
-0.07010599970817566,
-0.1266782283782959,
0.1123245358467102,
0.024747... | 0.001988 |
object({ default = object({ token\_filename = string address = string namespace = string ca\_cert\_file = string }) aliases = map(object({ token\_filename = string address = string namespace = string ca\_cert\_file = string })) }) } ``` Use the above object to map authentication information to the correct provider block. For this example, index into the `aliases` map with your alias's tag (`ALIAS1`) and the `default` provider object. ```hcl provider "vault" { // Set this to true as HCP Terraform manages the token lifecycle skip\_child\_token = true address = var.tfc\_vault\_dynamic\_credentials.default.address namespace = var.tfc\_vault\_dynamic\_credentials.default.namespace auth\_login\_token\_file { filename = var.tfc\_vault\_dynamic\_credentials.default.token\_filename } } provider "vault" { // Set this to true as HCP Terraform manages the token lifecycle skip\_child\_token = true alias = "ALIAS1" address = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].address namespace = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].namespace auth\_login\_token\_file { filename = var.tfc\_vault\_dynamic\_credentials.aliases["ALIAS1"].token\_filename } } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations.mdx | main | terraform | [
-0.0026504031848162413,
0.08519607782363892,
0.019689766690135002,
-0.008120662532746792,
-0.05001981183886528,
-0.0001201688646688126,
0.01389327272772789,
0.037784937769174576,
-0.011102941818535328,
-0.00996608380228281,
0.0063636223785579205,
-0.1329335868358612,
0.07090777903795242,
0... | -0.082754 |
# Manually generate workload identity tokens ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). If required for custom auth workflows or to perform auth with providers that are not natively supported by dynamic credentials, you can request that HCP Terraform inject a [workload identity token](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/workload-identity-tokens) into the run environment for usage in agent hooks. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. ### Required Environment Variables You’ll need to set the following environment variable in your HCP Terraform workspace in order to have HCP Terraform inject a workload identity token into the run environment. You can set this as a workspace variable, or if you’d like to inject tokens with the same audience value across multiple workspaces, you can use a variable set. | Variable | Value | Notes | |----------------------------------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_WORKLOAD\_IDENTITY\_AUDIENCE` | The desired value for the token’s audience. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must be present and set or HCP Terraform will not inject a workload identity token into the run environment. | ### Generating Multiple Tokens ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can generate multiple tokens if you want distinct audience values for different consumers of your workload identity tokens. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/specifying-multiple-configurations). You can generate multiple tokens by specifying additional variables in the following format: `TFC\_WORKLOAD\_IDENTITY\_AUDIENCE\_[YOUR\_TAG\_HERE]`. Your tag can only contain letters, numbers, and underscores and can not use reserved keywords. The following keywords are reserved: `TYPE`. Each additional audience variable you specify generates an additional workload identity token that HCP Terraform stores in variables with the format: `TFC\_WORKLOAD\_IDENTITY\_TOKEN\_[YOUR\_TAG\_HERE]`. ## Configure Agent Hooks After you've set the `TFC\_WORKLOAD\_IDENTITY\_AUDIENCE` variable, each plan and apply will have a `TFC\_WORKLOAD\_IDENTITY\_TOKEN` variable available in the run environment, which contains a [workload identity token](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/workload-identity-tokens). You can use this environment variable in custom agent hooks to enable custom auth workflows or to perform auth with providers which are not natively supported by dynamic credentials. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/manual-generation.mdx | main | terraform | [
-0.056035153567790985,
0.007772567216306925,
0.013738926500082016,
-0.010942584834992886,
-0.04388663172721863,
-0.009971238672733307,
0.018919887021183968,
-0.02159169875085354,
0.03549806773662567,
0.04272804036736488,
-0.07428254187107086,
-0.10665173828601837,
0.06280957907438278,
0.02... | 0.056111 |
# Use dynamic credentials with the AWS provider You can use HCP Terraform’s native OpenID Connect integration with AWS to get [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for the AWS provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure AWS](#configure-aws):\*\* Set up a trust configuration between AWS and HCP Terraform. Then, you must create AWS roles and policies for your HCP Terraform workspaces. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete the setup, HCP Terraform automatically authenticates to AWS during each run. The AWS provider authentication is valid for the length of the plan or apply. ## Requirements for agents If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). ## Configure AWS You must enable and configure an OIDC identity provider and accompanying role and trust policy on AWS. These instructions use the AWS console, but you can also use Terraform to configure AWS. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/aws). ### Create an OIDC Identity Provider AWS documentation for setting this up through the AWS console or API can be found here: [Creating OpenID Connect (OIDC) identity providers - AWS Identity and Access Management](https://docs.aws.amazon.com/IAM/latest/UserGuide/id\_roles\_providers\_create\_oidc.html). The `provider URL` should be set to the address of HCP Terraform (e.g., https://app.terraform.io \*\*without\*\* a trailing slash), and the `audience` should be set to `aws.workload.identity` or the value of `TFC\_AWS\_WORKLOAD\_IDENTITY\_AUDIENCE`, if configured. ### Configure a Role and Trust Policy You must configure a role and corresponding trust policy. Refer to [Creating a role for web identity or OpenID Connect Federation (console) - AWS Identity and Access Management](https://docs.aws.amazon.com/IAM/latest/UserGuide/id\_roles\_create\_for-idp\_oidc.html) in the Amazon documentation for instructions. The following example shows the trust policy format: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "OIDC\_PROVIDER\_ARN" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "SITE\_ADDRESS:aud": "AUDIENCE\_VALUE", "SITE\_ADDRESS:sub": "organization:ORG\_NAME:project:PROJECT\_NAME:workspace:WORKSPACE\_NAME:run\_phase:RUN\_PHASE" } } } ] } ``` with the capitalized values replaced with the following: \* \*\*OIDC\_PROVIDER\_ARN\*\*: The ARN from the OIDC provider resource created in the previous step \* \*\*SITE\_ADDRESS\*\*: The address of HCP Terraform with `https://` stripped, (e.g., `app.terraform.io`) \* \*\*AUDIENCE\_VALUE\*\*: This should be set to `aws.workload.identity` unless a non-default audience has been specified in TFC \* \*\*ORG\_NAME\*\*: The organization name this policy will apply to, such as `my-org-name` \* \*\*PROJECT\_NAME\*\*: The project name that this policy will apply to, such as `my-project-name` \* \*\*WORKSPACE\_NAME\*\*: The workspace name this policy will apply to, such as `my-workspace-name` \* \*\*RUN\_PHASE\*\*: The run phase this policy will apply to, currently one of `plan` or `apply`. -> \*\*Note:\*\* if different permissions are desired for plan and apply, then two separate roles and trust policies must be created for each of these run phases to properly match them to the correct access level. If the same permissions will be used regardless of run phase, then the condition can be modified like the below to use `StringLike` instead of `StringEquals` for the sub and include a `\*` after `run\_phase:` to perform a wildcard match: ```json { "Condition": { "StringEquals": { "SITE\_ADDRESS:aud": "AUDIENCE\_VALUE" }, "StringLike": { "SITE\_ADDRESS:sub": "organization:ORG\_NAME:project:PROJECT\_NAME:workspace:WORKSPACE\_NAME:run\_phase:\*" } } } ``` !> \*\*Warning\*\*: you should always check, at minimum, the audience and the name of the organization in order to prevent unauthorized access from other HCP Terraform organizations! A permissions policy needs to be added to the role which defines what operations within AWS the role | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/aws-configuration.mdx | main | terraform | [
-0.02589697204530239,
0.013182044960558414,
-0.006335445214062929,
-0.015660006552934647,
-0.09390746802091599,
0.045056648552417755,
-0.004069145768880844,
-0.0007432337151840329,
0.0061073899269104,
0.02619166113436222,
-0.07087574154138565,
-0.11583250015974045,
0.10274636000394821,
-0.... | -0.02889 |
"organization:ORG\_NAME:project:PROJECT\_NAME:workspace:WORKSPACE\_NAME:run\_phase:\*" } } } ``` !> \*\*Warning\*\*: you should always check, at minimum, the audience and the name of the organization in order to prevent unauthorized access from other HCP Terraform organizations! A permissions policy needs to be added to the role which defines what operations within AWS the role is allowed to perform. As an example, the below policy allows for fetching a list of S3 buckets: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": "\*" } ] } ``` ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You’ll need to set some environment variables in your HCP Terraform workspace in order to configure HCP Terraform to authenticate with AWS using dynamic credentials. You can set these as workspace variables, or if you’d like to share one AWS role across multiple workspaces, you can use a variable set. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |----------------------------------------------------------------------------------------------|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_AWS\_PROVIDER\_AUTH` `TFC\_AWS\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate to AWS. | | `TFC\_AWS\_RUN\_ROLE\_ARN` `TFC\_AWS\_RUN\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_AWS\_RUN\_ROLE\_ARN` | The ARN of the role to assume in AWS. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Optional if `TFC\_AWS\_PLAN\_ROLE\_ARN` and `TFC\_AWS\_APPLY\_ROLE\_ARN` are both provided. Refer to [Optional environment variables](/terraform/cloud-docs/dynamic-provider-credentials/aws-configuration#optional-environment-variables) for more information.| ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| | `TFC\_AWS\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_AWS\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_AWS\_WORKLOAD\_IDENTITY\_AUDIENCE` | Will be used as the `aud` claim for the identity token. Defaults to `aws.workload.identity`. | Requires \*\*v1.7.0\*\* or later if self-managing agents. | | `TFC\_AWS\_PLAN\_ROLE\_ARN` `TFC\_AWS\_PLAN\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_AWS\_PLAN\_ROLE\_ARN` | The ARN of the role to use for the plan phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_AWS\_RUN\_ROLE\_ARN` if not provided. | | `TFC\_AWS\_APPLY\_ROLE\_ARN` `TFC\_AWS\_APPLY\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_AWS\_APPLY\_ROLE\_ARN` | The ARN of the role to use for the apply phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_AWS\_RUN\_ROLE\_ARN` if not provided. | ## Configure the AWS Provider Make sure that you’re passing a value for the `region` argument into the provider configuration block or setting the `AWS\_REGION` variable in your workspace. Make sure that you’re not using any of the other arguments or methods mentioned in the [authentication and configuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration) section of the provider documentation as these settings may interfere with dynamic provider credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct AWS setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/aws-configuration.mdx | main | terraform | [
-0.03466051071882248,
0.03306035324931145,
-0.018079061061143875,
-0.024117128923535347,
0.03622899204492569,
-0.01001038122922182,
0.006526393815875053,
-0.07412576675415039,
0.02800830826163292,
0.052042145282030106,
-0.0051819696091115475,
-0.08409614115953445,
0.07500229775905609,
-0.0... | 0.018718 |
by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_aws\_dynamic\_credentials" { description = "Object containing AWS dynamic credentials configuration" type = object({ default = object({ shared\_config\_file = string }) aliases = map(object({ shared\_config\_file = string })) }) } ``` #### Example Usage ```hcl provider "aws" { shared\_config\_files = [var.tfc\_aws\_dynamic\_credentials.default.shared\_config\_file] } provider "aws" { alias = "ALIAS1" shared\_config\_files = [var.tfc\_aws\_dynamic\_credentials.aliases["ALIAS1"].shared\_config\_file] } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/aws-configuration.mdx | main | terraform | [
-0.0007910667918622494,
0.059265464544296265,
-0.0163221824914217,
-0.021185750141739845,
-0.09817098826169968,
0.056694746017456055,
0.031944390386343,
0.03868484124541283,
-0.023511474952101707,
0.016610583290457726,
-0.030933726578950882,
-0.13117513060569763,
0.10346376150846481,
0.012... | -0.087926 |
# Use dynamic credentials with the Azure provider You can use HCP Terraform’s native OpenID Connect integration with Azure to get [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for the AzureRM or Microsoft Entra ID providers in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Azure](#configure-azure):\*\* Set up a trust configuration between Azure and HCP Terraform. Then, you must create Azure roles and policies for your HCP Terraform workspaces. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete the setup, HCP Terraform automatically authenticates to Azure during each run. The Azure provider authentication is valid for the length of the plan or apply. ## Requirements - AzureRM provider 3.25.0 or later - Microsoft Entra ID provider (previously Azure Active Directory) 2.29.0 or later - If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), your agents must be [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or later. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). Custom and self-signed certificates are not supported due to restrictions in Azure. ## Configure Azure You must enable and configure an application and service principal with accompanying federated credentials and permissions on Azure. These instructions use the Azure portal, but you can also use Terraform to configure Azure. Refer to the [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/azure). ### Create an Application and Service Principal Complete the instructions in the AzureRM provider documentation on [creating the application and service principal](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service\_principal\_oidc#creating-the-application-and-service-principal). Note the `client\_id` for the application. You will use the ID for authentication. Skip the "Configure Microsoft Entra ID Application to Trust a GitHub Repository" section of the provider documentation. ### Grant the Application Access to Manage Resources in Your Azure Subscription Provide the applicaiton permission you created so that you can modify resources within your subscription. Complete the instructions in the AzureRM provider documentation on [granting the application access to manage resources in your Azure subscription](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service\_principal\_oidc#granting-the-application-access-to-manage-resources-in-your-azure-subscription). ### Configure Microsoft Entra ID Application to Trust a Generic Issuer Finally, you must create federated identity credentials that validate the contents of the token sent to Azure from HCP Terraform. Complete the instructions in the AzureRM provider documntation on creating federated identity credentials. Refer to [Configure Azure Microsoft Entra ID Application to Trust a Generic Issuer](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service\_principal\_oidc#configure-azure-active-directory-application-to-trust-a-generic-issuer). Specify the following information: \* \*\*Federated credential scenario\*\*: Must be set to `Other issuer`. \* \*\*Issuer\*\*: The address of HCP Terraform (e.g., https://app.terraform.io). \* \*\*Important\*\*: make sure this value starts with \*\*https://\*\* and does \_not\_ have a trailing slash. \* \*\*Subject identifier\*\*: The subject identifier from HCP Terraform that this credential will match. This will be in the form `organization:my-org-name:project:my-project-name:workspace:my-workspace-name:run\_phase:plan` where the `run\_phase` can be one of `plan` or `apply`. \* \*\*Name\*\*: A name for the federated credential, such as `tfc-plan-credential`. Note that this cannot be changed later. The following is optional, but may be desired: \* \*\*Audience\*\*: Enter the audience value that will be set when requesting the identity token. This will be `api://AzureADTokenExchange` by default. This should be set to the value of `TFC\_AZURE\_WORKLOAD\_IDENTITY\_AUDIENCE` if this has been configured. -> \*\*Note:\*\* because the `Subject identifier` for federated credentials is a direct string match, two federated identity credentials need to be created for each workspace using dynamic credentials: one that matches `run\_phase:plan` and one that matches `run\_phase:apply`. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You’ll need | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/azure-configuration.mdx | main | terraform | [
-0.02148880995810032,
0.011179711669683456,
-0.009831665083765984,
-0.00178519228938967,
-0.08434005081653595,
0.0636492520570755,
0.016245270147919655,
-0.02639000117778778,
0.002775004366412759,
0.04739051312208176,
-0.0631384402513504,
-0.10630788654088974,
0.1133195161819458,
0.0253241... | -0.02493 |
be created for each workspace using dynamic credentials: one that matches `run\_phase:plan` and one that matches `run\_phase:apply`. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You’ll need to set some environment variables in your HCP Terraform workspace in order to configure HCP Terraform to authenticate with Azure using dynamic credentials. You can set these as workspace variables. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_AZURE\_PROVIDER\_AUTH` `TFC\_AZURE\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate to Azure. | | `TFC\_AZURE\_RUN\_CLIENT\_ID` `TFC\_AZURE\_RUN\_CLIENT\_ID[\_TAG]` `TFC\_DEFAULT\_AZURE\_RUN\_CLIENT\_ID` | The client ID for the Service Principal / Application used when authenticating to Azure. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Optional if `TFC\_AZURE\_PLAN\_CLIENT\_ID` and `TFC\_AZURE\_APPLY\_CLIENT\_ID` are both provided. These variables are described [below](/terraform/cloud-docs/dynamic-provider-credentials/azure-configuration#optional-environment-variables) | ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | `TFC\_AZURE\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_AZURE\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_AZURE\_WORKLOAD\_IDENTITY\_AUDIENCE` | Will be used as the `aud` claim for the identity token. Defaults to `api://AzureADTokenExchange`. | Requires \*\*v1.7.0\*\* or later if self-managing agents. | | `TFC\_AZURE\_PLAN\_CLIENT\_ID` `TFC\_AZURE\_PLAN\_CLIENT\_ID[\_TAG]` `TFC\_DEFAULT\_AZURE\_PLAN\_CLIENT\_ID` | The client ID for the Service Principal / Application to use for the plan phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_AZURE\_RUN\_CLIENT\_ID` if not provided. | | `TFC\_AZURE\_APPLY\_CLIENT\_ID` `TFC\_AZURE\_APPLY\_CLIENT\_ID[\_TAG]` `TFC\_DEFAULT\_AZURE\_APPLY\_CLIENT\_ID` | The client ID for the Service Principal / Application to use for the apply phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_AZURE\_RUN\_CLIENT\_ID` if not provided. | ## Configure the AzureRM or Microsoft Entra ID Provider Make sure that you’re passing values for the `subscription\_id` and `tenant\_id` arguments into the provider configuration block or setting the `ARM\_SUBSCRIPTION\_ID` and `ARM\_TENANT\_ID` variables in your workspace. Make sure that you’re \_not\_ setting values for `client\_id`, `use\_oidc`, or `oidc\_token` in the provider or setting any of `ARM\_CLIENT\_ID`, `ARM\_USE\_OIDC`, `ARM\_OIDC\_TOKEN`. ### Specifying Multiple Configurations ~> \*\*Important:\*\* Ensure you are using version \*\*3.60.0\*\* or later of the \*\*AzureRM provider\*\* and version \*\*2.43.0\*\* or later of the \*\*Microsoft Entra ID provider\*\* as required functionality was introduced in these provider versions. ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct Azure setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_azure\_dynamic\_credentials" { description = "Object containing Azure dynamic credentials configuration" type = object({ default = object({ client\_id\_file\_path = string oidc\_token\_file\_path = string }) aliases = map(object({ client\_id\_file\_path = string oidc\_token\_file\_path = string })) }) } ``` #### Example Usage ##### AzureRM Provider | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/azure-configuration.mdx | main | terraform | [
-0.039049357175827026,
-0.016385884955525398,
0.01691761240363121,
0.0012699250364676118,
-0.1041463166475296,
0.03707553446292877,
0.02742038480937481,
-0.026479361578822136,
0.013350892812013626,
0.052717044949531555,
-0.056920718401670456,
-0.12100475281476974,
0.09328806400299072,
0.01... | -0.050541 |
details to the correct provider blocks. ```hcl variable "tfc\_azure\_dynamic\_credentials" { description = "Object containing Azure dynamic credentials configuration" type = object({ default = object({ client\_id\_file\_path = string oidc\_token\_file\_path = string }) aliases = map(object({ client\_id\_file\_path = string oidc\_token\_file\_path = string })) }) } ``` #### Example Usage ##### AzureRM Provider ```hcl provider "azurerm" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false // use\_oidc must be explicitly set to true when using multiple configurations. use\_oidc = true client\_id\_file\_path = var.tfc\_azure\_dynamic\_credentials.default.client\_id\_file\_path oidc\_token\_file\_path = var.tfc\_azure\_dynamic\_credentials.default.oidc\_token\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "10000000-0000-0000-0000-000000000000" } provider "azurerm" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false // use\_oidc must be explicitly set to true when using multiple configurations. use\_oidc = true alias = "ALIAS1" client\_id\_file\_path = var.tfc\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_id\_file\_path oidc\_token\_file\_path = var.tfc\_azure\_dynamic\_credentials.aliases["ALIAS1"].oidc\_token\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "20000000-0000-0000-0000-000000000000" } ``` ##### Microsoft Entra ID Provider (formerly Azure AD) ```hcl provider "azuread" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false // use\_oidc must be explicitly set to true when using multiple configurations. use\_oidc = true client\_id\_file\_path = var.tfc\_azure\_dynamic\_credentials.default.client\_id\_file\_path oidc\_token\_file\_path = var.tfc\_azure\_dynamic\_credentials.default.oidc\_token\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "10000000-0000-0000-0000-000000000000" } provider "azuread" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false // use\_oidc must be explicitly set to true when using multiple configurations. use\_oidc = true alias = "ALIAS1" client\_id\_file\_path = var.tfc\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_id\_file\_path oidc\_token\_file\_path = var.tfc\_azure\_dynamic\_credentials.aliases["ALIAS1"].oidc\_token\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "20000000-0000-0000-0000-000000000000" } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/azure-configuration.mdx | main | terraform | [
-0.02232283726334572,
0.053835395723581314,
-0.002721520373597741,
0.005810159724205732,
-0.08022374659776688,
0.06743766367435455,
0.0863378569483757,
0.05803107097744942,
0.003985730465501547,
0.03918557986617088,
-0.011492731049656868,
-0.12232058495283127,
0.1270386129617691,
0.0689660... | -0.087947 |
# Use dynamic credentials with the GCP provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.7.0](/terraform/cloud-docs/agents/changelog#1-7-0-03-02-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with GCP to get [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for the GCP provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure GCP](#configure-gcp):\*\* Set up a trust configuration between GCP and HCP Terraform. Then, you must create GCP roles and policies for your HCP Terraform workspaces. 2. \*\*[Configure HCP Terraform](#configure-hcp-terraform):\*\* Add environment variables to the HCP Terraform workspaces where you want to use Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete the setup, HCP Terraform automatically authenticates to GCP during each run. The GCP provider authentication is valid for the length of the plan or apply. !> \*\*Warning:\*\* Dynamic credentials with the GCP provider do not work if your Terraform Enterprise instance uses a custom or self-signed certificate. This limitation is due to restrictions in GCP. ## Configure GCP You must enable and configure a workload identity pool and provider on GCP. These instructions use the GCP console, but you can also use Terraform to configure GCP. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/gcp). ### Add a Workload Identity Pool and Provider Google documentation for setting this up can be found here: [Configuring workload identity federation with other identity providers](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers). Before starting to create the resources, you must enable the APIs mentioned at the start of the [Configure workload Identity federation](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers#configure). #### Add a Workload Identity Pool The following information should be specified: \* \*\*Name\*\*: Name for the pool, such as `my-tfc-pool`. The name is also used as the pool ID. You can't change the pool ID later. The following is optional, but may be desired: \* \*\*Pool ID\*\*: The ID for the pool. This defaults to the name as mentioned above, but can be set to another value. \* \*\*Description\*\*: Text that describes the purpose of the pool. You will also want to ensure that the `Enabled Pool` option is set to be enabled before clicking next. #### Add a Workload Identity Provider You must add a workload identity provider to the pool. The following information should be specified: \* \*\*Provider type\*\*: Must be `OpenID Connect (OIDC)`. \* \*\*Provider name\*\*: Name for the identity provider, such as `my-tfc-provider`. The name is also used as the provider ID. You can’t change the provider ID later. \* \*\*Issuer (URL)\*\*: The address of the TFC/E instance, such as https://app.terraform.io \* \*\*Important\*\*: make sure this value starts with \*\*https://\*\* and does \_not\_ have a trailing slash. \* \*\*Audiences\*\*: This can be left as `Default audience` if you are planning on using the default audience HCP Terraform provides. \* \*\*Important\*\*: you must select the `Allowed audiences` toggle and set this to the value of `TFC\_GCP\_WORKLOAD\_IDENTITY\_AUDIENCE`, if configured. \* \*\*Provider attributes mapping\*\*: At the minimum this must include `assertion.sub` for the `google.subject` entry. Other mappings can be added for other claims in the identity token to attributes by adding `attribute.[claim name]` on the Google side and `assertion.[claim name]` on the OIDC side of a new mapping. \* \*\*Attribute Conditions\*\*: Conditions to restrict which identity tokens can authenticate using the workload identity pool, such as `assertion.sub.startsWith("organization:my-org:project:my-project:workspace:my-workspace")` to restrict access to identity tokens from a specific workspace. See this page in Google documentation for more information on the expression language: [Attribute conditions](https://cloud.google.com/iam/docs/workload-identity-federation#conditions). !> \*\*Warning\*\*: you should always check, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/gcp-configuration.mdx | main | terraform | [
-0.030029457062482834,
-0.009990915656089783,
0.036773573607206345,
-0.02500307559967041,
-0.07973367720842361,
0.0373447947204113,
-0.015966009348630905,
-0.010303276591002941,
0.009367291815578938,
0.04760093241930008,
-0.05075870454311371,
-0.08062147349119186,
0.07805559784173965,
-0.0... | -0.010593 |
\* \*\*Attribute Conditions\*\*: Conditions to restrict which identity tokens can authenticate using the workload identity pool, such as `assertion.sub.startsWith("organization:my-org:project:my-project:workspace:my-workspace")` to restrict access to identity tokens from a specific workspace. See this page in Google documentation for more information on the expression language: [Attribute conditions](https://cloud.google.com/iam/docs/workload-identity-federation#conditions). !> \*\*Warning\*\*: you should always check, at minimum, the audience and the name of the organization in order to prevent unauthorized access from other HCP Terraform organizations! The following is optional, but may be desired: \* \*\*Provider ID\*\*: The ID for the provider. This defaults to the name as mentioned above, but can be set to another value. ### Add a Service Account and Permissions You must next add a service account and properly configure the permissions. #### Create a Service Account Google documentation for setting this up can be found here: [Creating a service account for the external workload](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers#create\_a\_service\_account\_for\_the\_external\_workload). The following information should be specified: \* \*\*Service account name\*\*: Name for the service account, such as `tfc-service-account`. The name is also used as the pool ID. You can't change the pool ID later. The following is optional, but may be desired: \* \*\*Service account ID\*\*: The ID for the service account. This defaults to the name as mentioned above, but can be set to another value. \* \*\*Description\*\*: Text that describes the purpose of the service account. #### Grant IAM Permissions The next step in the setup wizard will allow for granting IAM permissions for the service account. The role that is given to the service account will vary depending on your specific needs and project setup. This should in general be the most minimal set of permissions needed for the service account to properly function. #### Grant External Permissions Once the service account has been created and granted IAM permissions, you will need to grant access to the service account for the identity pool created above. Google documentation for setting this up can be found here: [Allow the external workload to impersonate the service account](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers#allow\_the\_external\_workload\_to\_impersonate\_the\_service\_account). ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. You’ll need to set some environment variables in your HCP Terraform workspace in order to configure HCP Terraform to authenticate with GCP using dynamic credentials. You can set these as workspace variables, or if you’d like to share one GCP service account across multiple workspaces, you can use a variable set. When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_GCP\_PROVIDER\_AUTH` `TFC\_GCP\_PROVIDER\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.7.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to use dynamic credentials to authenticate to GCP. | | `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL[\_TAG]` `TFC\_DEFAULT\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` | The service account email HCP Terraform will use when authenticating to GCP. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Optional if `TFC\_GCP\_PLAN\_SERVICE\_ACCOUNT\_EMAIL` and `TFC\_GCP\_APPLY\_SERVICE\_ACCOUNT\_EMAIL` are both provided. These variables are described [below](/terraform/cloud-docs/dynamic-provider-credentials/gcp-configuration#optional-environment-variables) | You must also include information about the GCP Workload Identity Provider that HCP Terraform will use when authenticating to GCP. You can supply this information in two different ways: 1. By providing one unified variable containing the canonical name of the workload identity provider. 2. By providing the project number, pool ID, and provider ID as separate variables. You should | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/gcp-configuration.mdx | main | terraform | [
-0.08576991409063339,
0.06841079145669937,
0.04861894249916077,
-0.007218607235699892,
0.013842644169926643,
-0.010872653685510159,
0.12632159888744354,
-0.10796792805194855,
-0.0028013105038553476,
0.03270182013511658,
-0.025399338454008102,
-0.13780027627944946,
0.12872089445590973,
0.04... | 0.072267 |
Provider that HCP Terraform will use when authenticating to GCP. You can supply this information in two different ways: 1. By providing one unified variable containing the canonical name of the workload identity provider. 2. By providing the project number, pool ID, and provider ID as separate variables. You should avoid setting both types of variables, but if you do, the unified version will take precedence. #### Unified Variable | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_GCP\_WORKLOAD\_PROVIDER\_NAME` `TFC\_GCP\_WORKLOAD\_PROVIDER\_NAME[\_TAG]` `TFC\_DEFAULT\_GCP\_WORKLOAD\_PROVIDER\_NAME` | The canonical name of the workload identity provider. This must be in the form mentioned for the `name` attribute [here](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/iam\_workload\_identity\_pool\_provider#attributes-reference) | Requires \*\*v1.7.0\*\* or later if self-managing agents. This will take precedence over `TFC\_GCP\_PROJECT\_NUMBER`, `TFC\_GCP\_WORKLOAD\_POOL\_ID`, and `TFC\_GCP\_WORKLOAD\_PROVIDER\_ID` if set. | #### Separate Variables | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------| | `TFC\_GCP\_PROJECT\_NUMBER` `TFC\_GCP\_PROJECT\_NUMBER[\_TAG]` `TFC\_DEFAULT\_GCP\_PROJECT\_NUMBER` | The project number where the pool and other resources live. | Requires \*\*v1.7.0\*\* or later if self-managing agents. This is \_not\_ the project ID and is a separate number. | | `TFC\_GCP\_WORKLOAD\_POOL\_ID` `TFC\_GCP\_WORKLOAD\_POOL\_ID[\_TAG]` `TFC\_DEFAULT\_GCP\_WORKLOAD\_POOL\_ID` | The workload pool ID. | Requires \*\*v1.7.0\*\* or later if self-managing agents. | | `TFC\_GCP\_WORKLOAD\_PROVIDER\_ID` `TFC\_GCP\_WORKLOAD\_PROVIDER\_ID[\_TAG]` `TFC\_DEFAULT\_GCP\_WORKLOAD\_PROVIDER\_ID` | The workload identity provider ID. | Requires \*\*v1.7.0\*\* or later if self-managing agents. | ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_GCP\_WORKLOAD\_IDENTITY\_AUDIENCE` `TFC\_GCP\_WORKLOAD\_IDENTITY\_AUDIENCE[\_TAG]` `TFC\_DEFAULT\_GCP\_WORKLOAD\_IDENTITY\_AUDIENCE` | Will be used as the `aud` claim for the identity token. Defaults to a string of the form mentioned [here](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers#oidc\_1) in the GCP docs with the leading \*\*https:\*\* stripped. | Requires \*\*v1.7.0\*\* or later if self-managing agents. This is one of the default `aud` formats that GCP accepts. | | `TFC\_GCP\_PLAN\_SERVICE\_ACCOUNT\_EMAIL` `TFC\_GCP\_PLAN\_SERVICE\_ACCOUNT\_EMAIL[\_TAG]` `TFC\_DEFAULT\_GCP\_PLAN\_SERVICE\_ACCOUNT\_EMAIL` | The service account email to use for the plan phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` if not provided. | | `TFC\_GCP\_APPLY\_SERVICE\_ACCOUNT\_EMAIL` `TFC\_GCP\_APPLY\_SERVICE\_ACCOUNT\_EMAIL[\_TAG]` `TFC\_DEFAULT\_GCP\_APPLY\_SERVICE\_ACCOUNT\_EMAIL` | The service account email to use for the apply phase of a run. | Requires \*\*v1.7.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_GCP\_RUN\_SERVICE\_ACCOUNT\_EMAIL` if not provided. | ## Configure the GCP Provider Make sure that you’re passing values for the `project` and `region` arguments into the provider configuration block. Make sure that you’re not setting values for the `GOOGLE\_CREDENTIALS` or `GOOGLE\_APPLICATION\_CREDENTIALS` environment variables as these will conflict with the dynamic credentials authentication process. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct GCP setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_gcp\_dynamic\_credentials" { description = "Object containing GCP dynamic credentials configuration" type = object({ default = object({ credentials = string }) aliases = map(object({ credentials = string })) }) } ``` #### Example Usage ```hcl provider "google" { credentials = var.tfc\_gcp\_dynamic\_credentials.default.credentials } provider "google" { alias = "ALIAS1" credentials = var.tfc\_gcp\_dynamic\_credentials.aliases["ALIAS1"].credentials } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/gcp-configuration.mdx | main | terraform | [
-0.03741953521966934,
0.044890664517879486,
0.029539745301008224,
-0.02561357244849205,
-0.058122362941503525,
0.06593777239322662,
0.08954271674156189,
-0.0185776986181736,
0.0016544746467843652,
-0.010990954004228115,
-0.0306912362575531,
-0.13697278499603271,
0.08476616442203522,
-0.006... | -0.043238 |
map(object({ credentials = string })) }) } ``` #### Example Usage ```hcl provider "google" { credentials = var.tfc\_gcp\_dynamic\_credentials.default.credentials } provider "google" { alias = "ALIAS1" credentials = var.tfc\_gcp\_dynamic\_credentials.aliases["ALIAS1"].credentials } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/gcp-configuration.mdx | main | terraform | [
0.021456856280565262,
0.026536820456385612,
0.017562171444296837,
-0.00862535834312439,
-0.13380460441112518,
0.02849709801375866,
0.0886937752366066,
0.11322492361068726,
-0.046806950122117996,
-0.03737100213766098,
-0.008566790260374546,
-0.08611566573381424,
0.019278379157185555,
0.0225... | -0.050663 |
# HCP Vault Secrets-Backed Dynamic Credentials @include 'deprecation/hcp-vault-secrets.mdx' This topic provides an overview of how to use HCP Vault Secrets to generate temporary credentials for providers so that you can securely use them in HCP Terraform runs. ## Introduction Configuring [dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials) with different cloud providers is suitable for most use cases, but you can use HCP Vault Secrets-backed dynamic credentials to centralize and consolidate cloud credential management. HCP Vault Secrets-backed dynamic credentials leverage HCP Vault Secrets' [dynamic secrets capability](/hcp/docs/vault-secrets/dynamic-secrets), which allows you to generate short-lived credentials for various providers. This means you can authenticate a HCP instance using workload identity tokens and use dynamic secret capabilities on that instance to generate dynamic credentials for the various providers. Refer to the [HCP Vault Secrets announcement](https://www.hashicorp.com/blog/hcp-vault-secrets-is-now-generally-available) to learn about the benefits of using HCP Vault Secrets to manage provider credentials. ## Workflow Using HCP Vault Secrets-backed dynamic credentials in a workspace requires the following steps for each cloud platform: 1. If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.16.0](/terraform/cloud-docs/agents/changelog#1-16-0-10-02-2024) or newer. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). 1. Set up dynamic provider credentials with the HCP provider: You must first [configure dynamic credentials with the HCP provider](/terraform/cloud-docs/dynamic-provider-credentials/hcp-configuration). 1. Configure the dynamic secrets integration: You must configure the desired Vault secrets integration in your HCP project, such as AWS or GCP. 1. Configure your HCP Terraform workspace: You must add specific environment variables to your workspace to tell HCP Terraform how to authenticate to other cloud providers during runs. Each cloud platform has its own set of environment variables that are necessary to configure dynamic credentials. 1. Complete the instructions for setting up HCP Vault Secrets-backed dynamic for [Amazon Web Services](/terraform/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/aws-configuration) or [Google Cloud Platform](/terraform/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/gcp-configuration). If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. ### Access to metadata endpoints In order to verify signed JWTs, HCP must have network access to the following static OIDC metadata endpoints within HCP Terraform: - `/.well-known/openid-configuration`: Standard OIDC metadata. - `/.well-known/jwks`: HCP Terraform public keys that cloud platforms use to verify the authenticity of tokens that claim to come from HCP Terraform. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/index.mdx | main | terraform | [
-0.05083262175321579,
0.0445917472243309,
-0.00917322002351284,
-0.06710433214902878,
-0.04923708736896515,
0.055514752864837646,
0.002908213995397091,
-0.014394912868738174,
0.006950192619115114,
-0.01344196405261755,
-0.06430791318416595,
-0.055413130670785904,
0.12954546511173248,
-0.03... | -0.022285 |
# HCP Vault Secrets-Backed Dynamic Credentials with the AWS Provider @include 'deprecation/hcp-vault-secrets.mdx' ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.16.0](/terraform/cloud-docs/agents/changelog#1-16-0-10-02-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with HCP to use [HCP Vault Secrets-backed dynamic credentials](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/hcp-vault-secrets-backed) with the AWS provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure HCP Provider Credentials](#configure-hcp-provider-credentials)\*\*: Set up a trust configuration between HCP Vault Secrets and HCP Terraform, create HCP roles and policies for your HCP Terraform workspaces, and add environment variables to those workspaces. 2. \*\*[Configure HCP Vault Secrets](#configure-hcp-vault-secrets-aws-secrets-engine)\*\*: Set up your HCP project's AWS integration and dynamic secret. 3. \*\*[Configure HCP Terraform](#configure-hcp-terraform)\*\*: Add additional environment variables to the HCP Terraform workspaces where you want to use HCP Vault Secrets-backed dynamic credentials. 4. \*\*[Configure Terraform Providers](#configure-terraform-providers)\*\*: Configure your Terraform providers to work with HCP Vault Secrets-backed dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete this setup, HCP Terraform automatically authenticates with AWS via HCP Vault Secrets-generated credentials during the plan and apply phase of each run. The AWS provider's authentication is only valid for the length of the plan or apply phase. ## Configure HCP Provider Credentials You must first set up HCP dynamic provider credentials before you can use HCP Vault Secrets-backed dynamic credentials. This includes creating a service principal, configuring trust between HCP and HCP Terraform, and populating the required environment variables in your HCP Terraform workspace. [See the setup instructions for HCP dynamic provider credentials](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/hcp-configuration). ## Configure HCP Vault Secrets AWS Secrets Engine Follow the instructions in the HCP Vault Secrets documentation for [setting up the AWS integration in your HCP project](/hcp/docs/vault-secrets/dynamic-secrets/aws). ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set certain environment variables in your HCP Terraform workspace to authenticate HCP Terraform with AWS using HCP Vault Secrets-backed dynamic credentials. These variables are in addition to those you previously set while configuring [HCP provider credentials](#configure-hcp-provider-credentials). You can add these as workspace variables or as a [variable set](/terraform/cloud-docs/variables/managing-variables#variable-sets). ### Required Environment Variables | Variable | Value | Notes | |---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HVS\_BACKED\_AWS\_AUTH` `TFC\_HVS\_BACKED\_AWS\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate with AWS. | | `TFC\_HVS\_BACKED\_AWS\_RUN\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HVS\_BACKED\_AWS\_HCP\_CONFIG` `TFC\_HVS\_BACKED\_AWS\_HCP\_CONFIG[\_TAG]` `TFC\_DEFAULT\_HVS\_BACKED\_AWS\_HCP\_CONFIG` | The name of the non-default HCP configuration for workspaces using [multiple HCP configurations](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/specifying-multiple-configurations). | Requires \*\*v1.16.0\*\* or later if self-managing agents. Will fall back to using the default HCP Vault Secrets configuration if not provided.| | `TFC\_HVS\_BACKED\_AWS\_PLAN\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the plan phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | | `TFC\_HVS\_BACKED\_AWS\_APPLY\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the apply phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | ## Configure Terraform Providers The | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/aws-configuration.mdx | main | terraform | [
-0.0288738664239645,
0.04696391895413399,
-0.003565387800335884,
-0.03956043720245361,
-0.06298679858446121,
0.04740999639034271,
-0.044201020151376724,
-0.00804117415100336,
0.038534194231033325,
0.025816431269049644,
-0.04904527589678764,
-0.05410996079444885,
0.11432220041751862,
-0.023... | -0.05021 |
plan phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | | `TFC\_HVS\_BACKED\_AWS\_APPLY\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the apply phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | ## Configure Terraform Providers The final step is to directly configure your AWS and HCP Vault Secrets providers. ### Configure the AWS Provider Ensure you pass a value for the `region` argument in your AWS provider configuration block or set the `AWS\_REGION` variable in your workspace. Ensure you are not using any of the arguments or methods mentioned in the [authentication and configuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration) section of the provider documentation. Otherwise, these settings may interfere with dynamic provider credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.16.0](/terraform/cloud-docs/agents/changelog#1-16-0-10-02-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct HCP Vault Secrets-backed AWS setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/workspaces/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_hvs\_backed\_aws\_dynamic\_credentials" { description = "Object containing HCP Vault Secrets-backed AWS dynamic credentials configuration" type = object({ default = object({ shared\_credentials\_file = string }) aliases = map(object({ shared\_credentials\_file = string })) }) } ``` #### Example Usage ```hcl provider "aws" { shared\_credentials\_files = [var.tfc\_hvs\_backed\_aws\_dynamic\_credentials.default.shared\_credentials\_file] } provider "aws" { alias = "ALIAS1" shared\_credentials\_files = [var.tfc\_hvs\_backed\_aws\_dynamic\_credentials.aliases["ALIAS1"].shared\_credentials\_file] } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/aws-configuration.mdx | main | terraform | [
0.013078704476356506,
0.08588040620088577,
-0.010454792529344559,
-0.04334360361099243,
-0.030304206535220146,
0.006335501093417406,
-0.032753992825746536,
-0.04066665843129158,
0.0009559807367622852,
0.03360694646835327,
0.004900726955384016,
-0.08521384000778198,
0.056537188589572906,
-0... | -0.045133 |
# HCP Vault Secrets-Backed Dynamic Credentials with the GCP Provider @include 'deprecation/hcp-vault-secrets.mdx' ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.16.0](/terraform/cloud-docs/agents/changelog#1-16-0-10-02-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with HCP to use [HCP Vault Secrets-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed) with the GCP provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure HCP Provider Credentials](#configure-hcp-provider-credentials)\*\*: Set up a trust configuration between HCP Vault Secrets and HCP Terraform, create HCP Vault Secrets roles and policies for your HCP Terraform workspaces, and add environment variables to those workspaces. 2. \*\*[Configure HCP Vault Secrets](#configure-hcp-vault-secrets-gcp-secrets-engine)\*\*: Set up your HCP project's GCP integration and dynamic secret. 3. \*\*[Configure HCP Terraform](#configure-hcp-terraform)\*\*: Add additional environment variables to the HCP Terraform workspaces where you want to use HCP Vault Secrets-backed dynamic credentials. 4. \*\*[Configure Terraform Providers](#configure-terraform-providers)\*\*: Configure your Terraform providers to work with HCP Vault Secrets-backed dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete this setup, HCP Terraform automatically authenticates with GCP via HCP Vault Secrets-generated credentials during the plan and apply phase of each run. The GCP provider's authentication is only valid for the length of the plan or apply phase. ## Configure HCP Provider Credentials You must first set up HCP dynamic provider credentials before you can use HCP Vault Secrets-backed dynamic credentials. This includes creating a service principal, configuring trust between HCP and HCP Terraform, and populating the required environment variables in your HCP Terraform workspace. [See the setup instructions for HCP dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials/hcp-configuration). ## Configure HCP Vault Secrets GCP Secrets Engine Follow the instructions in the HCP Vault Secrets documentation for [setting up the GCP integration in your HCP project](/hcp/docs/vault-secrets/dynamic-secrets/gcp). ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set certain environment variables in your HCP Terraform workspace to authenticate HCP Terraform with GCP using HCP Vault Secrets-backed dynamic credentials. These variables are in addition to those you previously set while configuring [HCP provider credentials](#configure-hcp-provider-credentials). You can add these as workspace variables or as a [variable set](/terraform/cloud-docs/variables/managing-variables#variable-sets). ### Required Common Environment Variables | Variable | Value | Notes | |---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HVS\_BACKED\_GCP\_AUTH` `TFC\_HVS\_BACKED\_GCP\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate with GCP. | | `TFC\_HVS\_BACKED\_GCP\_RUN\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | ### Optional Common Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_HVS\_BACKED\_GCP\_HCP\_CONFIG` `TFC\_HVS\_BACKED\_GCP\_HCP\_CONFIG[\_TAG]` `TFC\_DEFAULT\_HVS\_BACKED\_GCP\_HCP\_CONFIG` | The name of the non-default HCP configuration for workspaces using [multiple HCP configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). | Requires \*\*v1.16.0\*\* or later if self-managing agents. Will fall back to using the default HCP Vault Secrets configuration if not provided. | | `TFC\_HVS\_BACKED\_GCP\_PLAN\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the plan phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | | `TFC\_HVS\_BACKED\_GCP\_APPLY\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the apply phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/gcp-configuration.mdx | main | terraform | [
-0.02710607647895813,
0.03759664297103882,
0.01668894663453102,
-0.053017809987068176,
-0.07085590809583664,
0.04294147342443466,
-0.03560168296098709,
-0.010969349183142185,
0.023085245862603188,
0.02381637692451477,
-0.047606054693460464,
-0.048833053559064865,
0.10558411478996277,
-0.01... | -0.056455 |
resource to read for the plan phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | | `TFC\_HVS\_BACKED\_GCP\_APPLY\_SECRET\_RESOURCE\_NAME` | The name of the HCP Vault Secrets dynamic secret resource to read for the apply phase. | Requires \*\*v1.16.0\*\* or later if self-managing agents. Must be present. | ## Configure Terraform Providers The final step is to directly configure your GCP and HCP Vault Secrets providers. ### Configure the GCP Provider Ensure you pass values for the `project` and `region` arguments into the provider configuration block. Ensure you are not setting values or environment variables for `GOOGLE\_CREDENTIALS` or `GOOGLE\_APPLICATION\_CREDENTIALS`. Otherwise, these values may interfere with dynamic provider credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.16.0](/terraform/cloud-docs/agents/changelog#1-16-0-10-02-2024) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct HCP Vault Secrets-backed GCP setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_hvs\_backed\_gcp\_dynamic\_credentials" { description = "Object containing HCP Vault Secrets-backed GCP dynamic credentials configuration" type = object({ default = object({ credentials = string access\_token = string }) aliases = map(object({ credentials = string access\_token = string })) }) } ``` #### Example Usage ##### Access Token ```hcl provider "google" { access\_token = var.tfc\_hvs\_backed\_gcp\_dynamic\_credentials.default.access\_token } provider "google" { alias = "ALIAS1" access\_token = var.tfc\_hvs\_backed\_gcp\_dynamic\_credentials.aliases["ALIAS1"].access\_token } ``` ##### Credentials ```hcl provider "google" { credentials = var.tfc\_hvs\_backed\_gcp\_dynamic\_credentials.default.credentials } provider "google" { alias = "ALIAS1" credentials = var.tfc\_hvs\_backed\_gcp\_dynamic\_credentials.aliases["ALIAS1"].credentials } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/hcp-vault-secrets-backed/gcp-configuration.mdx | main | terraform | [
-0.03876057267189026,
0.040576864033937454,
0.045209161937236786,
-0.04619014263153076,
-0.0593164898455143,
0.018555743619799614,
-0.005869066342711449,
-0.03195975348353386,
-0.0383080430328846,
0.016311075538396835,
-0.004042056854814291,
-0.0901903286576271,
0.05591633543372154,
-0.012... | -0.063269 |
# Use Vault-backed dynamic credentials ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.8.0](/terraform/cloud-docs/agents/changelog#1-8-0-04-18-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). For most use cases, separately configuring [dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials) with different cloud providers works well. However, Vault-backed dynamic credentials are for those looking for a way to: 1. Use Vault's secrets engines as a centralized way to manage and consolidate cloud credentials management. 2. Generate short-lived credentials without exposing their Terraform Enterprise instance's OIDC metadata endpoints to the broader public internet. The "Vault-backed" in "Vault-backed dynamic credentials" refers to Vault's [secrets engines](/vault/docs/secrets), which allow you to generate short-lived [dynamic secrets](https://www.vaultproject.io/use-cases/dynamic-secrets) for the AWS, GCP, or Azure providers. If you are using Terraform Enterprise and your Vault instance is configured within the same secure network, you can generate secrets while keeping your environment air-gapped. Vault-backed dynamic credentials combine the features of dynamic provider credentials and Vault's secrets engines. This means you can authenticate a Vault instance using workload identity tokens and use secrets engines on that instance to generate dynamic credentials for the AWS, GCP, and Azure providers. For a comparison of Vault-backed dynamic credentials and dynamic provider credentials, refer to the article [Why use Vault-backed dynamic credentials to secure HCP Terraform infrastructure?](https://www.hashicorp.com/blog/why-use-vault-backed-dynamic-credentials-to-secure-hcp-terraform-infrastructure) on the HashiCorp blog. ## Configure Vault-Backed Dynamic Credentials Using Vault-backed dynamic credentials in a workspace requires the following steps for each cloud platform: 1. \*\*Set up Dynamic Provider Credentials with the Vault Provider:\*\* You must first [configure dynamic credentials with the Vault provider](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration). 2. \*\*Configure the desired Secrets Engine\*\*: You must configure the desired secrets engine in your Vault instance (i.e., AWS, GCP, or Azure). 3. \*\*Configure HCP Terraform Workspace\*\*: You must add specific environment variables to your workspace to tell HCP Terraform how to authenticate to other cloud providers during runs. Each cloud platform has its own set of environment variables that are necessary to configure dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Setting up Vault-backed dynamic credentials differs slightly for each cloud provider. You can configure Vault-backed dynamic credentials on the following platforms: - [Amazon Web Services](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed/aws-configuration) - [Google Cloud Platform](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed/gcp-configuration) - [Azure](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed/azure-configuration) ## Terraform Enterprise Specific Requirements ### Access to Metadata Endpoints In order to verify signed JWTs, Vault must have network access to the following static OIDC metadata endpoints within TFE: 1. `/.well-known/openid-configuration` - standard OIDC metadata. 2. `/.well-known/jwks` - TFE’s public key(s) that cloud platforms use to verify the authenticity of tokens that claim to come from TFE. These endpoints \*\*do not\*\* need to be publicly exposed as long as your Vault instance can access them. ### External Vault Policy If you are using an external Vault instance, you must ensure that your Vault instance has the correct policies setup as detailed in the [External Vault Requirements for Terraform Enterprise](/terraform/enterprise/requirements/data-storage/vault) documentation. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/index.mdx | main | terraform | [
-0.05439858138561249,
0.004607635084539652,
-0.017573652788996696,
-0.015610306523740292,
-0.07320541143417358,
-0.0022117337211966515,
-0.029127763584256172,
0.016222454607486725,
0.05731111019849777,
0.01621210016310215,
-0.041645150631666183,
-0.034505173563957214,
0.08393602818250656,
... | -0.05161 |
# Use Vault-backed dynamic credentials with the AWS provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.8.0](/terraform/cloud-docs/agents/changelog#1-8-0-04-18-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with Vault to use [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed) with the AWS provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Vault Dynamic Provider Credentials](#configure-vault-dynamic-provider-credentials)\*\*: Set up a trust configuration between Vault and HCP Terraform, create Vault roles and policies for your HCP Terraform workspaces, and add environment variables to those workspaces. 2. \*\*[Configure the Vault AWS Secrets Engine](#configure-vault-aws-secrets-engine)\*\*: Set up the AWS secrets engine in your Vault instance. 3. \*\*[Configure HCP Terraform](#configure-hcp-terraform)\*\*: Add additional environment variables to the HCP Terraform workspaces where you want to use Vault-Backed Dynamic Credentials. 4. \*\*[Configure Terraform Providers](#configure-terraform-providers)\*\*: Configure your Terraform providers to work with Vault-backed dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete this setup, HCP Terraform automatically authenticates with AWS via Vault-generated credentials during the plan and apply phase of each run. The AWS provider's authentication is only valid for the length of the plan or apply phase. ## Configure Vault Dynamic Provider Credentials You must first set up Vault dynamic provider credentials before you can use Vault-backed dynamic credentials. This includes setting up the JWT auth backend in Vault, configuring trust between HCP Terraform and Vault, and populating the required environment variables in your HCP Terraform workspace. [See the setup instructions for Vault dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration). # Configure Vault AWS Secrets Engine Follow the instructions in the Vault documentation for [setting up the AWS secrets engine in your Vault instance](/vault/docs/secrets/aws). You can also do this configuration through Terraform. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/vault-backed/aws). ~> \*\*Important\*\*: carefully consider the limitations and differences between each supported credential type in the AWS secrets engine. These limitations carry over to HCP Terraform’s usage of these credentials for authenticating the AWS provider. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set certain environment variables in your HCP Terraform workspace to authenticate HCP Terraform with AWS using Vault-backed dynamic credentials. These variables are in addition to those you previously set while configuring [Vault dynamic provider credentials](#configure-vault-dynamic-provider-credentials). You can add these as workspace variables or as a [variable set](/terraform/cloud-docs/variables/managing-variables#variable-sets). When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Common Environment Variables The below variables apply to all AWS auth types. #### Required Common Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AWS\_AUTH` `TFC\_VAULT\_BACKED\_AWS\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.8.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate with AWS. | | `TFC\_VAULT\_BACKED\_AWS\_AUTH\_TYPE` `TFC\_VAULT\_BACKED\_AWS\_AUTH\_TYPE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_AUTH\_TYPE` | Specifies the type of authentication to perform with AWS. Must be one of the following: `iam\_user`, `assumed\_role`, or `federation\_token`. | Requires \*\*v1.8.0\*\* or later if self-managing agents. | | `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` | The role to use in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_AWS\_PLAN\_VAULT\_ROLE` and `TFC\_VAULT\_BACKED\_AWS\_APPLY\_VAULT\_ROLE` are both provided. These variables are described [below](#optional-common-environment-variables). | #### Optional Common Environment | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/aws-configuration.mdx | main | terraform | [
-0.013356237672269344,
0.025874756276607513,
-0.023201968520879745,
-0.018944326788187027,
-0.06187427043914795,
0.043659549206495285,
-0.044744186103343964,
0.008301055990159512,
0.04408981651067734,
0.019923273473978043,
-0.048939451575279236,
-0.055438511073589325,
0.11119119822978973,
... | -0.035902 |
`iam\_user`, `assumed\_role`, or `federation\_token`. | Requires \*\*v1.8.0\*\* or later if self-managing agents. | | `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` | The role to use in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_AWS\_PLAN\_VAULT\_ROLE` and `TFC\_VAULT\_BACKED\_AWS\_APPLY\_VAULT\_ROLE` are both provided. These variables are described [below](#optional-common-environment-variables). | #### Optional Common Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AWS\_MOUNT\_PATH` `TFC\_VAULT\_BACKED\_AWS\_MOUNT\_PATH[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_MOUNT\_PATH` | The mount path of the AWS secrets engine in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Defaults to `aws`. | | `TFC\_VAULT\_BACKED\_AWS\_PLAN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AWS\_PLAN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_PLAN\_VAULT\_ROLE` | The Vault role to use the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` if not provided. | | `TFC\_VAULT\_BACKED\_AWS\_APPLY\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AWS\_APPLY\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_APPLY\_VAULT\_ROLE` | The Vault role to use for the apply phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AWS\_RUN\_VAULT\_ROLE` if not provided. | | `TFC\_VAULT\_BACKED\_AWS\_SLEEP\_SECONDS` `TFC\_VAULT\_BACKED\_AWS\_SLEEP\_SECONDS[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_SLEEP\_SECONDS` | The amount of time to wait, in seconds, after obtaining temporary credentials from Vault. e.g., `30` for 30 seconds. Must be 1500 seconds (25 minutes) or less. | Requires \*\*v1.12.0\*\* or later if self-managing agents. Can be used to mitigate eventual consistency issues in AWS when using the `iam\_user` auth type. | | `TFC\_VAULT\_BACKED\_AWS\_VAULT\_CONFIG` `TFC\_VAULT\_BACKED\_AWS\_VAULT\_CONFIG[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_VAULT\_CONFIG` | The name of the non-default Vault configuration for workspaces using [multiple Vault configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). | Requires \*\*v1.12.0\*\* or later if self-managing agents. Will fall back to using the default Vault configuration if not provided. | ### Assumed Role Specific Environment Variables These environment variables are only valid if the `TFC\_VAULT\_BACKED\_AWS\_AUTH\_TYPE` is `assumed\_role`. #### Required Assumed Role Specific Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AWS\_RUN\_ROLE\_ARN` `TFC\_VAULT\_BACKED\_AWS\_RUN\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_RUN\_ROLE\_ARN` | The ARN of the role to assume in AWS. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_AWS\_PLAN\_ROLE\_ARN` and `TFC\_VAULT\_BACKED\_AWS\_APPLY\_ROLE\_ARN` are both provided. These variables are described [below](#optional-assume-role-specific-environment-variables). | #### Optional Assumed Role Specific Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AWS\_PLAN\_ROLE\_ARN` `TFC\_VAULT\_BACKED\_AWS\_PLAN\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_PLAN\_ROLE\_ARN` | The ARN of the role to use for the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AWS\_RUN\_ROLE\_ARN` if not provided. | | `TFC\_VAULT\_BACKED\_AWS\_APPLY\_ROLE\_ARN` `TFC\_VAULT\_BACKED\_AWS\_APPLY\_ROLE\_ARN[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AWS\_APPLY\_ROLE\_ARN` | The ARN of the role to use for the apply phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AWS\_RUN\_ROLE\_ARN` if not provided. | ## Configure Terraform Providers The final step is to directly configure your AWS and Vault providers. ### Configure the AWS Provider Ensure you pass a value for the `region` argument in your AWS provider configuration block or set the `AWS\_REGION` variable in your workspace. Ensure you are not using any of the arguments or methods mentioned in the [authentication and configuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration) section of the provider documentation. Otherwise, these settings may interfere with dynamic provider credentials. ### Configure the Vault Provider If you were previously using the Vault provider to authenticate the AWS provider, remove any existing usage of the AWS secrets engine from your Terraform Code. This includes the [`vault\_aws\_access\_credentials`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/aws\_access\_credentials) data source and any instances of [`vault\_generic\_secret`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/generic\_secret) you previously used to generate AWS credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/aws-configuration.mdx | main | terraform | [
0.08090969175100327,
0.023749426007270813,
-0.07219269871711731,
-0.03416319936513901,
0.036496054381132126,
-0.002198026515543461,
0.027679869905114174,
0.024408139288425446,
0.008095254190266132,
-0.012653740122914314,
0.05212885141372681,
-0.1137455403804779,
0.07475939393043518,
0.0386... | -0.010164 |
data source and any instances of [`vault\_generic\_secret`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/generic\_secret) you previously used to generate AWS credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct Vault-backed AWS setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_vault\_backed\_aws\_dynamic\_credentials" { description = "Object containing Vault-backed AWS dynamic credentials configuration" type = object({ default = object({ shared\_credentials\_file = string }) aliases = map(object({ shared\_credentials\_file = string })) }) } ``` #### Example Usage ```hcl provider "aws" { shared\_credentials\_files = [var.tfc\_vault\_backed\_aws\_dynamic\_credentials.default.shared\_credentials\_file] } provider "aws" { alias = "ALIAS1" shared\_credentials\_files = [var.tfc\_vault\_backed\_aws\_dynamic\_credentials.aliases["ALIAS1"].shared\_credentials\_file] } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/aws-configuration.mdx | main | terraform | [
-0.004356941673904657,
0.004895743913948536,
-0.03899636119604111,
-0.035018034279346466,
-0.07194492220878601,
-0.020990492776036263,
-0.04025012254714966,
-0.015410815365612507,
0.05236887186765671,
0.03755047172307968,
-0.01925274357199669,
-0.05468008667230606,
0.09644618630409241,
-0.... | -0.066303 |
# Use Vault-backed dynamic credentials with the Azure provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.8.0](/terraform/cloud-docs/agents/changelog#1-8-0-04-18-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with Vault to use [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed) with the Azure provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Vault Dynamic Provider Credentials](#configure-vault-dynamic-provider-credentials)\*\*: Set up a trust configuration between Vault and HCP Terraform, create Vault roles and policies for your HCP Terraform workspaces, and add environment variables to those workspaces. 2. \*\*[Configure the Vault Azure Secrets Engine](#configure-vault-azure-secrets-engine)\*\*: Set up the Azure secrets engine in your Vault instance. 3. \*\*[Configure HCP Terraform](#configure-hcp-terraform)\*\*: Add additional environment variables to the HCP Terraform workspaces where you want to use Vault-Backed Dynamic Credentials. 4. \*\*[Configure Terraform Providers](#configure-terraform-providers)\*\*: Configure your Terraform providers to work with Vault-backed Dynamic Credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete this setup, HCP Terraform automatically authenticates with Azure via Vault-generated credentials during the plan and apply phase of each run. The Azure provider's authentication is only valid for the length of the plan or apply phase. ## Configure Vault Dynamic Provider Credentials You must first set up Vault dynamic provider credentials before you can use Vault-backed dynamic credentials. This includes setting up the JWT auth backend in Vault, configuring trust between HCP Terraform and Vault, and populating the required environment variables in your HCP Terraform workspace. [See the setup instructions for Vault dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration). # Configure Vault Azure Secrets Engine Follow the instructions in the Vault documentation for [setting up the Azure secrets engine in your Vault instance](/vault/docs/secrets/azure). You can also do this configuration through Terraform. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/vault-backed/azure). ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set certain environment variables in your HCP Terraform workspace to authenticate HCP Terraform with Azure using Vault-backed dynamic credentials. These variables are in addition to those you previously set while configuring [Vault dynamic provider credentials](#configure-vault-dynamic-provider-credentials). You can add these as workspace variables or as a [variable set](/terraform/cloud-docs/variables/managing-variables#variable-sets). When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Required Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AZURE\_AUTH` `TFC\_VAULT\_BACKED\_AZURE\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.8.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate with Azure. | | `TFC\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE` | The role to use in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE` and `TFC\_VAULT\_BACKED\_AZURE\_APPLY\_VAULT\_ROLE` are both provided. These variables are described [below](#optional-environment-variables). | ### Optional Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_AZURE\_MOUNT\_PATH` `TFC\_VAULT\_BACKED\_AZURE\_MOUNT\_PATH[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_MOUNT\_PATH` | The mount path of the Azure secrets engine in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Defaults to `azure`. | | `TFC\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE` | The Vault role to use the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE` if not | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/azure-configuration.mdx | main | terraform | [
-0.014677748084068298,
0.023284578695893288,
-0.026347260922193527,
-0.007298140786588192,
-0.06694597750902176,
0.06171505153179169,
-0.03206714987754822,
-0.005073490086942911,
0.04359742999076843,
0.039668723940849304,
-0.04413270205259323,
-0.048350170254707336,
0.11449173837900162,
0.... | -0.042711 |
secrets engine in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Defaults to `azure`. | | `TFC\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_PLAN\_VAULT\_ROLE` | The Vault role to use the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE` if not provided. | | `TFC\_VAULT\_BACKED\_AZURE\_APPLY\_VAULT\_ROLE` `TFC\_VAULT\_BACKED\_AZURE\_APPLY\_VAULT\_ROLE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_APPLY\_VAULT\_ROLE` | The Vault role to use for the apply phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_AZURE\_RUN\_VAULT\_ROLE` if not provided. | | `TFC\_VAULT\_BACKED\_AZURE\_SLEEP\_SECONDS` `TFC\_VAULT\_BACKED\_AZURE\_SLEEP\_SECONDS[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_SLEEP\_SECONDS` | The amount of time to wait, in seconds, after obtaining temporary credentials from Vault. e.g., `30` for 30 seconds. Must be 1500 seconds (25 minutes) or less. | Requires \*\*v1.12.0\*\* or later if self-managing agents. Can be used to mitigate eventual consistency issues in Azure. | | `TFC\_VAULT\_BACKED\_AZURE\_VAULT\_CONFIG` `TFC\_VAULT\_BACKED\_AZURE\_VAULT\_CONFIG[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_AZURE\_VAULT\_CONFIG` | The name of the non-default Vault configuration for workspaces using [multiple Vault configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). | Requires \*\*v1.12.0\*\* or later if self-managing agents. Will fall back to using the default Vault configuration if not provided. | ## Configure Terraform Providers The final step is to directly configure your Azure and Vault providers. ### Configure the AzureRM or Microsoft Entra ID Ensure you pass a value for the `subscription\_id` and `tenant\_id` arguments in your provider configuration block or set the `ARM\_SUBSCRIPTION\_ID` and `ARM\_TENANT\_ID` variables in your workspace. Do not set values for `client\_id`, `use\_oidc`, or `oidc\_token` in your provider configuration block. Additionally, do not set variable values for `ARM\_CLIENT\_ID`, `ARM\_USE\_OIDC`, or `ARM\_OIDC\_TOKEN`. ### Configure the Vault Provider If you were previously using the Vault provider to authenticate the Azure provider, remove any existing usage of the Azure secrets engine from your Terraform Code. This includes the [`vault\_azure\_access\_credentials`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/azure\_access\_credentials) data source and any instances of [`vault\_generic\_secret`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/generic\_secret) you previously used to generate Azure credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* Ensure you are using version \*\*3.60.0\*\* or later of the \*\*AzureRM provider\*\* and version \*\*2.43.0\*\* or later of the \*\*Microsoft Entra ID provider\*\* (previously Azure Active Directory) as required functionality was introduced in these provider versions. ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct Vault-backed Azure setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_vault\_backed\_azure\_dynamic\_credentials" { description = "Object containing Vault-backed Azure dynamic credentials configuration" type = object({ default = object({ client\_id\_file\_path = string client\_secret\_file\_path = string }) aliases = map(object({ client\_id\_file\_path = string client\_secret\_file\_path = string })) }) } ``` #### Example Usage ##### AzureRM Provider ```hcl provider "azurerm" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false client\_id\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.default.client\_id\_file\_path client\_secret\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.default.client\_secret\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "10000000-0000-0000-0000-000000000000" } provider "azurerm" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false alias = "ALIAS1" client\_id\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_id\_file\_path client\_secret\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_secret\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "20000000-0000-0000-0000-000000000000" } ``` ##### Microsoft Entra ID Provider (previously AzureAD) ```hcl provider "azuread" { features {} | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/azure-configuration.mdx | main | terraform | [
0.008593874052166939,
0.006623541004955769,
-0.08295412361621857,
0.020250605419278145,
-0.006750490516424179,
0.030813589692115784,
-0.021678650751709938,
-0.017681214958429337,
0.03642488270998001,
0.0011127752950415015,
0.03745555132627487,
-0.03748169168829918,
0.02981547638773918,
0.0... | -0.017075 |
{} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false alias = "ALIAS1" client\_id\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_id\_file\_path client\_secret\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_secret\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "20000000-0000-0000-0000-000000000000" } ``` ##### Microsoft Entra ID Provider (previously AzureAD) ```hcl provider "azuread" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false client\_id\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.default.client\_id\_file\_path client\_secret\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.default.client\_secret\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "10000000-0000-0000-0000-000000000000" } provider "azuread" { features {} // use\_cli should be set to false to yield more accurate error messages on auth failure. use\_cli = false alias = "ALIAS1" client\_id\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_id\_file\_path client\_secret\_file\_path = var.tfc\_vault\_backed\_azure\_dynamic\_credentials.aliases["ALIAS1"].client\_secret\_file\_path subscription\_id = "00000000-0000-0000-0000-000000000000" tenant\_id = "20000000-0000-0000-0000-000000000000" } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/azure-configuration.mdx | main | terraform | [
-0.000030313651222968474,
0.06909623742103577,
-0.0447988323867321,
-0.04680521413683891,
-0.02381027676165104,
-0.025033636018633842,
0.1004154309630394,
0.034204013645648956,
0.06810811907052994,
0.01944761537015438,
0.028894806280732155,
-0.1029471606016159,
0.11597225069999695,
0.04858... | -0.094044 |
# Use Vault-backed dynamic credentials with the GCP provider ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.8.0](/terraform/cloud-docs/agents/changelog#1-8-0-04-18-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can use HCP Terraform’s native OpenID Connect integration with Vault to use [Vault-backed dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-backed) with the GCP provider in your HCP Terraform runs. Configuring the integration requires the following steps: 1. \*\*[Configure Vault Dynamic Provider Credentials](#configure-vault-dynamic-provider-credentials)\*\*: Set up a trust configuration between Vault and HCP Terraform, create Vault roles and policies for your HCP Terraform workspaces, and add environment variables to those workspaces. 2. \*\*[Configure the Vault GCP Secrets Engine](#configure-vault-gcp-secrets-engine)\*\*: Set up the GCP secrets engine in your Vault instance. 3. \*\*[Configure HCP Terraform](#configure-hcp-terraform)\*\*: Add additional environment variables to the HCP Terraform workspaces where you want to use Vault-Backed Dynamic Credentials. 4. \*\*[Configure Terraform Providers](#configure-terraform-providers)\*\*: Configure your Terraform providers to work with Vault-backed dynamic credentials. If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn about the workflow of authenticating your Stack deployments with dynamic credentials. Once you complete this setup, HCP Terraform automatically authenticates with GCP via Vault-generated credentials during the plan and apply phase of each run. The GCP provider's authentication is only valid for the length of the plan or apply phase. ## Configure Vault Dynamic Provider Credentials You must first set up Vault dynamic provider credentials before you can use Vault-backed dynamic credentials. This includes setting up the JWT auth backend in Vault, configuring trust between HCP Terraform and Vault, and populating the required environment variables in your HCP Terraform workspace. [See the setup instructions for Vault dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials/vault-configuration). # Configure Vault GCP Secrets Engine Follow the instructions in the Vault documentation for [setting up the GCP secrets engine in your Vault instance](/vault/docs/secrets/gcp). You can also do this configuration through Terraform. Refer to our [example Terraform configuration](https://github.com/hashicorp/terraform-dynamic-credentials-setup-examples/tree/main/vault-backed/gcp). ~> \*\*Important\*\*: carefully consider the limitations and differences between each supported credential type in the GCP secrets engine. These limitations carry over to HCP Terraform’s usage of these credentials for authenticating the GCP provider. ## Configure HCP Terraform If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn how to use the `identity\_token` block to authenticate your Stack deployments with dynamic credentials. Next, you need to set certain environment variables in your HCP Terraform workspace to authenticate HCP Terraform with GCP using Vault-backed dynamic credentials. These variables are in addition to those you previously set while configuring [Vault dynamic provider credentials](#configure-vault-dynamic-provider-credentials). You can add these as workspace variables or as a [variable set](/terraform/cloud-docs/variables/managing-variables#variable-sets). When you configure dynamic provider credentials with multiple provider configurations of the same type, use either a default variable or a tagged alias variable name for each provider configuration. Refer to [Specifying Multiple Configurations](#specifying-multiple-configurations) for more details. ### Common Environment Variables The below variables apply to all GCP auth types. #### Required Common Environment Variables | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_AUTH` `TFC\_VAULT\_BACKED\_GCP\_AUTH[\_TAG]` \_(Default variable not supported)\_ | `true` | Requires \*\*v1.8.0\*\* or later if self-managing agents. Must be present and set to `true`, or HCP Terraform will not attempt to authenticate with GCP. | | `TFC\_VAULT\_BACKED\_GCP\_AUTH\_TYPE` `TFC\_VAULT\_BACKED\_GCP\_AUTH\_TYPE[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_AUTH\_TYPE` | Specifies the type of authentication to perform with GCP. Must be one of the following: `roleset/access\_token`, `roleset/service\_account\_key`, `static\_account/access\_token`, or `static\_account/service\_account\_key`. | Requires \*\*v1.8.0\*\* or later if self-managing agents. | #### Optional Common Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_MOUNT\_PATH` `TFC\_VAULT\_BACKED\_GCP\_MOUNT\_PATH[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_MOUNT\_PATH` | The mount path of the GCP | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/gcp-configuration.mdx | main | terraform | [
-0.02654711715877056,
0.006952290423214436,
0.0136686647310853,
-0.030808662995696068,
-0.07670937478542328,
0.04163061082363129,
-0.03417496010661125,
0.00007958253991091624,
0.01808142475783825,
0.022356098517775536,
-0.04438337683677673,
-0.04917379096150398,
0.09597261995077133,
-0.011... | -0.042599 |
`roleset/access\_token`, `roleset/service\_account\_key`, `static\_account/access\_token`, or `static\_account/service\_account\_key`. | Requires \*\*v1.8.0\*\* or later if self-managing agents. | #### Optional Common Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_MOUNT\_PATH` `TFC\_VAULT\_BACKED\_GCP\_MOUNT\_PATH[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_MOUNT\_PATH` | The mount path of the GCP secrets engine in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Defaults to `gcp`. | | `TFC\_VAULT\_BACKED\_GCP\_VAULT\_CONFIG` `TFC\_VAULT\_BACKED\_GCP\_VAULT\_CONFIG[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_VAULT\_CONFIG` | The name of the non-default Vault configuration for workspaces using [multiple Vault configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). | Requires \*\*v1.12.0\*\* or later if self-managing agents. Will fall back to using the default Vault configuration if not provided. | ### Roleset Specific Environment Variables These environment variables are only valid if the `TFC\_VAULT\_BACKED\_GCP\_AUTH\_TYPE` is `roleset/access\_token` or `roleset/service\_account\_key`. #### Required Roleset Specific Environment Variables | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_ROLESET` `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_ROLESET[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_ROLESET` | The roleset to use in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_ROLESET` and `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_ROLESET` are both provided. These variables are described [below](#optional-roleset-specific-environment-variables). | #### Optional Roleset Specific Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |----------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_ROLESET` `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_ROLESET[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_ROLESET` | The roleset to use for the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_ROLESET` if not provided. | | `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_ROLESET` `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_ROLESET[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_ROLESET` | The roleset to use for the apply phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_ROLESET` if not provided. | ### Static Account Specific Environment Variables These environment variables are only valid if the `TFC\_VAULT\_BACKED\_GCP\_AUTH\_TYPE` is `static\_account/access\_token` or `static\_account/service\_account\_key`. #### Required Static Account Specific Environment Variables | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_STATIC\_ACCOUNT` `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_STATIC\_ACCOUNT[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_STATIC\_ACCOUNT` | The static account to use in Vault. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Optional if `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_STATIC\_ACCOUNT` and `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_STATIC\_ACCOUNT` are both provided. These variables are described [below](#optional-static-account-specific-environment-variables). | #### Optional Static Account Specific Environment Variables You may need to set these variables, depending on your use case. | Variable | Value | Notes | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_STATIC\_ACCOUNT` `TFC\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_STATIC\_ACCOUNT[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_PLAN\_VAULT\_STATIC\_ACCOUNT` | The static account to use for the plan phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_STATIC\_ACCOUNT` if not provided. | | `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_STATIC\_ACCOUNT` `TFC\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_STATIC\_ACCOUNT[\_TAG]` `TFC\_DEFAULT\_VAULT\_BACKED\_GCP\_APPLY\_VAULT\_STATIC\_ACCOUNT` | The static account to use for the apply phase of a run. | Requires \*\*v1.8.0\*\* or later if self-managing agents. Will fall back to the value of `TFC\_VAULT\_BACKED\_GCP\_RUN\_VAULT\_STATIC\_ACCOUNT` if not provided. | ## Configure Terraform Providers The final step is to directly configure your GCP and Vault providers. ### Configure the GCP Provider Ensure you pass values for the `project` and `region` arguments into the provider configuration block. Ensure you are not setting values or environment variables for `GOOGLE\_CREDENTIALS` or `GOOGLE\_APPLICATION\_CREDENTIALS`. Otherwise, these values may interfere with dynamic provider credentials. ### Configure the Vault Provider If you were previously using the Vault provider to authenticate the GCP provider, remove any existing usage of the GCP secrets engine from your Terraform Code. This includes instances of [`vault\_generic\_secret`](https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/generic\_secret) that you previously used to generate GCP credentials. ### Specifying Multiple Configurations ~> \*\*Important:\*\* If you are self-hosting [HCP Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct Vault-backed GCP setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/gcp-configuration.mdx | main | terraform | [
0.015309949405491352,
-0.0066412403248250484,
-0.09369704872369766,
-0.004825230222195387,
-0.06943754851818085,
0.02597745880484581,
0.05151655152440071,
0.06527311354875565,
-0.05402242764830589,
-0.020129231736063957,
0.06619540601968765,
-0.06470219045877457,
0.053947459906339645,
0.00... | 0.031025 |
Terraform agents](/terraform/cloud-docs/agents), ensure your agents use [v1.12.0](/terraform/cloud-docs/agents/changelog#1-12-0-07-26-2023) or above. To use the latest dynamic credentials features, [upgrade your agents to the latest version](/terraform/cloud-docs/agents/changelog). You can add additional variables to handle multiple distinct Vault-backed GCP setups, enabling you to use multiple [provider aliases](/terraform/language/providers/configuration#alias-multiple-provider-configurations) within the same workspace. You can configure each set of credentials independently, or use default values by configuring the variables prefixed with `TFC\_DEFAULT\_`. For more details, see [Specifying Multiple Configurations](/terraform/cloud-docs/dynamic-provider-credentials/specifying-multiple-configurations). #### Required Terraform Variable To use additional configurations, add the following code to your Terraform configuration. This lets HCP Terraform supply variable values that you can then use to map authentication and configuration details to the correct provider blocks. ```hcl variable "tfc\_vault\_backed\_gcp\_dynamic\_credentials" { description = "Object containing Vault-backed GCP dynamic credentials configuration" type = object({ default = object({ credentials = string access\_token = string }) aliases = map(object({ credentials = string access\_token = string })) }) } ``` #### Example Usage ##### Access Token ```hcl provider "google" { access\_token = var.tfc\_vault\_backed\_gcp\_dynamic\_credentials.default.access\_token } provider "google" { alias = "ALIAS1" access\_token = var.tfc\_vault\_backed\_gcp\_dynamic\_credentials.aliases["ALIAS1"].access\_token } ``` ##### Credentials ```hcl provider "google" { credentials = var.tfc\_vault\_backed\_gcp\_dynamic\_credentials.default.credentials } provider "google" { alias = "ALIAS1" credentials = var.tfc\_vault\_backed\_gcp\_dynamic\_credentials.aliases["ALIAS1"].credentials } ``` | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/dynamic-provider-credentials/vault-backed/gcp-configuration.mdx | main | terraform | [
0.0035637167748063803,
-0.041728388518095016,
-0.021804528310894966,
-0.05438597872853279,
-0.10153522342443466,
0.019561009481549263,
0.004529785830527544,
-0.023635191842913628,
0.02270197495818138,
0.01348918117582798,
-0.012297543697059155,
-0.06808865070343018,
0.10864027589559555,
0.... | -0.078375 |
# Use HCP Terraform in Europe HashiCorp's product-as-a-service platform, [HashiCorp Cloud Platform (HCP)](/hcp/docs), can manage infrastructure in Europe. With HCP Europe, your resources are hosted, managed, and billed separately to meet [European data residency requirements](https://www.hashicorp.com/en/trust/privacy/hcp-data-privacy). HCP Europe also hosts HCP Terraform in HCP Europe, which lets you manage Terraform resources in Europe with familiar workflows while adhering to European data and privacy regulations. To learn more, refer to [HCP EU region and data governance](https://www.hashicorp.com/en/trust/eu). To learn more about HCP Europe, refer to the [HCP Europe documentation](/hcp/docs/hcp/europe). ## HCP Terraform in Europe differences If your URL includes `portal.cloud.eu.hashicorp` or `app.eu.terraform.io`, then you are in an HCP Europe organization. In HCP Europe, your account, organization, projects, and workspaces are separate from your HCP Terraform resources in other regions. HCP Terraform also calculates billing separately for Terraform resources in HCP Europe. In HCP Europe, you administrate HCP Terraform through the HCP platform. HCP Terraform inherits the organization, projects, and groups of users that you set up in HCP. In HCP Europe organizations, you configure the following in the HCP platform: - [Organizations](/hcp/docs/hcp/admin/orgs) - [Projects](/hcp/docs/hcp/admin/projects) - [Groups](/hcp/docs/hcp/iam/groups) - [Users](/hcp/docs/hcp/iam/users) - [HCP organization and project roles for groups](/hcp/docs/hcp/iam/access-management#roles-permissions) HCP Europe organizations do not support \*\*teams\*\*, but you can manage user access and permissions through HCP \*\*groups\*\* and roles. You also can further refine group permissions in HCP Terraform at the organization, project, and workspace scope. To learn more, refer to [Set permissions](/terraform/cloud-docs/users-teams-organizations/permissions/set-permissions). ## Get started You must create a new HCP account and organization to use HCP Europe. You cannot connect or migrate existing HCP Terraform accounts or organizations to HCP Europe. To get started with HCP Terraform in the EU region, sign up on the HCP Europe portal: . To learn more about HCP Europe and creating a new account, refer to the [HCP Europe documentation](/hcp/docs/hcp/europe). To learn about the available billing and plan options, [contact sales](https://www.hashicorp.com/en/contact-sales). ## Constraints and limitations The following features are not available in HCP Europe organizations in HCP Terraform: - Using Flex or pay-as-you-go billing. - Manually changing HCP Terraform plans. To learn about the available billing and plan options, [contact sales](https://www.hashicorp.com/en/contact-sales). - Using the third-party integrations for ServiceNow or the Kubernetes operator. - Using the [`tf-migrate` CLI](https://developer.hashicorp.com/terraform/migrate) tool. - Using [public registry namespaces](/terraform/cloud-docs/users-teams-organizations/organizations/public-namespace) to share private modules with other organizations. - Setting [execution mode](/terraform/cloud-docs/projects/manage#change-the-execution-mode) at the project level. Instead, set execution mode at the organization or workspace levels. - HCP Terraform does not support [HCP service principals](/hcp/docs/hcp/iam/service-principal). To learn about the limitations of HCP Europe organizations on the HCP platform, refer to the [HCP documentation](/hcp/docs/hcp/europe#constraints-and-limitations). | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/europe/index.mdx | main | terraform | [
0.05337812751531601,
0.016918368637561798,
-0.02135590650141239,
-0.0813668966293335,
0.004178326111286879,
-0.04891754686832428,
-0.02373744547367096,
-0.03945257514715195,
0.002377146854996681,
-0.010653143748641014,
-0.0005531204515136778,
-0.08223360776901245,
0.007884361781179905,
0.0... | 0.108324 |
[private module registry]: /terraform/cloud-docs/registry [policy sets]: /terraform/cloud-docs/policy-enforcement/manage-policy-sets [vcs settings]: /terraform/cloud-docs/workspaces/settings/vcs [create]: /terraform/cloud-docs/workspaces/create [owners]: /terraform/cloud-docs/users-teams-organizations/teams#the-owners-team # Set up the GitHub.com (GitHub App) VCS provider These instructions are for using repositories from GitHub.com with HCP Terraform workspaces or Stacks and private registry modules, without requiring an organization owner to configure an OAuth connection. This method uses a preconfigured GitHub App, and only works with GitHub.com. There are separate instructions for connecting to [GitHub.com via OAuth](/terraform/cloud-docs/vcs/github), connecting to [GitHub Enterprise](/terraform/cloud-docs/vcs/github-enterprise), and connecting to [other supported VCS providers.](/terraform/cloud-docs/vcs) -> \*\*Note:\*\* This VCS Provider is only available on HCP Terraform. If you are using Terraform Enterprise, you can follow the instructions for creating [GitHub App for TFE](/terraform/enterprise/admin/application/github-app-integration) or connecting to [GitHub.com via OAuth](/terraform/cloud-docs/vcs/github). ## Using GitHub Repositories Choose "GitHub.com" on the "Connect to a version control provider" screen, which is shown when [creating a new workspace][create], [changing a workspace's VCS connection][vcs settings], or [creating](/terraform/cloud-docs/stacks/create) or [configuring](/terraform/cloud-docs/stacks/configure) Stacks. Authorize access to GitHub if necessary. On the next screen, select a GitHub account or organization from the drop-down menu (or add a new organization) and choose a repository from the list. The controls on the "Connect to a version control provider" screen can vary, depending on your permissions and your organization's settings: - In organizations with no VCS connections configured: - Users with permission to manage VCS settings ([more about permissions](/terraform/cloud-docs/users-teams-organizations/permissions)) will see several drop-down menus, sorted by product family. Choose "GitHub.com" (\_not\_ "GitHub.com (Custom)") from the GitHub menu. - Other users will see a "GitHub" button. - In organizations with an existing VCS connection, only the connected providers are shown. Click the "Connect to a different VCS" link to reveal the provider menus (if you [can manage VCS settings) or the GitHub button (others). [permissions-citation]: #intentionally-unused---keep-for-maintainers ## GitHub Permissions When using the Terraform Cloud GitHub App, each HCP Terraform user authenticates individually, and can use GitHub resources within HCP Terraform according to their own GitHub organization memberships and access permissions. -> \*\*Note:\*\* This is different from OAuth connections, where an HCP Terraform organization always acts as one particular GitHub user. To enable this personalized access, HCP Terraform requests two kinds of permissions: - \*\*Per user:\*\* Each HCP Terraform user must \_authorize\_ HCP Terraform for their own GitHub account. This lets HCP Terraform determine which organizations and repositories they have access to. - \*\*Per GitHub organization:\*\* Each GitHub organization (or personal account) must \_install\_ the Terraform Cloud app, either globally or for specific repositories. This allows HCP Terraform to access repository contents and events. Individual HCP Terraform users can access GitHub repositories where both of the following are true: - The user has at least read access to that repository on GitHub. - The repository's owner has installed the Terraform Cloud app and allowed it to access that repository. This means that different HCP Terraform users within the same organization can see different sets of repositories available for their workspaces or Stacks. ### Authorizing HCP Terraform requests GitHub authorization from each user, displaying a pop-up window the first time they choose GitHub on the "Connect to a version control provider" screen.  Once you authorize the app, you can use GitHub in any of your HCP Terraform organizations without needing to re-authorize. After installing the GitHub App and creating your VCS provider instance, you cannot reinstall the application again. However, you can modify your existing GitHub App configuration. If you are a repository owner, you can adjust an existing Github App configuration by: 1. Click a repository's \*\*Settings\*\* tab. 1. Select \*\*GitHub Apps\*\* in the sidebar. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-app.mdx | main | terraform | [
-0.0624321848154068,
-0.027467871084809303,
-0.029925772920250893,
-0.0034678212832659483,
-0.056901127099990845,
-0.012020329013466835,
-0.042602285742759705,
-0.014500314369797707,
0.07006482779979706,
0.03799743205308914,
0.004966938868165016,
-0.018498552963137627,
0.050828706473112106,
... | 0.045007 |
App and creating your VCS provider instance, you cannot reinstall the application again. However, you can modify your existing GitHub App configuration. If you are a repository owner, you can adjust an existing Github App configuration by: 1. Click a repository's \*\*Settings\*\* tab. 1. Select \*\*GitHub Apps\*\* in the sidebar. 1. Next to \*\*Terraform Cloud\*\*, click \*\*Configure\*\*. 1. Underneath \*\*Repository access\*\*, adjust the repositories your GitHub app can access. Now that your Github app has access to your desired repository, you can [create a new workspace](/terraform/cloud-docs/workspaces/create#create-a-workspace) or [Stack](/terraform/cloud-docs/stacks/create) with your existing, newly updated GitHub App connection. You can also adjust your GitHub App's access within HCP Terraform itself. Whenever you create a new workspace or Stack, you can choose which organizations or repositories to install the GitHub App into. To adjust your GitHub App's configuration, create a new workspace: 1. Sign in to [HCP Terraform](https://app.terraform.io/) and navigate to the organization where you want to adjust your VCS settings. 1. Choose \*\*Workspaces\*\* from the sidebar. 1. Click \*\*New\*\*, then select \*\*Workspace\*\*. 1. Choose the project where you want to create your workspace, then click \*\*Create\*\*. 1. Click \*\*Version Control Workflow\*\*, then choose the \*\*GitHub App\*\*. 1. Click on your GitHub organization's name to reveal a dropdown, then select \*\*Add another organization\*\* to configure the resources your GitHub app has access to. #### Deauthorizing You can use GitHub's web interface to deauthorize HCP Terraform for your GitHub account. Open your GitHub personal settings, then go to the "Applications" section and the "Authorized GitHub Apps" tab. (Or, browse directly to `https://github.com/settings/apps/authorizations`.) Click the \*\*Revoke\*\* button for HCP Terraform to deauthorize it. After deauthorizing, you won't be able to connect GitHub repositories to HCP Terraform workspaces or Stacks until you authorize again. Existing connections will still work. ### Installing HCP Terraform requests installation when a user chooses "Add another organization" from the repository list's organization menu. The installation interface is a pop-up GitHub window, which lists your personal account and the organizations you can access. Note that installing an app for a GitHub organization requires appropriate organization permissions; see [GitHub's permissions documentation](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/permission-levels-for-an-organization#github-app-managers) for details.  For a given organization or account, the app can be installed globally or only for specific repositories. Once the application is installed for an organization (or a subset of its repositories), its members can select any affected repositories they have access to when using HCP Terraform. Access is not restricted to a specific HCP Terraform organization; members of a GitHub organization can use its repositories in any HCP Terraform organization they belong to. #### Configuring and Uninstalling You can use GitHub's web interface to configure or uninstall HCP Terraform for an organization or account. Open your GitHub personal settings or organization settings, then go to the \*\*Applications\*\* section and the \*\*Installed GitHub Apps\*\* tab. Click the \*\*Configure\*\* button for HCP Terraform to change its settings. In the app's settings you can change which repositories HCP Terraform has access to, or uninstall it entirely. If you disallow access to a repository that is currently connected to any HCP Terraform workspaces or Stacks, those workspaces or Stacks will be unable to retrieve configuration versions until you change their VCS settings and connect them to an allowed repository. ## Feature Limitations You can use the Terraform Cloud GitHub App to create workspaces and private registry modules from the UI, the API, or the TFE Terraform provider. The following tools can use any version of HCP Terraform to access these features, but require a minimum version of Terraform Enterprise: - | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-app.mdx | main | terraform | [
-0.0264715738594532,
-0.07249684631824493,
0.019246477633714676,
-0.0337534174323082,
-0.03907305747270584,
0.03186699375510216,
-0.06726948916912079,
-0.046734392642974854,
0.0566449910402298,
0.0725901871919632,
-0.008187511004507542,
-0.0006640686769969761,
0.0636381283402443,
-0.021408... | -0.040347 |
Feature Limitations You can use the Terraform Cloud GitHub App to create workspaces and private registry modules from the UI, the API, or the TFE Terraform provider. The following tools can use any version of HCP Terraform to access these features, but require a minimum version of Terraform Enterprise: - For the UI, use Terraform Enterprise v202302-1 or above. - For the API, use Terraform Enterprise v202303-1 or above. - Using at least v1.19.0 of [`go\_tfe`](https://github.com/hashicorp/go-tfe), use Terraform Enterprise v202303-1 and above. - Using at least v0.43.0 of [`tfe\_provider`](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs), use Terraform Enterprise v202303-1 and above. Once you decide to start using these other features, a user with permission to manage VCS settings can configure [GitHub OAuth access](/terraform/cloud-docs/vcs/github) for your organization. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-app.mdx | main | terraform | [
0.0009815129451453686,
-0.017407003790140152,
-0.03217194974422455,
-0.04052095115184784,
-0.04130784794688225,
-0.02297431044280529,
-0.06739039719104767,
-0.008286899887025356,
-0.0024422607384622097,
0.024113716557621956,
0.00471201678737998,
-0.06258264183998108,
0.009143592789769173,
... | 0.089655 |
# Set up the GitLab.com VCS provider These instructions describe how to connect to GitLab.com. Refer to [GitLab EE](/terraform/cloud-docs/vcs/gitlab-eece) for instructions on connecting to GitLab EE. Refer to [VCS overview](/terraform/cloud-docs/vcs) for information about abll VCS integrations. ## Overview Complete the following steps to connect to GitLab.com: 1. Create a new connection in HCP Terraform. Get redirect URI. 1. Register your HCP Terraform organization as a new app in GitLab. Provide redirect URI. 1. Provide HCP Terraform with application ID and secret. Request VCS access. 1. Approve access request in GitLab.com. Alternately, you can skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see [the OAuth Clients API page](/terraform/cloud-docs/api-docs/oauth-clients). ## Requirements Configuring a new VCS provider requires permission to manage VCS settings for the organization. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for more information. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Create a new connection in HCP Terraform 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 2. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 3. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 4. Select \*\*GitLab\*\* and then select \*\*GitLab.com\*\* from the menu. The page moves to the next step. 5. Locate the "Redirect URI" and copy it to your clipboard; you'll paste it in the next step. Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Register your HCP Terraform organization in GitLab 1. In a new browser tab, open [gitlab.com](https://gitlab.com) and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. The account you use for connecting HCP Terraform \*\*must have Maintainer access\*\* to any shared repositories of Terraform configurations, since creating webhooks requires Maintainer permissions. Refer to [the GitLab documentation](https://docs.gitlab.com/ee/user/permissions.html#project-members-permissions) for details. 1. Click your profile picture and choose \*\*Settings\*\*. 1. Click \*\*Applications\*\*. 1. Configure the follwoing settings using the corresponding values displayed in your HCP Terraform browser tab. HCP Terraform lists the values in the order they appear, and includes controls for copying values to your clipboard: - \*\*Name\*\*: HCP Terraform (``). - \*\*Redirect URI\*\*: `https://app.terraform.io/`, the redirect URI you copied from HCP Terraform. - Enable the \*\*Confidential\*\* option. - Enable all fo the options under \*\*Scopes\*\*. These options correspond to the `api` settings. 1. Click \*\*Save application\*\*, which creates the application and takes you to its page. Do not close this page. In the next step, you will copy and paste the unique \*\*Application ID\*\* and \*\*Secret.\*\* ## Provide HCP Terraform with the application ID and secret 1. Enter the \*\*Application ID\*\* and \*\*Secret\*\* from the previous step, as well as an option \*\*Name\*\* for this VCS connection. 2. Click \*\*Connect and continue.\*\* This takes you to a page on GitLab.com, which asks if you want to authorize the app. 3. Click the green \*\*Authorize\*\* button at the bottom of the authorization page. ## Configure advanced settings in HCP Terraform (optional) ## Configure advanced settings in Terraform Enterprise (optional) The settings in this section are optional. You can configure the following advanced settings: - \*\*Scope of VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\* - Most organizations | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/gitlab-com.mdx | main | terraform | [
-0.039296042174100876,
0.020853614434599876,
0.01533493772149086,
-0.03035505674779415,
-0.08556158095598221,
-0.056066855788230896,
-0.027094298973679543,
-0.013574616983532906,
0.026025736704468727,
0.006624245084822178,
-0.06577416509389877,
-0.06806191056966782,
0.09926369041204453,
-0... | -0.022112 |
VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\* - Most organizations will not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. If you do not need to configure advanced settings, click the \*\*Skip and Finish\*\* button after [registering your organization in GitLab](#register-your-hcp-terraform-organization-in-gitlab). This returns you to HCP Terraform's VCS Provider page, which now includes your new GitLab client. ### Limit the scope of this VCS provider 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 2. Click the \*\*Update VCS Provider\*\* button to save your selections. ### Create an SSH keypair SSH is only used to clone Git submodules. All other Git operations use HTTPS. Do not use your personal SSH key to connect HCP Terraform and GitLab. Generate a new key or use an existing key reserved for service access. In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains the key text and uses it when authenticating to GitLab. \*\*Protect this private key carefully.\*\* Someone can use it to push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to GitLab.com. The exact command depends on your OS, but is usually something like: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 2. While logged into the GitLab.com account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 3. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Next steps At this point, GitLab.com access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's shared repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/gitlab-com.mdx | main | terraform | [
-0.03631263226270676,
-0.07971912622451782,
-0.044332798570394516,
-0.024393709376454353,
-0.08165837824344635,
-0.018178440630435944,
-0.02264798991382122,
-0.022389423102140427,
0.06694821268320084,
0.027354251593351364,
0.02532786875963211,
-0.05249524861574173,
0.09014347940683365,
0.0... | -0.023601 |
# Set up the GitHub Enterprise VCS provider These instructions are for using a self-hosted installation of GitHub Enterprise for HCP Terraform's VCS features. [GitHub.com has separate instructions](/terraform/cloud-docs/vcs/github), as do the [other supported VCS providers](/terraform/cloud-docs/vcs). Configuring a new VCS provider requires permission to manage VCS settings for the organization. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers Connecting HCP Terraform to your VCS involves four steps: | On your VCS | On HCP Terraform | | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | | Create a new connection in HCP Terraform. Get callback URL. | | Register your HCP Terraform organization as a new app. Provide callback URL. Get ID and key. | | | | Provide HCP Terraform with ID and key. Request VCS access. | | Approve access request. | | The rest of this page explains the GitHub Enterprise versions of these steps. ~> \*\*Important:\*\* HCP Terraform needs to contact your GitHub Enterprise instance during setup and during normal operation. For the SaaS version of HCP Terraform, this means GitHub Enterprise must be internet-accessible; for Terraform Enterprise, you must have network connectivity between your Terraform Enterprise and GitHub Enterprise instances. -> \*\*Note:\*\* Alternately, you can skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see [the OAuth Clients API page](/terraform/cloud-docs/api-docs/oauth-clients). ## Step 1: On HCP Terraform, begin adding a new VCS provider 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add a VCS provider\*\*. The \*\*Add VCS Provider\*\* page appears. 1. Select \*\*GitHub\*\* and then select \*\*GitHub Enterprise\*\* from the menu. The page moves to the next step. 1. In the "Set up provider" step, fill in the \*\*HTTP URL\*\* and \*\*API URL\*\* of your GitHub Enterprise instance, as well as an optional \*\*Name\*\* for this VCS connection. | Field | Value | | -------- | ------------------------------------------- | | HTTP URL | `https://` | | API URL | `https:///api/v3` | Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: On GitHub, create a new OAuth application 1. In a new browser tab, open your GitHub Enterprise instance and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. ~> \*\*Important:\*\* The account you use for connecting HCP Terraform \*\*must have admin access\*\* to any shared repositories of Terraform configurations, since creating webhooks requires admin permissions. 1. Navigate to GitHub's Register a New OAuth Application page. This page is located at `https:///settings/applications/new`. You can also reach it through GitHub's menus: - Click your profile picture and choose "Settings." - Click "OAuth Apps" (under the "Developer settings" section). - Click the "Register a new application" button. 1. This page has a form with four text fields. Fill out the fields with the corresponding values currently displayed in your HCP Terraform browser tab. HCP Terraform lists the values in the order they appear, and includes controls for copying values to your clipboard. Fill out the text fields as follows: | Field name | Value | | -------------------------- | ----------------------------------------------------------------------------- | | Application Name | HCP Terraform (``) | | Homepage URL | `https://app.terraform.io` (or the URL of your Terraform Enterprise instance) | | Application Description | Any description of your choice. | | Authorization callback URL | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-enterprise.mdx | main | terraform | [
0.008161977864801884,
-0.0075519573874771595,
0.006541186943650246,
-0.03977685794234276,
-0.012705644592642784,
0.004182594828307629,
-0.08559584617614746,
-0.030237972736358643,
0.03410409390926361,
0.04787847772240639,
-0.026068618521094322,
-0.05009499564766884,
0.00020401389338076115,
... | 0.048063 |
as follows: | Field name | Value | | -------------------------- | ----------------------------------------------------------------------------- | | Application Name | HCP Terraform (``) | | Homepage URL | `https://app.terraform.io` (or the URL of your Terraform Enterprise instance) | | Application Description | Any description of your choice. | | Authorization callback URL | `https://app.terraform.io/` | 1. Click the "Register application" button, which creates the application and takes you to its page. 1. [Download this image of the HCP Terraform logo](https://content.hashicorp.com/api/assets?product=terraform-docs-common&version=main&asset=website/img/docs/hcp-terraform-logo-on-white.png) and upload it with the "Upload new logo" button or the drag-and-drop target. This optional step helps you identify HCP Terraform's pull request checks at a glance. 1. Click the "Generate a new client secret" button. You will need this secret in the next step. 1. Leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Client ID\*\* and \*\*Client Secret.\*\* ## Step 3: On HCP Terraform, set up your provider 1. Enter the \*\*Client ID\*\* and \*\*Client Secret\*\* from the previous step. 1. Click "Connect and continue." This takes you to a page on your GitHub Enterprise instance, asking whether you want to authorize the app. 1. The authorization page lists any GitHub organizations this account belongs to. If there is a \*\*Request\*\* button next to the organization that owns your Terraform code repositories, click it now. Note that you need to do this even if you are only connecting workspaces to private forks of repositories in those organizations since those forks are subject to the organization's access restrictions. See [About OAuth App access restrictions](https://docs.github.com/en/organizations/managing-oauth-access-to-your-organizations-data/about-oauth-app-access-restrictions). If it results in a 500 error, it usually means HCP Terraform was unable to reach your GitHub Enterprise instance. 1. Click the green "Authorize ``" button at the bottom of the authorization page. GitHub might request your password or multi-factor token to confirm the operation. ## Step 4: On HCP Terraform, configure advanced settings (optional) The settings in this section are optional. The Advanced Settings you can configure are: - \*\*Scope of VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\* - Most organizations will not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. ### If you don't need to configure advanced settings: 1. Click the \*\*Skip and finish\*\* button. This returns you to HCP Terraform's VCS Providers page, which now includes your new GitHub Enterprise client. ### If you need to limit the scope of this VCS provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ### If you need an SSH keypair: #### Important notes - SSH will only be used to clone Git submodules. All other Git operations will still use HTTPS. - Do not use your personal SSH key to connect HCP Terraform and GitHub Enterprise; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-enterprise.mdx | main | terraform | [
0.011079467833042145,
0.04715749993920326,
-0.04888937994837761,
-0.06793779134750366,
-0.024102261289954185,
-0.006959100719541311,
-0.017468592151999474,
0.024425722658634186,
-0.04045649617910385,
0.04239747300744057,
-0.02450636588037014,
-0.09201160073280334,
0.06778456270694733,
-0.0... | 0.048729 |
will still use HTTPS. - Do not use your personal SSH key to connect HCP Terraform and GitHub Enterprise; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it when authenticating to GitHub Enterprise. - \*\*Protect this private key carefully.\*\* It can push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to Github Enterprise. The exact command depends on your OS, but is usually something like: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. While logged into the GitHub Enterprise account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Step 5: Contact Your GitHub organization admins If your organization uses OAuth app access restrictions, you had to click a \*\*Request\*\* button when authorizing HCP Terraform, which sent an automated email to the administrators of your GitHub organization. An administrator must approve the request before HCP Terraform can access your organization's shared repositories. If you're a GitHub administrator, check your email now and respond to the request; otherwise, contact whoever is responsible for GitHub accounts in your organization, and wait for confirmation that they've approved your request. ## Finished At this point, GitHub access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's shared GitHub Enterprise repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github-enterprise.mdx | main | terraform | [
0.022511430084705353,
0.017443086951971054,
-0.06309022009372711,
-0.0530291423201561,
-0.08259835839271545,
0.032440461218357086,
-0.03344159573316574,
-0.02652083709836006,
0.022646702826023102,
0.02357703074812889,
0.00530481431633234,
-0.03979767858982086,
0.06932025402784348,
-0.02751... | 0.029023 |
# Set up the Azure DevOps Services VCS provider using OAuth These instructions describe how to connect to `dev.azure.com` for VCS integration. Refer to the [VCS overview](/terraform/cloud-docs/vcs) for information about other systems. ## Overview Complete the following steps to connect to Azure DevOps Services VCS: 1. Enable third-party application access in Azure DevOps Services. 1. In HCP Terraform or Terraform Enterprise, create a new connection and get the callback URL. 1. Perform the following actions in your Microsoft Entra admin center: 1. Create a new Microsoft Entra application. 1. Provide the HCP Terraform or Terraform Enterprise callback URL. 1. Retrieve the Microsoft Entra application ID, tenant ID, and tenant key. 1. Perform the following actions in HCP Terraform or Terraform Enterprise: 1. Provide the Microsoft Entra application ID, tenant ID, and tenant key. 1. Request VCS access. 4. On your VCS, approve the access request from HCP Terraform or Terraform Enterprise. 5. On your VCS, connect Azure DevOps Organization to the Microsoft Entra Application. ## Requirements Only Azure DevOps connections that use the `dev.azure.com` domain are supported. If your Azure DevOps project uses the older `visualstudio.com` domain, you must migrate using the [steps in the Microsoft documentation](https://docs.microsoft.com/en-us/azure/devops/release-notes/2018/sep-10-azure-devops-launch#switch-existing-organizations-to-use-the-new-domain-name-url). Configuring a new VCS provider requires permission to [manage VCS settings](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-vcs-settings) for the organization. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Enable third-party application access in Azure DevOps Services 1. Log in to [Azure DevOps Services](https://dev.azure.com/). 2. Click \*\*Organization settings\*\*. 3. Click \*\*Policies\*\* under \*\*Security\*\*. 4. Enable the \*\*Third-party application access via OAuth\*\* setting.  ## Add a new VCS provider Complete the following steps in HCP Terraform or Terraform Enterprise: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 2. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 3. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 4. Select \*\*Azure DevOps\*\* and then select \*\*Azure DevOps Services\*\* from the menu. The page moves to the next step. Leave this page open in a browser tab. You will copy values from this page into Azure DevOps in the next step, and in later steps you will continue configuring HCP Terraform. ## Create a new Microsoft Entra application Complete the following steps in your Microsoft Entra admin center: 1. In a new browser tab, login to your [Microsoft Entra admin center](https://entra.microsoft.com) 1. Open the \*\*Applications\*\* drop-down menu, then click \*\*App registrations\*\*. If you have access to multiple Entra tenants, switch to the tenant in which you want to register the application. 1. Complete the following fields and enable the following options with the corresponding values currently displayed in your HCP Terraform or Terraform Enterprise browser tab: | Field name | Value | | ---------------- | ---------------------------------------------------------------------------------------------------------- | | Application Name | HCP Terraform (``) | | Redirect URI | Choose \*\*Web\*\* from the drop-down and enter `https://app.terraform.io/` in the text box | 1. Click \*\*Register\*\* to create the app. 1. Once the app is registered, click \*\*API permissions\*\* under the \*\*Manage\*\* section from the application overview. 1. Click \*\*Azure DevOps\*\*, then add \*\*vso.code\*\* and \*\*vso.code\_status\*\* permissions.  1. Click \*\*Certificates and secrets\*\*, then click the \*\*Client secrets\*\* tab. 1. Click \*\*New client secret\*\* and complete the instructions when prompted to create a client secret. 1. Click \*\*Overview\*\* and leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Application (client) ID\*\*, \*\*Directory (tenant) ID\*\* and \*\*Client Secret\*\* from this page. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services.mdx | main | terraform | [
0.002458862727507949,
-0.004567191004753113,
-0.04931549355387688,
-0.04461881145834923,
-0.03196089714765549,
-0.00310253887437284,
-0.03138740360736847,
-0.0015529070515185595,
0.046858999878168106,
0.09934917092323303,
-0.05713989958167076,
-0.09316971153020859,
0.03688395395874977,
-0.... | 0.043865 |
Click \*\*New client secret\*\* and complete the instructions when prompted to create a client secret. 1. Click \*\*Overview\*\* and leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Application (client) ID\*\*, \*\*Directory (tenant) ID\*\* and \*\*Client Secret\*\* from this page. ## Set up your provider Complete the follwoing actions in HCP Terraform or Terraform Enterprise: 1. (Optional) Enter a \*\*Name\*\* for this VCS connection. 1. Enter your Azure DevOps Services application's \*\*Application (client) ID\*\*, \*\*Directory (tenant) ID\*\* and \*\*Client Secret\*\*. Get these values from the application's details in the open browser tab described in [Create a new Microsoft Entra application](#create-a-new-microsoft-entra-application). 1. Click \*\*Connect and continue\*\*. This action opens a page in Azure DevOps Services that prompts you to authorize the app. 1. Click \*\*Accept\*\*. You are redirected back to HCP Terraform or Terraform Enterprise. If you receive a 404 error from Azure DevOps Services, verify that your callback URL is configured correctly. ## Configure advanced settings (optional) The following HCP Terraform and Terraform Enterprise settings are optional. - \*\*Scope of VCS Provider\*\*. You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\*. Most organizations do not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed over SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. If you don't need to configure the advanced settings, click \*\*Skip and Finish\*\*. HCP Terraform or Terraform Enterprise directs you to the VCS provider page, which now includes your new Azure DevOps Services client. ### Limit the scope of the VCS provider Complete the following steps if you need to Limit the scope of this VCS provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 2. Click the \*\*Update VCS Provider\*\* button to save your selections. ### Create an SSH keypair HCP Terraform and Terraform Enterprise only use SSH keypairs to clone Git submodules. All other Git operations use HTTPS. Do not use your personal SSH key to connect Azure DevOps Services. Generate a new keypair or use an existing key reserved for service access. The following steps require you to provide HCP Terraform or Terraform Enterprise with a private key. Terraform does not display the text of the key after you enter it, but it retains the text and uses it when authenticating to Azure DevOps Services. Protect this private key carefully. Someone can use it to push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create an SSH keypair that HCP Terraform or Terraform Enterrpise can use to connect to Azure DevOps Services. Refer to your operating system documentation for details. The following example uses the `ssh-keygen` command to create a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. Log into the Azure DevOps Services account | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services.mdx | main | terraform | [
-0.025787295773625374,
0.03143753483891487,
-0.02538924291729927,
-0.05823877826333046,
-0.0441567562520504,
0.029911605641245842,
0.013743618503212929,
-0.03636044263839722,
0.07093796879053116,
0.12399894744157791,
-0.007695906329900026,
-0.11177699267864227,
0.08369889110326767,
0.00308... | 0.043906 |
a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. Log into the Azure DevOps Services account you want HCP Terraform to act as. 1. Navigate to the SSH Keys settings page. 1. Add a new SSH key and paste the value of the SSH public key you created in step 1. 1. In HCP Terraform, open the \*\*Add VCS Provider\*\* page. 1. Provide the text of the \*\*SSH private key\*\* you created in step 1, then click \*\*Add SSH Key\*\*. ## Connect Azure DevOps Organization to the Microsoft Entra Application. Ensure that the Azure DevOps organization you intend to link with HCP Terraform is connected to the correct Microsoft Entra app created in Step 2 by following these [instructions](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/connect-organization-to-azure-ad?view=azure-devops). ## Next steps After configuring Azure DevOps Services access for HCP Terraform, you can create Terraform workspaces or Stacksbased on your organization's repositories. ### Migrate existing workspaces to connect to ADO Organization with the new MS Entra App If you need to migrate existing workspaces to connect to ADO organization, go to the HCP Terraform workspaces associated with the Azure DevOps organization via legacy OAuth application, and update the VCS settings to use the new VCS provider created in Step 3. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services.mdx | main | terraform | [
0.03877909108996391,
0.012333421967923641,
-0.044821906834840775,
-0.053862065076828,
-0.07263044267892838,
0.060335922986269,
-0.032472576946020126,
-0.04684099555015564,
0.018642699345946312,
0.100523941218853,
-0.026478689163923264,
-0.10677961260080338,
0.06771725416183472,
-0.01096372... | -0.001414 |
# Set up the GitHub.com OAuth VCS provider These instructions are for using GitHub.com for HCP Terraform's VCS features, using a per-organization OAuth connection with the permissions of one particular GitHub user. [GitHub Enterprise has separate instructions,](/terraform/enterprise/vcs/github-enterprise) as do the [other supported VCS providers.](/terraform/enterprise/vcs) For new users on HCP Terraform, we recommend using our [configuration-free GitHub App](/terraform/cloud-docs/vcs/github-app) to access repositories instead. For Terraform Enterprise site admins, you can create your own [GitHub App](/terraform/enterprise/admin/application/github-app-integration) to access repositories. Configuring a new VCS provider requires permission to manage VCS settings for the organization. ([More about permissions.](/terraform/enterprise/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers Connecting HCP Terraform to your VCS involves four steps: | On your VCS | On HCP Terraform | | ------------------------------------------------------------------------------ | ------------------------------------------------------------- | | | Create a new connection in HCP Terraform. Get callback URL. | | Register your HCP Terraform organization as a new app. Provide callback URL. | | | | Provide HCP Terraform with ID and key. Request VCS access. | | Approve access request. | | The rest of this page explains the GitHub versions of these steps. -> \*\*Note:\*\* Alternately, you can skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see [the OAuth Clients API page](/terraform/cloud-docs/api-docs/oauth-clients). ## Step 1: On HCP Terraform, begin adding a new VCS provider 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add a VCS provider\*\*. The \*\*Add VCS Provider\*\* page appears. 1. Select \*\*GitHub\*\* and then select \*\*GitHub.com (Custom)\*\* from the menu. The page moves to the next step. Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: On GitHub, create a new OAuth application On the HCP Terraform \*\*Add VCS Provider\*\* page, click \*\*register a new OAuth Application\*\*. This opens GitHub.com in a new browser tab with the OAuth application settings pre-filled. Alternately, create the OAuth application manually on GitHub.com. ### Manual steps 1. In a new browser tab, open [github.com](https://github.com) and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. ~> \*\*Important:\*\* The account you use for connecting HCP Terraform \*\*must have admin access\*\* to any shared repositories of Terraform configurations, since creating webhooks requires admin permissions. 1. Navigate to GitHub's [Register a New OAuth Application](https://github.com/settings/applications/new) page. This page is located at . You can also reach it through GitHub's menus: - Click your profile picture and choose "Settings." - Click "Developer settings," then make sure you're on the "OAuth Apps" page (not "GitHub Apps"). - Click the "New OAuth App" button. 1. This page has a form with four text fields. Fill out the fields with the corresponding values currently displayed in your HCP Terraform browser tab. HCP Terraform lists the values in the order they appear, and includes controls for copying values to your clipboard. Fill out the text fields as follows: | Field name | Value | | -------------------------- | ----------------------------------------------------------------------------- | | Application Name | HCP Terraform (``) | | Homepage URL | `https://app.terraform.io` (or the URL of your Terraform Enterprise instance) | | Application Description | Any description of your choice. | | Authorization callback URL | `https://app.terraform.io/` | ### Register the OAuth application 1. Click the "Register application" button, which creates the application and takes you to | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github.mdx | main | terraform | [
-0.009536766447126865,
-0.029541537165641785,
-0.024228587746620178,
-0.03408808633685112,
-0.03417156636714935,
-0.025683561339974403,
-0.05136888846755028,
-0.006074514705687761,
0.04665154591202736,
0.05202474445104599,
-0.04250768572092056,
-0.031966693699359894,
0.027049895375967026,
... | 0.027853 |
| Homepage URL | `https://app.terraform.io` (or the URL of your Terraform Enterprise instance) | | Application Description | Any description of your choice. | | Authorization callback URL | `https://app.terraform.io/` | ### Register the OAuth application 1. Click the "Register application" button, which creates the application and takes you to its page. 1. [Download this image of the HCP Terraform logo](https://content.hashicorp.com/api/assets?product=terraform-docs-common&version=main&asset=website/img/docs/hcp-terraform-logo-on-white.png) and upload it with the "Upload new logo" button or the drag-and-drop target. This optional step helps you identify HCP Terraform's pull request checks at a glance. 1. Click the \*\*Generate a new client secret\*\* button. You will need this secret in the next step. 1. Leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Client ID\*\* and \*\*Client Secret.\*\* ## Step 3: On HCP Terraform, set up your provider 1. Enter the \*\*Client ID\*\* and \*\*Client Secret\*\* from the previous step, as well as an optional \*\*Name\*\* for this VCS connection. 1. Click "Connect and continue." This takes you to a page on GitHub.com, asking whether you want to authorize the app. 1. The authorization page lists any GitHub organizations this account belongs to. If there is a \*\*Request\*\* button next to the organization that owns your Terraform code repositories, click it now. Note that you need to do this even if you are only connecting workspaces or Stacks to private forks of repositories in those organizations since those forks are subject to the organization's access restrictions. See [About OAuth App access restrictions](https://docs.github.com/en/organizations/managing-oauth-access-to-your-organizations-data/about-oauth-app-access-restrictions). 1. Click the green "Authorize ``" button at the bottom of the authorization page. GitHub might request your password or multi-factor token to confirm the operation. ## Step 4: On HCP Terraform, configure advanced settings (optional) The settings in this section are optional. The Advanced Settings you can configure are: - \*\*Scope of VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\* - Most organizations will not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. ### If you don't need to configure advanced settings: 1. Click the \*\*Skip and finish\*\* button. This returns you to HCP Terraform's \*\*VCS Providers\*\* page, which now includes your new GitHub client. ### If you need to limit the scope of this VCS provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ### If you need an SSH keypair: #### Important notes - SSH will only be used to clone Git submodules. All other Git operations will still use HTTPS. - Do not use your personal SSH key to connect HCP Terraform and GitHub; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it when authenticating to GitHub. - \*\*Protect this private key | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github.mdx | main | terraform | [
0.0005528905312530696,
0.06144542247056961,
0.004037976730614901,
-0.0584864467382431,
0.017946461215615273,
-0.004665589891374111,
-0.05211425572633743,
0.0012674586614593863,
-0.026700815185904503,
0.010539481416344643,
-0.028532102704048157,
-0.04417060315608978,
0.06385816633701324,
-0... | 0.041044 |
for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it when authenticating to GitHub. - \*\*Protect this private key carefully.\*\* It can push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to GitHub.com. The exact command depends on your OS, but is usually something like: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. While logged into the GitHub.com account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Step 5: Contact your GitHub organization admins If your organization uses OAuth app access restrictions, you had to click a \*\*Request\*\* button when authorizing HCP Terraform, which sent an automated email to the administrators of your GitHub organization. An administrator must approve the request before HCP Terraform can access your organization's shared repositories. If you're a GitHub administrator, check your email now and respond to the request; otherwise, contact whoever is responsible for GitHub accounts in your organization, and wait for confirmation that they've approved your request. ## Finished At this point, GitHub access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's shared GitHub repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/github.mdx | main | terraform | [
0.019229868426918983,
0.0023422264494001865,
-0.0752880722284317,
-0.05658101662993431,
-0.07641003280878067,
0.02237630821764469,
-0.014070741832256317,
-0.01909523271024227,
0.027143605053424835,
0.06674683094024658,
-0.0074139670468866825,
-0.03489747643470764,
0.06174788251519203,
-0.0... | 0.021895 |
# Set up the GitLab EE and CE VCS provider These instructions are for using an on-premise installation of GitLab Enterprise Edition (EE) or GitLab Community Edition (CE) for HCP Terraform's VCS features. [GitLab.com has separate instructions,](/terraform/cloud-docs/vcs/gitlab-com) as do the [other supported VCS providers.](/terraform/cloud-docs/vcs) Configuring a new VCS provider requires permission to manage VCS settings for the organization. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers Connecting HCP Terraform to your VCS involves four steps: | On your VCS | On HCP Terraform | | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | | Create a new connection in HCP Terraform. Get redirect URI. | | Register your HCP Terraform organization as a new app. Provide redirect URI. Get ID and key. | | | | Provide HCP Terraform with application ID and secret. Request VCS access. | | Approve access request. | | The rest of this page explains the on-premise GitLab versions of these steps. ~> \*\*Important:\*\* HCP Terraform needs to contact your GitLab instance during setup and during normal operation. For the SaaS version of HCP Terraform, this means GitLab must be internet-accessible; for Terraform Enterprise, you must have network connectivity between your Terraform Enterprise and GitLab instances. -> \*\*Note:\*\* Alternately, you can skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see [the OAuth Clients API page](/terraform/cloud-docs/api-docs/oauth-clients). -> \*\*Version Note:\*\* HCP Terraform supports GitLab versions 9.0 and newer. HashiCorp does not test older versions of GitLab with HCP Terraform, and they might not work as expected. Also note that, although we do not deliberately remove support for versions that have reached end of life (per the [GitLab Support End of Life Policy](https://docs.gitlab.com/ee/policy/maintenance.html#patch-releases)), our ability to resolve customer issues with end of life versions might be limited. ## Step 1: On HCP Terraform, Begin Adding a New VCS Provider 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Select \*\*GitLab\*\* and then select \*\*GitLab Enterprise Edition\*\* or \*\*GitLab Community Edition\*\* from the menu. The page moves to the next step. 1. In the "Set up provider" step, fill in the \*\*HTTP URL\*\* and \*\*API URL\*\* of your GitLab Enterprise Edition or GitLab Community Edition instance, as well as an optional \*\*Name\*\* for this VCS connection. Click "Continue." | Field | Value | | -------- | ------------------------------------------- | | HTTP URL | `https://` | | API URL | `https:///api/v4` | Note that HCP Terraform uses GitLab's v4 API. Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: On GitLab, Create a New Application 1. In a new browser tab, open your GitLab instance and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. ~> \*\*Important:\*\* The account you use for connecting HCP Terraform \*\*must have admin (master) access\*\* to any shared repositories of Terraform configurations, since creating webhooks requires admin permissions. Do not create the application as an administrative application not owned by a user; HCP Terraform needs user access to repositories to create webhooks and ingress configurations. ~> \*\*Important\*\*: In GitLab CE or EE 10.6 and up, you may also need to enable \*\*Allow requests to the local network from hooks and services\*\* on the "Outbound requests" section inside the Admin area under Settings (`/admin/application\_settings/network`). Refer | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/gitlab-eece.mdx | main | terraform | [
-0.020168790593743324,
0.0210939422249794,
0.013323885388672352,
-0.043492771685123444,
-0.02884436585009098,
-0.03995158150792122,
-0.03723576292395592,
-0.04421831667423248,
0.03274795040488243,
0.02401736192405224,
-0.024192608892917633,
-0.06725640594959259,
0.0288777407258749,
-0.0121... | 0.011527 |
needs user access to repositories to create webhooks and ingress configurations. ~> \*\*Important\*\*: In GitLab CE or EE 10.6 and up, you may also need to enable \*\*Allow requests to the local network from hooks and services\*\* on the "Outbound requests" section inside the Admin area under Settings (`/admin/application\_settings/network`). Refer to [the GitLab documentation](https://docs.gitlab.com/ee/security/webhooks.html) for details. 1. Navigate to GitLab's "User Settings > Applications" page. This page is located at `https:///profile/applications`. You can also reach it through GitLab's menus: - Click your profile picture and choose "Settings." - Click "Applications." 1. This page has a list of applications and a form for adding new ones. The form has two text fields and some checkboxes. Fill out the fields and checkboxes with the corresponding values currently displayed in your HCP Terraform browser tab. HCP Terraform lists the values in the order they appear, and includes controls for copying values to your clipboard. Fill out the form as follows: | Field | Value | | ----------------------- | ---------------------------------------------- | | Name | HCP Terraform (``) | | Redirect URI | `https://app.terraform.io/` | | Confidential (checkbox) | ✔️ (enabled) | | Expire access tokens (checkbox) | (no longer required) | | Scopes (all checkboxes) | api | -> \*\*Note:\*\* For previous versions of HCP Terraform and GitLab, we recommended disabling a setting called `Expire access tokens`. This action was required because Gitlab marked OAuth tokens as expired after 2 hours, but HCP Terraform only refreshed tokens after 6 hours. This setting does not exist on Gitlab v15+ and HCP Terraform now refreshes tokens more often. 1. Click the "Save application" button, which creates the application and takes you to its page. 1. Leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Application ID\*\* and \*\*Secret.\*\* ## Step 3: On HCP Terraform, Set up Your Provider 1. On the "Configure settings" step on HCP Terraform, enter the \*\*Application ID\*\* and \*\*Secret\*\* from the previous step. 1. Click \*\*Connect and continue.\*\* This takes you to a page on GitLab asking whether you want to authorize the app. Alternatively, if you are redirected to a 500 error, it usually means HCP Terraform was unable to reach your GitLab instance. 1. Click the green \*\*Authorize\*\* button at the bottom of the authorization page. ## Step 4: On HCP Terraform, Configure Advanced Settings (Optional) The settings in this section are optional. The Advanced Settings you can configure are: - \*\*Scope of VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up a PEM formatted SSH Keypair\*\* - Most organizations will not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. ### If You Don't Need to Configure Advanced Settings: 1. Click the \*\*Skip and Finish\*\* button. This returns you to HCP Terraform's VCS Provider page, which now includes your new GitLab client. ### If You Need to Limit the Scope of this VCS Provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/gitlab-eece.mdx | main | terraform | [
-0.07104860246181488,
0.03128761798143387,
-0.045734621584415436,
-0.02106134407222271,
-0.08170945197343826,
-0.12196633219718933,
0.001617639558389783,
-0.022346066311001778,
-0.0004246972384862602,
0.026776442304253578,
-0.021891571581363678,
-0.08581317216157913,
0.10265900939702988,
-... | 0.025671 |
the Scope of this VCS Provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ### If You Do Need a PEM formatted SSH Keypair: #### Important Notes - SSH will only be used to clone Git submodules. All other Git operations will still use HTTPS. - Do not use your personal SSH key to connect HCP Terraform and GitLab; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it when authenticating to GitLab. - \*\*Protect this private key carefully.\*\* It can push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create a PEM formatted SSH keypair that HCP Terraform can use to connect to GitLab. The exact command depends on your OS, but is usually something like: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. While logged into the GitLab account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Finished At this point, GitLab access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's shared repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/gitlab-eece.mdx | main | terraform | [
-0.028948914259672165,
-0.01614544726908207,
0.0037325865123420954,
-0.03357285261154175,
-0.05486177280545235,
0.00611276226118207,
-0.015099101699888706,
-0.016951678320765495,
0.05057419836521149,
0.03511268272995949,
0.012532220222055912,
-0.07120638340711594,
0.10034944862127304,
-0.0... | -0.028242 |
# Connect to VCS Providers HCP Terraform is more powerful when you integrate it with your version control system (VCS) provider. Although you can use many of HCP Terraform's features without one, a VCS connection provides additional features and improved workflows. In particular: - When workspaces are linked to a VCS repository, HCP Terraform can [automatically initiate Terraform runs](/terraform/cloud-docs/workspaces/run/ui) when changes are committed to the specified branch. - When Stacks are linked to a VCS repository, HCP Terraform can [automatically initiate deployment runs](/terraform/cloud-docs/stacks/runs) by fetching configuration changes when they are committed to the specified branch. Note that Stacks do not support mono-repos. - HCP Terraform makes code review easier by [automatically predicting](/terraform/cloud-docs/workspaces/run/ui#speculative-plans-on-pull-requests) how pull requests will affect infrastructure. - Publishing new versions of a [private Terraform module](/terraform/cloud-docs/registry/publish-modules) is as easy as pushing a tag to the module's repository. We recommend configuring VCS access when first setting up an organization, and you might need to add additional VCS providers later depending on how your organization grows. Configuring a new VCS provider requires permission to manage VCS settings for the organization. Refer to [Permissions model](/terraform/cloud-docs/users-teams-organizations/permissions) for more information. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Supported VCS providers You can connect to the following providers. To build custom integrations with other VCS providers for workspaces, refer to [API-driven run workflow](/terraform/cloud-docs/workspaces/run/api): | VCS | IP version | Terraform edition | | --- | --- | --- | | [GitHub.com](/terraform/cloud-docs/vcs/github-app) | IPv4 | HCP Terraform only | | [GitHub App for TFE](/terraform/enterprise/admin/application/github-app-integration) | IPv4 | Terraform Enterprise only | | [GitHub.com (OAuth)](/terraform/cloud-docs/vcs/github) | IPv4 | HCP Terraform Terraform Enterprise | | [GitHub Enterprise](/terraform/cloud-docs/vcs/github-enterprise) | IPv4 | HCP Terraform Terraform Enterprise | | [GitLab.com](/terraform/cloud-docs/vcs/gitlab-com) | IPv4 | HCP Terraform Terraform Enterprise | | [GitLab EE and CE](/terraform/cloud-docs/vcs/gitlab-eece) | IPv4 | HCP Terraform Terraform Enterprise | | [Bitbucket Cloud](/terraform/cloud-docs/vcs/bitbucket-cloud) | IPv4 IPv6 | HCP Terraform Terraform Enterprise | | [Bitbucket Data Center](/terraform/cloud-docs/vcs/bitbucket-data-center) | IPv4 IPv6 | HCP Terraform Terraform Enterprise | | [Azure DevOps Server](/terraform/cloud-docs/vcs/azure-devops-server) | IPv4 | HCP Terraform Terraform Enterprise | | [Azure DevOps Services (OAuth)](/terraform/cloud-docs/vcs/azure-devops-services) | IPv4 | HCP Terraform Terraform Enterprise | | [Azure DevOps Services (PAT)](/terraform/cloud-docs/vcs/azure-devops-services-pat) | IPv4 | HCP Terraform Terraform Enterprise | ## How HCP Terraform uses VCS access Most workspace and Stacks in HCP Terraform are associated with a VCS repository, which provides configuration for creating infrastructure. To find out which repos are available, access their contents, and create webhooks, HCP Terraform needs access to your VCS provider. Although HCP Terraform's API lets you create workspaces and Stacks and push configurations to them without a VCS connection, the primary workflow expects every workspace and Stack to be backed by a repository. To use configurations from VCS, HCP Terraform needs to do several things: - Access a list of repositories, to let you search for repositories. - Register webhooks with your VCS provider, to get notified of new commits to a chosen branch. - Download the contents of a repository at a specific commit in order to run Terraform with that code. ~> \*\*Important:\*\* HCP Terraform usually performs VCS actions using a designated VCS user account, but it has no other knowledge about your VCS's authorization controls and does not associate HCP Terraform user accounts with VCS user accounts. This means HCP Terraform's VCS user might have a different level of access to repositories than any given HCP Terraform user. Keep this in mind when selecting a VCS user, as it may affect your security posture in one or both systems. ### Webhooks HCP Terraform uses webhooks to monitor new commits and pull requests. - When someone adds new commits to a branch, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/index.mdx | main | terraform | [
-0.036998458206653595,
-0.020165279507637024,
0.04084377735853195,
0.0008737402386032045,
-0.02899152785539627,
0.005972294136881828,
-0.08453336358070374,
-0.009200363419950008,
0.044726256281137466,
0.05705104395747185,
-0.021772537380456924,
-0.049750830978155136,
-0.005124696530401707,
... | 0.047886 |
repositories than any given HCP Terraform user. Keep this in mind when selecting a VCS user, as it may affect your security posture in one or both systems. ### Webhooks HCP Terraform uses webhooks to monitor new commits and pull requests. - When someone adds new commits to a branch, any workspaces or Stack based on that branch will begin a run. Usually a user must inspect the plan output and approve an apply, but you can also enable automatic applies. - You can prevent automatic runs for workspaces using locking. A run will only occur if the workspace has not previously processed a run for the commit SHA. - When someone submits a pull request/merge request to a branch, any HCP Terraform workspaces or or Stack based on that branch will perform a [speculative plan](/terraform/cloud-docs/workspaces/run/remote-operations#speculative-plans) with the contents of the request and links to the results on the PR's page. This helps you avoid merging PRs that cause plan failures. ~> \*\*Important:\*\* In Terraform Enterprise, integration with a SaaS VCS provider (GitHub.com, GitLab.com, Bitbucket Cloud, or Azure DevOps Services) requires ingress from the public internet. This lets the inbound web hooks reach Terraform Enterprise. You should also configure appropriate security controls, such as a Web Application Firewall (WAF). ### SSH keys For most supported VCS providers, HCP Terraform does not need an SSH key. This is because Terraform can do everything it needs with the provider's API and an OAuth token. The exceptions are Azure DevOps Server and Bitbucket Data Center, which require an SSH key for downloading repository contents. Refer to the setup instructions for [Azure DevOps Server](/terraform/cloud-docs/vcs/azure-devops-server) and [Bitbucket Data Center](/terraform/cloud-docs/vcs/bitbucket-data-center) for details. For other VCS providers, most organizations will not need to add an SSH private key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. For VCS providers where adding an SSH private key is optional, SSH will only be used to clone Git submodules. All other Git operations will still use HTTPS. If submodules will be cloned via SSH from a private VCS instance, SSH must be running on the standard port 22 on the VCS server. To add an SSH key to a VCS connection, finish configuring OAuth in the organization settings, and then use the "add a private SSH key" link on the VCS Provider settings page to add a private key that has access to the submodule repositories. When setting up a workspace, if submodules are required, select "Include submodules on clone". More at [Workspace settings](/terraform/cloud-docs/workspaces/settings). ### Multiple VCS connections If your infrastructure code is spread across multiple VCS providers, you can configure multiple VCS connections. You can choose which VCS connection to use whenever you create a new workspace or Stack. #### Scoping VCS Connections using projects You can configure which projects can use repositories from a VCS connection. By default each VCS connection is enabled for all workspaces and Stacks in the organization. If you need to limit which projects can use repositories from a given VCS connection, you can change this setting to enable the connection for only workspaces or Stacks in the selected projects. ## Configuring VCS access HCP Terraform uses the OAuth protocol to authenticate with VCS providers. ~> \*\*Important:\*\* Even if you've used OAuth before, read the instructions carefully. Since HCP Terraform's security model treats each \_organization\_ as a separate OAuth application, we authenticate with OAuth's developer workflow, which is more complex than the standard user workflow. The exact steps to authenticate are different for each VCS provider, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/index.mdx | main | terraform | [
-0.055101439356803894,
-0.0049268947914242744,
0.03195461630821228,
-0.01819000206887722,
-0.005891116335988045,
-0.009616690687835217,
-0.06065107136964798,
-0.04896417632699013,
0.07041207700967789,
0.10069939494132996,
-0.023793837055563927,
-0.03819577768445015,
0.004926758352667093,
-... | 0.053408 |
\*\*Important:\*\* Even if you've used OAuth before, read the instructions carefully. Since HCP Terraform's security model treats each \_organization\_ as a separate OAuth application, we authenticate with OAuth's developer workflow, which is more complex than the standard user workflow. The exact steps to authenticate are different for each VCS provider, but they follow this general order: | On your VCS | On HCP Terraform | | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | | Register your HCP Terraform organization as a new app. Get ID and key. | | | | Tell HCP Terraform how to reach VCS, and provide ID and key. Get callback URL. | | Provide callback URL. | | | | Request VCS access. | | Approve access request. | | For complete details, click the link for your VCS provider: - [GitHub](/terraform/cloud-docs/vcs/github) - [GitHub Enterprise](/terraform/cloud-docs/vcs/github-enterprise) - [GitLab.com](/terraform/cloud-docs/vcs/gitlab-com) - [GitLab EE and CE](/terraform/cloud-docs/vcs/gitlab-eece) - [Bitbucket Cloud](/terraform/cloud-docs/vcs/bitbucket-cloud) - [Bitbucket Data Center](/terraform/cloud-docs/vcs/bitbucket-data-center) - [Azure DevOps Server](/terraform/cloud-docs/vcs/azure-devops-server) - [Azure DevOps Services](/terraform/cloud-docs/vcs/azure-devops-services) -> \*\*Note:\*\* Alternatively, you can skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see [the OAuth Clients API page](/terraform/cloud-docs/api-docs/oauth-clients). ### Private VCS You can use self-hosted HCP Terraform Agents to connect HCP Terraform workspaces to your private VCS provider, such as GitHub Enterprise, GitLab Enterprise, and BitBucket Data Center. For more information, refer to [Connect to Private VCS Providers](/terraform/cloud-docs/vcs/private). ## Configure a VCS host for Terraform Enterprise You can configure Terraform Enterprise to be accessible over a primary and a secondary hostname so that you can federate workloads associated with your VCS. Refer to [Specify integration setttings](/terraform/enterprise/deploy/configuration/network#specify-integration-settings) for additional information. You must set up new VCS connections any time you update the VCS host configuration. When the VCS integration uses the secondary hostname, you should continue using it while setting up the new VCS connection. When setup is complete, you can use the primary hostname for all other activities. Refer to [`TFE\_VCS\_HOSTNAME\_CHOICE` ](/terraform/enterprise/deploy/reference/configuration#tfe\_vcs\_hostname\_choice) in the configuration reference for additional information. ## Viewing events The VCS events page is in beta, and only supports GitLab.com connections made after December 2020. VCS events describe changes within your organization for VCS-related actions. The VCS events page only displays events from previously processed commits in the past 30 days. The VCS page indicates previously processed commits with the message, `"Processing skipped for duplicate commit SHA"`. Viewing VCS events requires permission to manage VCS settings for the organization. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers To view VCS events for your organization, go to your organization's settings and click \*\*Events\*\*. The \*\*VCS Events\*\* page appears. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/index.mdx | main | terraform | [
-0.021079203113913536,
0.04416600987315178,
0.025265133008360863,
-0.07540182024240494,
-0.02704184502363205,
-0.01266412902623415,
-0.015042751096189022,
-0.0277814082801342,
0.05140175297856331,
-0.022685308009386063,
-0.03791530057787895,
-0.07239846885204315,
0.06120527908205986,
-0.05... | -0.054035 |
# Set up the Azure DevOps Services VCS provider using personal access tokens These instructions describe how to use a personal access token to connect HCP Terraform to Azure DevOps Services VCS, which is hosted at `dev.azure.com`. Connecting to Azure DevOps Services VCS lets you take advantage of HCP Terraform's VCS features. If you do not intend to use personal access tokens to connect to Azure DevOps Services, refer to [Set up the Azure DevOps Server VCS provider](/terraform/cloud-docs/vcs/azure-devops-server). For information about other supported VCS providers, refer to [Connect to VCS Providers](/terraform/cloud-docs/vcs). ## Requirements Configuring a new VCS provider requires permission to [manage VCS settings](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-vcs-settings) for the organization. To connect HCP Terraform to your repositories, your account must have \*\*Project Collection Administrator\*\* access enabled for all projects containing Terraform configurations. This permission is required to create webhooks because Microsoft doesn't allow you to create custom roles with lower-level access for this purpose. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Personal access token maintenance HCP Terraform uses personal access tokens to connect to Azure DevOps Services. This access method requires some additional configuration and ongoing maintenance: - Personal access tokens have a maximum lifetime of one year. When the token expires, HCP Terraform cannot connect to Azure DevOps Services until the token is replaced. To avoid a gap in service, do one of the following actions before the token expires: - Update the expiration date of the existing token within Azure DevOps Services. - Create a new token and update the VCS configuration in HCP Terraform VCS connection to use it. Refer to the [Azure DevOps documentation](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&view=azure-devops&tabs=Windows) for instructions on working with personal access tokens. ## Step 1: Add a new VCS provider in HCP Terraform 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 1. Select \*\*Azure DevOps\*\* and then select \*\*Azure DevOps Services\*\* from the menu. The page moves to the next step. 1. Select \*\*Configure with Personal Access Token\*\* Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: Create a new personal access token in Azure DevOps Services 1. In a new browser tab, open your Azure DevOps Services instance and log in as whichever account you want HCP Terraform to act as. Many organizations use a dedicated service user but a personal account is acceptable. 1. Navigate to User settings -> Security -> Personal access tokens. 1. Click the \*\*New Token\*\* button to generate a new personal access token with \*\*Code (Read)\*\* and \*\*Code (Status)\*\* scopes. We recommend also granting access to \*\*All accessible organizations\*\* and setting an expiration that meets your requirements. 1. Click \*\*Create\*\*. 1. Copy the generated token to your clipboard so that you can use it in the next step. Leave this page open in a browser tab. ## Step 3: Add the personal access token on HCP Terraform 1. Return to the browser window you opened in [Step 1: Add a new VCS provider in HCP Terraform](#step-1-add-a-new-vcs-provider-in-hcp-terraform). 1. In the second step under \*\*Set up provider\*\*, specify a name for your VCS provider a name in the \*\*Name\*\* field. This field is optional. 1. In the second step under \*\*Set up provider\*\*, paste the Azure DevOps Services personal access token you copied in [step 2](#step-2-create-a-new-personal-access-token-in-azure-devops-services) into the \*\*Personal Access Token\*\* field. 1. Click \*\*Connect and continue\*\*\*\* to continue. ## Step 4: Configure | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services-pat.mdx | main | terraform | [
-0.01330391876399517,
-0.018846450373530388,
0.000847235438413918,
-0.04055863618850708,
-0.04325256869196892,
0.037048134952783585,
0.005857859738171101,
-0.005766781512647867,
0.032610345631837845,
0.08373763412237167,
-0.07665081322193146,
-0.08891024440526962,
0.0388486310839653,
-0.00... | 0.043747 |
provider a name in the \*\*Name\*\* field. This field is optional. 1. In the second step under \*\*Set up provider\*\*, paste the Azure DevOps Services personal access token you copied in [step 2](#step-2-create-a-new-personal-access-token-in-azure-devops-services) into the \*\*Personal Access Token\*\* field. 1. Click \*\*Connect and continue\*\*\*\* to continue. ## Step 4: Configure advanced settings in HCP Terraform (optional) It is optional, but you can configure the following settings in the \*\*Advanced Settings\*\* screen: - In the \*\*Scope of VCS Provider\*\* setting, enable workspaces or Stacks to use repositories from this VCS provider. \*\*All Projects\*\* is enabled by default. This setting lets all workspaces and Stacks in the organization use the VCS provider. - In the \*\*Set up SSH Keypair\*\* setting, you can add or update an SSH key and OAuth credentials so that HCP Terraform can access Git submodules in repositories that require them. You configure these settings later. If you don't need to configure either of the advanced settings, click \*\*Skip and Finish\*\* to complete the setup and return to HCP Terraform's VCS Provider page, which includes your new Azure DevOps Services client. Otherwise, complete the following steps. ### Limit the scope of this VCS provider 1. Enable \*\*Selected Projects\*\* and use the text field that appears to search for and select projects to enable. All current and future workspaces or Stacksfor any selected projects can use repositories from this VCS Provider. 1. Click \*\*Update VCS Provider\*\* to save your selections. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ### Add an SSH key pair HCP Terraform only uses SSH to clone Git submodules and uses HTTPS for all other Git operations. Do not use your personal SSH key to connect HCP Terraform and Azure DevOps Services. You should generate a new key or use an existing key reserved for service access. In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, HCP Terraform retains the key and uses for authenticating with Azure DevOps Services. Follow security best practices and your organization's policies for protecting important credentials when handing and storing a private key. Someone with access to the key can use it to push code to the repositories you use to manage your infrastructure. 1. On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to the Azure DevOps Services domain. The following example uses the `ssh-keygen` command to create a `service\_terraform` file with the private key and a `service\_terraform.pub` file with the public key: ```shell-session $ ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise" ``` The passphrase for the SSH key must be empty. HCP Terraform cannot use SSH keys that require a passphrase. 1. Log into the Azure DevOps Services account you want HCP Terraform to act as and navigate to the \*\*SSH Keys\*\* settings page. 1. Add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Next steps Azure DevOps Services access for HCP Terraform is fully configured. You can create Terraform workspaces or Stacks based on your organization's repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services-pat.mdx | main | terraform | [
-0.01858079619705677,
-0.012307207100093365,
-0.02055370807647705,
-0.007845068350434303,
-0.059427715837955475,
0.023056404665112495,
0.0405648797750473,
-0.055759258568286896,
0.036313191056251526,
0.11023612320423126,
-0.014370085671544075,
-0.1209777370095253,
0.06640653312206268,
0.00... | 0.067296 |
Stacks based on your organization's repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-services-pat.mdx | main | terraform | [
-0.03654342517256737,
-0.12390349805355072,
-0.07639172673225403,
0.00010394978744443506,
-0.02045043185353279,
-0.05232246592640877,
-0.06593845784664154,
0.03530143201351166,
0.011912701651453972,
0.005909539293497801,
0.048730045557022095,
0.04711546376347542,
-0.0488467663526535,
0.033... | 0.184482 |
# Set up the Bitbucket Cloud VCS provider This topic describes how to connect Bitbucket Cloud to HCP Terraform. Bitbucket Cloud is the cloud-hosted version of Bitbucket. For self-hosted Bitbucket Data Center instances, refer to [Configuring Bitbucket Data Center Access](/terraform/cloud-docs/vcs/bitbucket-data-center). Refer to [Connecting VCS Providers to HCP Terraform](/terraform/cloud-docs/vcs) for other supported VCS providers. Configuring a new VCS provider requires permission to manage VCS settings for the organization. ([More about permissions.](/terraform/cloud-docs/users-teams-organizations/permissions)) [permissions-citation]: #intentionally-unused---keep-for-maintainers Connecting HCP Terraform to your VCS involves four steps: | On your VCS | On HCP Terraform | | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | | Create a new connection in HCP Terraform. Get callback URL. | | Register your HCP Terraform organization as a new app. Provide callback URL. Get ID and key. | | | | Provide HCP Terraform with ID and key. Request VCS access. | | Approve access request. | | The rest of this page explains the Bitbucket Cloud-specific versions of these steps. ## Step 1: On HCP Terraform, Begin Adding a New VCS Provider 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 1. Select \*\*Bitbucket\*\* and then select \*\*Bitbucket Cloud\*\* from the menu. The page moves to the next step. Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: On Bitbucket Cloud, Create a New OAuth Consumer 1. In a new browser tab, open [Bitbucket Cloud](https://bitbucket.org) and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. ~> \*\*Important:\*\* The account you use for connecting HCP Terraform \*\*must have admin access\*\* to any shared repositories of Terraform configurations, since creating webhooks requires admin permissions. 1. Navigate to Bitbucket's "Add OAuth Consumer" page. This page is located at `https://bitbucket.org//workspace/settings/oauth-consumers/new`. You can also reach it through Bitbucket's menus: - Click your profile picture and choose the workspace you want to access. - Click "Settings". - Click "OAuth consumers," which is in the "Apps and Features" section. - On the OAuth settings page, click the "Add consumer" button. 1. This page has a form with several text fields and checkboxes. Fill out the fields and checkboxes with the corresponding values currently displayed in your HCP Terraform browser tab. HCP Terraform lists the values in the order they appear, and includes controls for copying values to your clipboard. Fill out the text fields as follows: | Field | Value | | ------------ | ----------------------------------------------------------------------------- | | Name | HCP Terraform (``) | | Description | Any description of your choice. | | Callback URL | `https://app.terraform.io/` | | URL | `https://app.terraform.io` (or the URL of your Terraform Enterprise instance) | Ensure that the "This is a private consumer" option is checked. Then, activate the following permissions checkboxes: | Permission type | Permission level | | --------------- | ---------------- | | Account | Write | | Repositories | Admin | | Pull requests | Write | | Webhooks | Read and write | 1. Click the "Save" button, which returns you to the OAuth settings page. 1. Find your new OAuth consumer under the "OAuth Consumers" heading, and click its name to reveal its details. Leave this page open in a browser tab. In the next step, you will copy and paste the | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-cloud.mdx | main | terraform | [
-0.026528485119342804,
0.005823589861392975,
-0.008289153687655926,
-0.0005930305342189968,
-0.008936723694205284,
-0.008327491581439972,
-0.061543434858322144,
-0.04205741360783577,
0.019822856411337852,
0.08841264992952347,
-0.031038548797369003,
-0.06587152928113937,
0.02811625972390175,
... | -0.047336 |
1. Click the "Save" button, which returns you to the OAuth settings page. 1. Find your new OAuth consumer under the "OAuth Consumers" heading, and click its name to reveal its details. Leave this page open in a browser tab. In the next step, you will copy and paste the unique \*\*Key\*\* and \*\*Secret.\*\* ## Step 3: On HCP Terraform, Set up Your Provider 1. Enter the \*\*Key\*\* and \*\*Secret\*\* from the previous step, as well as an optional \*\*Name\*\* for this VCS connection. 1. Click "Connect and continue." This takes you to a page on Bitbucket Cloud asking whether you want to authorize the app. 1. Click the blue "Grant access" button to proceed. ## Step 4: On HCP Terraform, Configure Advanced Settings (Optional) The settings in this section are optional. The Advanced Settings you can configure are: - \*\*Scope of VCS Provider\*\* - You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. - \*\*Set up SSH Keypair\*\* - Most organizations will not need to add an SSH key. However, if the organization repositories include Git submodules that can only be accessed via SSH, an SSH key can be added along with the OAuth credentials. You can add or update the SSH key at a later time. ### If You Don't Need to Configure Advanced Settings: 1. Click the \*\*Skip and Finish\*\* button. This returns you to HCP Terraform's VCS Provider page, which now includes your new Bitbucket Cloud client. ### If You Need to Limit the Scope of this VCS Provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ### If You Do Need an SSH Keypair: #### Important Notes - SSH will only be used to clone Git submodules. All other Git operations will still use HTTPS. - Do not use your personal SSH key to connect HCP Terraform and Bitbucket Cloud; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it when authenticating to Bitbucket Cloud. - \*\*Protect this private key carefully.\*\* It can push code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. 1. On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to Bitbucket Cloud. The exact command depends on your OS, but is usually something like: `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"` This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase\*\*. HCP Terraform cannot use SSH keys that require a passphrase. 1. While logged into the Bitbucket Cloud account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-cloud.mdx | main | terraform | [
-0.044573742896318436,
0.03162364661693573,
-0.0034426364582031965,
-0.015548406168818474,
-0.0076164728961884975,
-0.01267895009368658,
-0.014774896204471588,
-0.006579377222806215,
0.0431811697781086,
0.05179489776492119,
-0.02675572596490383,
-0.08365849405527115,
0.09094978123903275,
-... | -0.089366 |
account you want HCP Terraform to act as, navigate to the SSH Keys settings page, add a new SSH key and paste the value of the SSH public key you just created. 1. In HCP Terraform's \*\*Add VCS Provider\*\* page, paste the text of the \*\*SSH private key\*\* you just created, and click the \*\*Add SSH Key\*\* button. ## Finished At this point, Bitbucket Cloud access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's shared repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-cloud.mdx | main | terraform | [
0.01836523972451687,
-0.020311657339334488,
-0.014817570336163044,
-0.027323275804519653,
-0.0742049589753151,
0.04065718874335289,
-0.052962806075811386,
-0.034591998904943466,
-0.01185113750398159,
0.08402133733034134,
-0.0020843700040131807,
-0.09512395411729813,
0.06418030709028244,
-0... | -0.017986 |
# Set up the Bitbucket Data Center VCS provider This topic describes how to connect Bitbucket Data Center to HCP Terraform. For instructions on how to connect Bitbucket Cloud, refer to [Configuring Bitbucket Cloud Access](/terraform/cloud-docs/vcs/bitbucket-cloud). Refer to [Connecting VCS Providers to HCP Terraform](/terraform/cloud-docs/vcs) for other supported VCS providers. \*\*Bitbucket Server is deprecated\*\*. Atlassian ended support for Bitbucket Server on February 15, 2024, and recommends using either Bitbucket Data Center (v8.0 or newer) or Bitbucket Cloud instead. Refer to the [Atlassian documentation](https://bitbucket.org/blog/cloud-migration-benefits) for additional information. HCP Terraform will end support Bitbucket Server on August 15, 2024. Terraform Enterprise will also end support for Bitbucket Server in Terraform Enterprise v202410. [Contact HashiCorp support](https://support.hashicorp.com/hc/en-us) if you have any questions regarding this change. ## Overview The following steps provide an overview of how to connect HCP Terraform and Terraform Enterprise to Bitbucket Data Center: 1. Add a new VCS provider to HCP Terraform or Enterprise. 1. Create a new application link in Bitbucket. 1. Create an SSH key pair. SSH keys must have an empty passphrase because HCP Terraform cannot use SSH keys that require a passphrase. 1. Add an SSH key to Bitbucket. You must complete this step as a non-administrator user in Bitbucket. 1. Add the private SSH key to Terraform. ## Requirements - You must have permission to manage VCS settings for the organization. Refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions) for additional information. [permissions-citation]:#intentionally-unused---keep-for-maintainers - You must have OAuth authentication credentials for Bitbucket Data Center. - Your instance of Bitbucket Data Center must be internet-accessible on its SSH and HTTP(S) ports. This is because HCP Terraform must be able to contact Bitbucket Data Center over both SSH and HTTP or HTTPS during setup and during normal operation. - HCP Terraform must have network connectivity to Bitbucket Data Center instances. Note that [Bitbucket Data Center's default ports](https://confluence.atlassian.com/bitbucketserverkb/which-ports-does-bitbucket-server-listen-on-and-what-are-they-used-for-806029586.html) are `7999` for SSH and `7990` for HTTP. Check your configuration to confirm your BitBucket instance's real ports. ## Add a new VCS provider to Terraform 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 1. Choose \*\*Bitbucket Data Center\*\* from the \*\*Bitbucket\*\* drop-down menu. 1. (Optional) Enter a \*\*Name\*\* for this VCS connection. 1. Specify the URL of your Bitbucket Data Center instance in the \*\*HTTP URL\*\* and \*\*API URL\*\* fields. If the context path is not set for your Bitbucket Data Center instance, the \*\*API URL\*\* is the same as the \*\*HTTP URL\*\*. Refer to the [Atlassian documentation](https://confluence.atlassian.com/bitbucketserver/moving-bitbucket-server-to-a-different-context-path-776640153.html) for additional information. Specify the following values if the context path is set for your Bitbucket Data Center instance: - Set the \*\*HTTP URL\*\* field to your Bitbucket Data Center instance URL and add the context path: `https:///`. - Set the \*\*API URL\*\* field to your Bitbucket Data Center instance URL: `https://`. By default, HCP Terraform uses port `80` for HTTP and `443` for HTTPS. If Bitbucket Data Center is configured to use non-standard ports or is behind a reverse proxy, you may need to include the port number in the URL. 1. You can either generate new consumer and public keys that you can use to create a new application link in Bitbucket Data Center described in [Create an application link](#create-an-application-link) or use keys from an existing application link: - To generate new keys, click \*\*Continue\*\*. Do not leave this screen until you have copied the key values. - To use existing keys, enable the \*\*Use Custom Keys\*\* option and enter them into the fields. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-data-center.mdx | main | terraform | [
-0.04416334256529808,
-0.027377702295780182,
0.014612273313105106,
-0.014386466704308987,
-0.04313958063721657,
0.020534111186861992,
-0.09034889191389084,
-0.033685386180877686,
-0.0033984528854489326,
0.08486950397491455,
-0.02568858303129673,
-0.04250270873308182,
0.027740569785237312,
... | -0.03351 |
described in [Create an application link](#create-an-application-link) or use keys from an existing application link: - To generate new keys, click \*\*Continue\*\*. Do not leave this screen until you have copied the key values. - To use existing keys, enable the \*\*Use Custom Keys\*\* option and enter them into the fields. ## Create an application link 1. Log into Bitbucket Data Center as an admin. 1. Open the \*\*Application Links\*\* administration page using the navigation or by entering `https:///plugins/servlet/applinks/listApplicationLinks` in your browser's address bar. 1. Click \*\*Application Links\*\* in the sidebar, then click \*\*Create new link\*\*. 1. Choose \*\*Atlassian product via OAuth 1.0\*\* in the \*\*Application type\*\* section. 1. Enter `https://app.terraform.io` or the hostname of your Terraform Enterprise instance when prompted. You can only specify the main URL once. To connect multiple HCP Terraform organizations to the same Bitbucket Data Center instance, enter the organization URL when creating the link instead. The organization URL is the HCP Terraform URL or Terraform Enterprise hostname appended with `/app/`. 1. When prompted, confirm that you wish to use the URL as entered. If you specified HCP Terraform's main URL, click \*\*Continue\*\*. If you specified an organization URL, enable the \*\*Use this URL\*\* option and then click \*\*Continue\*\*. 1. In the \*\*Link applications\*\* dialog, configure the following settings: - Specify `HCP Terraform ` in the \*\*Application Name\*\* field - Choose \*\*Generic Application\*\* from the \*\*Application Type\*\* drop-down menu - Enable the \*\*Create incoming link\*\* option Leave all the other fields empty. 1. Click \*\*Continue\*\*. The \*\*Link applications\*\* screen progresses to the second configuration screen. 1. In the \*\*Consumer Key\*\* and \*\*Public Key\*\* fields, enter the key values you created in the [Add a new VCS provider to Terraform](#add-a-new-vcs-provider-to-terraform) instructions. 1. In the \*\*Consumer Name\*\* field, enter `HCP Terraform ()`. 1. Click \*\*Continue\*\*. Bitbucket prompts you to authorize Terraform to make changes. Before you proceed, verify that you are logged in with the user account that HCP Terraform will use to access Bitbucket and not as a Bitbucket administrator. If Bitbucket returns a 500 error instead of the authorization screen, Terraform may have been unable to reach your Bitbucket Data Center instance. 1. Click \*\*Allow\*\* and enter the SSH key when prompted. ## Create an SSH key for Terraform On a secure workstation, create an SSH keypair that HCP Terraform or Terraform Enterprise can use to connect to Bitbucket Data Center. The command for generating SSH keys depends on your OS. The following example for Linux creates a `service\_terraform` file with the private key and a `service\_terraform.pub` file with the public key: ```shell-session $ ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise" ``` Do not specify a passphrase because Terraform cannot use SSH keys that require a passphrase. ## Add an SSH key to Bitbucket In the following steps, you must provide HCP Terraform with the private SSH key you created in [Create an SSH key for Terraform](#create-an-ssh-key-for-terraform). Although HCP Terraform does not display the text of the key to users after it is entered, it retains the key and uses it for authenticating to Bitbucket Data Center. 1. If you are logged into Bitbucket Data Center as an administrator, log out before proceeding. 1. Log in with the Bitbucket account that you want to use for HCP Terraform or Terraform Enterprise. Many organizations use a dedicated service user account for this purpose. Because creating webhooks requires admin permissions, the account must have admin access to any shared repositories of Terraform configurations. Refer to [Requirements](#requirements) for more information. 1. Open the \*\*SSH keys\*\* page and click the profile icon. 1. Choose \*\*Manage account\*\*. 1. Click | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-data-center.mdx | main | terraform | [
-0.07605278491973877,
-0.05565543472766876,
-0.08972332626581192,
-0.019887272268533707,
0.015821874141693115,
-0.025310441851615906,
0.0197703056037426,
0.06895279884338379,
0.048648666590452194,
0.08021952956914902,
0.023475537076592445,
-0.01145273819565773,
0.062271323055028915,
-0.051... | -0.038251 |
a dedicated service user account for this purpose. Because creating webhooks requires admin permissions, the account must have admin access to any shared repositories of Terraform configurations. Refer to [Requirements](#requirements) for more information. 1. Open the \*\*SSH keys\*\* page and click the profile icon. 1. Choose \*\*Manage account\*\*. 1. Click \*\*SSH keys\*\* or enter `https:///plugins/servlet/ssh/account/keys` in the address bar to go to the \*\*SSH keys\*\* screen. 1. Click \*\*Add key\*\* and enter the SSH public key you created in [Create an SSH key for Terraform](#create-an-ssh-key-for-terraform) into the text field. Open the `.pub` file to get the key value. 1. Click \*\*Add key\*\* to finish adding the key. ## Add an SSH private key Complete the following steps in HCP Terraform or Terraform Enterprise to request access to Bitbucket and add the SSH private key. 1. Open the \*\*SSH keys\*\* settings page and click \*\*Add a private SSH key\*\*. A large text field appears. 1. Enter the text of the \*\*SSH private key\*\* you created in [Create an SSH key for Terraform](#create-an-ssh-key-for-terraform) and click \*\*Add SSH Key\*\*. ## Next steps After completing these instructions, you can create Terraform workspaces or Stacks based on your organization's shared repositories. Refer to the following resources for additional guidance: - [Creating Workspaces](/terraform/cloud-docs/workspaces/create) in HCP Terraform - [Creating Workspaces](/terraform/enterprise/workspaces/create) in Terraform Enterprise | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/bitbucket-data-center.mdx | main | terraform | [
-0.022127773612737656,
0.01802070438861847,
-0.07132475823163986,
-0.04610375687479973,
-0.07142633199691772,
-0.03481333702802658,
-0.03947959467768669,
-0.03000548481941223,
0.016590280458331108,
0.11019774526357651,
-0.020488543435931206,
-0.12093286216259003,
0.05336194485425949,
-0.02... | 0.031567 |
# Set up the Azure DevOps Server VCS provider These instructions describe how to connect to on-premise installations of Azure DevOps Server so that you can use HCP Terraform's VCS features. For instructions on how to set up Azure DevOps Services using OAuth, refer to [Set up the Azure DevOps Services VCS provider using OAuth](/terraform/cloud-docs/vcs/azure-devops-services). For information about other supported VCS providers, refer to [Connect to VCS Providers](/terraform/cloud-docs/vcs). ## Requirements You must have permission to manage VCS settings for the organization to configure a new VCS provider. Refer to [Permission model](/terraform/cloud-docs/users-teams-organizations/permissions) for additional information about permissions. [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Personal access token maintenance HCP Terraform uses personal access tokens to connect to Azure DevOps Server. This access method requires some additional configuration and ongoing maintenance: - [IIS Basic Authentication must be disabled](https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/iis-basic-auth?view=azure-devops) on your Azure DevOps Server instance in order to use personal access tokens. - Personal access tokens eventually expire, with a maximum allowed lifetime of one year. If HCP Terraform's token expires, it will be unable to connect to Azure DevOps Server until the token is replaced. To avoid a gap in service, do one of the following before the token expires: - Update the expiration date of the existing token within Azure DevOps Server. - Create a new token, and edit HCP Terraform's VCS connection to use it. ## Step 1: On HCP Terraform, Begin Adding a New VCS Provider 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS provider. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add VCS Provider\*\*. The \*\*VCS Providers\*\* page appears. 1. Select \*\*Azure DevOps\*\* and then select \*\*Azure DevOps Server\*\* from the menu. The page moves to the next step. 1. On the "Set up provider" step there are three textboxes. Enter an optional \*\*Name\*\* for this VCS connection. Enter the instance URL for your Azure DevOps Server in \*\*HTTP URL\*\* and \*\*API URL\*\* textboxes. Click the "Continue" button to continue to the next step. Leave the page open in a browser tab. In the next step you will copy values from this page, and in later steps you will continue configuring HCP Terraform. ## Step 2: On Azure DevOps Server, Create a New Personal Access Token 1. In a new browser tab, open your Azure DevOps Server instance and log in as whichever account you want HCP Terraform to act as. For most organizations this should be a dedicated service user, but a personal account will also work. ~> \*\*Important:\*\* The account you use for connecting HCP Terraform \*\*must have Project Collection Administrator access\*\* to any projects containing repositories of Terraform configurations, since creating webhooks requires these permissions. It is not possible to create custom access roles with lower levels of privilege, as Microsoft does not currently allow delegation of this capability. 1. Navigate to User settings -> Security -> Personal access tokens. 1. Click the \*\*New Token\*\* button to generate a new personal access token with "Code (Read)" and "Code (Status)" scopes. (We recommend also granting access to "All accessible organizations.") 1. Copy the generated token to your clipboard; you'll paste it in the next step. Leave this page open in a browser tab. ## Step 3: Add the Personal Access Token on HCP Terraform 1. On the "Configure settings" step there is one textbox. Enter your Azure DevOps Server \*\*Personal Access Token\*\* from Step 2. Click the "Continue" button to continue to the next step. ## Step 4: Configure VCS Provider Scope on HCP Terraform (Optional) This step is optional. You can configure | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-server.mdx | main | terraform | [
-0.017402980476617813,
0.006655454635620117,
-0.0013589723967015743,
-0.030002223327755928,
-0.020068490877747536,
0.011345542035996914,
-0.02894885651767254,
-0.03655419871211052,
0.042069707065820694,
0.0894387736916542,
-0.06670324504375458,
-0.048730138689279556,
0.0221718642860651,
0.... | 0.02608 |
Terraform 1. On the "Configure settings" step there is one textbox. Enter your Azure DevOps Server \*\*Personal Access Token\*\* from Step 2. Click the "Continue" button to continue to the next step. ## Step 4: Configure VCS Provider Scope on HCP Terraform (Optional) This step is optional. You can configure which workspaces or Stacks can use repositories from this VCS provider. By default the \*\*All Projects\*\* option is selected, meaning this VCS provider is available to be used by all workspaces and Stacks in the organization. To limit the scope of this VCS Provider: 1. Select the \*\*Selected Projects\*\* option and use the text field that appears to search for and select projects to enable. All current and future workspaces and Stacks for any selected projects can use repositories from this VCS Provider. 1. Click the \*\*Update VCS Provider\*\* button to save your selections. ## Step 5: On Workstation, Create an SSH Key for HCP Terraform On a secure workstation, create an SSH keypair that HCP Terraform can use to connect to Azure DevOps Server. The exact command depends on your OS, but is usually something like `ssh-keygen -t rsa -m PEM -f "/Users//.ssh/service\_terraform" -C "service\_terraform\_enterprise"`. This creates a `service\_terraform` file with the private key, and a `service\_terraform.pub` file with the public key. This SSH key \*\*must have an empty passphrase.\*\* HCP Terraform cannot use SSH keys that require a passphrase. ### Important Notes - Do not use your personal SSH key to connect HCP Terraform and Azure DevOps Server; generate a new one or use an existing key reserved for service access. - In the following steps, you must provide HCP Terraform with the private key. Although HCP Terraform does not display the text of the key to users after it is entered, it retains it and will use it for authenticating to Azure DevOps Server. - \*\*Protect this private key carefully.\*\* It can read code to the repositories you use to manage your infrastructure. Take note of your organization's policies for protecting important credentials and be sure to follow them. ## Step 6: On Azure Devops Server, Add SSH Public Key 1. Navigate to User settings -> Security -> SSH public keys on your Azure DevOps Server instance.  1. Click the \*\*Add\*\* button. Paste the text of the \*\*SSH public key\*\* you created in step 3 (from the `.pub` file) into the text field, then click the \*\*Add key\*\* button to confirm. ## Step 7: On HCP Terraform, Add SSH Private Key 1. Go back to your HCP Terraform browser tab and paste the text of the \*\*SSH private key\*\* you created in step 3 into the \*\*Private SSH Key\*\* text field of the "Set up SSH keypair" step. Click the "Add SSH key" button. ## Finished At this point, Azure DevOps Server access for HCP Terraform is fully configured, and you can create Terraform workspaces or Stacks based on your organization's repositories. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/azure-devops-server.mdx | main | terraform | [
-0.006802915595471859,
-0.03406898304820061,
-0.005383966490626335,
-0.005775206722319126,
-0.037894148379564285,
0.04337695240974426,
-0.012314185500144958,
-0.08092944324016571,
0.06472816318273544,
0.10601034760475159,
-0.04337337985634804,
-0.08078280836343765,
0.03511406481266022,
0.0... | 0.047004 |
# Troubleshoot VCS providers This page collects solutions to the most common problems our users encounter with VCS integration in HCP Terraform. ## Azure DevOps ### Required status checks not sending When configuring [status checks with Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/repos/git/pr-status-policy) the web interface may auto populate Genre and Name fields (beneath "Status to check") with incorrect values that do not reflect what HCP Terraform is sending. To function correctly as required checks the Genre must be populated with "Terraform Cloud" (or the first segment for a Terraform Enterprise install), and the remainder of the status check goes in the Name field. This requires using the "Enter genre/name separately" checkbox to not use the default configuration. In the example below the status check is named `Terraform Cloud/paul-hcp/gianni-test-1` and needs to be configured with Genre `Terraform Cloud` and Name `paul-hcp/gianni-test-1`.  With an older version of Azure DevOps Server it may be that the web interface does not allow entering the Genre and Name separately. In which case the status check will need to be created via the [API](https://learn.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/create). ## Bitbucket Data Center The following errors are specific to Bitbucket Data Center integrations. ### Clicking "Connect organization ``" with Bitbucket Data Center raises an error message in HCP Terraform HCP Terraform uses OAuth 1 to authenticate the user to Bitbucket Data Center. The first step in the authentication process is for HCP Terraform to call Bitbucket Data Center to obtain a request token. After the call completes, HCP Terraform redirects you to Bitbucket Data Center with the request token. An error occurs when HCP Terraform calls to Bitbucket Data Center to obtain the request token but the request is rejected. Some common reasons for the request to be rejected are: - The API endpoint is unreachable; this can happen if the address or port is incorrect or the domain name doesn't resolve. - The certificate used on Bitbucket Data Center is rejected by the HCP Terraform HTTP client because the SSL verification fails. This is often the case with self-signed certificates or when the Terraform Enterprise instance is not configured to trust the signing chain of the Bitbucket Data Center SSL certificate. To fix this issue, do the following: - Verify that the instance running Terraform Enterprise can resolve the domain name and can reach Bitbucket Data Center. - Verify that the HCP Terraform client accepts the HTTPS connection to Bitbucket Data Center. This can be done by performing a `curl` from the Terraform Enterprise instance to Bitbucket Data Center; it should not return any SSL errors. - Verify that the Consumer Key, Consumer Name, and the Public Key are configured properly in Bitbucket Data Center. - Verify that the HTTP URL and API URL in HCP Terraform are correct for your Bitbucket Data Center instance. This includes the proper scheme (HTTP vs HTTPS), as well as the port. ### Creating a workspace from a repository hangs indefinitely, displaying a spinner on the confirm button If you were able to connect HCP Terraform to Bitbucket Data Center but cannot create workspaces, it often means HCP Terraform isn't able to automatically add webhook URLs for that repository. To fix this issue: - Make sure you haven't manually entered any webhook URLs for the affected repository or project. Although the Bitbucket Web Post Hooks Plugin documentation describes how to manually enter a hook URL, HCP Terraform handles this automatically. Manually entered URLs can interfere with HCP Terraform's operation. To check the hook URLs for a repository, go to the repository's settings, then go to the "Hooks" page (in the | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/troubleshooting.mdx | main | terraform | [
0.015184370800852776,
-0.0009333566413260996,
0.007036352995783091,
-0.023027872666716576,
-0.01904895529150963,
0.006625351961702108,
0.03987870737910271,
-0.15073595941066742,
0.031672801822423935,
0.07035091519355774,
-0.004180545918643475,
-0.1285148710012436,
0.05722746625542641,
-0.0... | 0.021601 |
the Bitbucket Web Post Hooks Plugin documentation describes how to manually enter a hook URL, HCP Terraform handles this automatically. Manually entered URLs can interfere with HCP Terraform's operation. To check the hook URLs for a repository, go to the repository's settings, then go to the "Hooks" page (in the "Workflow" section) and click on the "Post-Receive WebHooks" link. Also note that some Bitbucket Data Center versions might allow you to set per-project or server-wide hook URLs in addition to per-repository hooks. These should all be empty; if you set a hook URL that might affect more than one repo when installing the plugin, go back and delete it. - Make sure you aren't trying to connect too many workspaces to a single repository. Bitbucket Data Center's webhooks plugin can only attach five hooks to a given repo. You might need to create additional repositories if you need to make more than five workspaces from a single configuration repo. ## Bitbucket Cloud ### HCP Terraform fails to obtain repositories This typically happens when the HCP Terraform application in Bitbucket Cloud wasn't configured to have the full set of permissions. Go to the OAuth section of the Bitbucket settings, find your HCP Terraform OAuth consumer, click the edit link in the "..." menu, and ensure it has the required permissions enabled: | Permission type | Permission level | | --------------- | ---------------- | | Account | Write | | Repositories | Admin | | Pull requests | Write | | Webhooks | Read and write | ## GitHub ### "Host key verification failed" error in `terraform init` when attempting to ingress Terraform modules via Git over SSH This is most common when running Terraform 0.10.3 or 0.10.4, which had a bug in handling SSH submodule ingress. Try upgrading affected HCP Terraform workspaces to the latest Terraform version or 0.10.8 (the latest in the 0.10 series). ### HCP Terraform can't ingress Git submodules, with auth errors during init This usually happens when an SSH key isn't associated with the VCS provider's OAuth client. - Go to your organization's "VCS Provider" settings page and check your GitHub client. If it still says "You can add a private SSH key to this connection to be used for git clone operations" (instead of "A private SSH key has been added..."), you need to click the "add a private SSH key" link and add a key. - Check the settings page for affected workspaces and ensure that "Include submodules on clone" is enabled. Note that the "SSH Key" section in a workspace's settings is only used for mid-run operations like cloning Terraform modules. It isn't used when cloning the linked repository before a run. ## General The following errors may occur for all VCS providers except Bitbucket Data Center. ### HCP Terraform returns 500 after authenticating with the VCS provider The Callback URL in the OAuth application configuration in the VCS provider probably wasn't updated in the last step of the instructions and still points to the default "/" path (or an example.com link) instead of the full callback url. The fix is to update the callback URL in your VCS provider's application settings. You can look up the real callback URL in HCP Terraform's settings. ### Can't delete a workspace or module, resulting in 500 errors This often happens when the VCS connection has been somehow broken: it might have had permissions revoked, been reconfigured, or had the repository removed. Check for these possibilities and contact HashiCorp support for further assistance, including any information you collected in your support ticket. ### `redirect\_uri\_mismatch` error on "Connect" | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/troubleshooting.mdx | main | terraform | [
-0.07239604741334915,
-0.04355493560433388,
-0.009006028063595295,
0.004178707953542471,
-0.055864471942186356,
-0.04656868427991867,
-0.05807671695947647,
-0.07640372961759567,
0.010230437852442265,
0.10406861454248428,
-0.01255726721137762,
-0.08750798553228378,
0.028607986867427826,
-0.... | -0.022601 |
errors This often happens when the VCS connection has been somehow broken: it might have had permissions revoked, been reconfigured, or had the repository removed. Check for these possibilities and contact HashiCorp support for further assistance, including any information you collected in your support ticket. ### `redirect\_uri\_mismatch` error on "Connect" The domain name for HCP Terraform's SaaS release changed on 02/22 at 9AM from `atlas.hashicorp.com` to `app.terraform.io`. If the OAuth client was originally configured on the old domain, using it for a new VCS connection can result in this error. The fix is to update the OAuth Callback URL in your VCS provider to use app.terraform.io instead of atlas.hashicorp.com. ### Can't trigger workspace runs from VCS webhook A workspace with no runs will not accept new runs from a VCS webhook. You must queue at least one run manually. A workspace will not process a webhook if the workspace previously processed a webhook with the same commit SHA and created a run. To trigger a run, create a new commit. If a workspace receives a webhook with a previously processed commit, HCP Terraform adds a new event to the [VCS Events](/terraform/cloud-docs/vcs#viewing-events) page documenting the received webhook. ### Changing the URL for a VCS provider On rare occasions, you might need HCP Terraform to change the URL it uses to reach your VCS provider. This usually only happens if you move your VCS server or the VCS vendor changes their supported API versions. HCP Terraform does not allow you to change the API URL for an existing VCS connection, but you can create a new VCS connection and update existing resources to use it. This is most efficient if you script the necessary updates using HCP Terraform's API. In brief: 1. [Configure a new VCS connection](/terraform/cloud-docs/vcs) with the updated URL. 1. Obtain the [oauth-token IDs](/terraform/cloud-docs/api-docs/oauth-tokens) for the old and new OAuth clients. 1. [List all workspaces](/terraform/cloud-docs/api-docs/workspaces#list-workspaces) (dealing with pagination if necessary), and use a JSON filtering tool like `jq` to make a list of all workspace IDs whose `attributes.vcs-repo.oauth-token-id` matches the old VCS connection. 1. Iterate over the list of workspaces and [PATCH each one](/terraform/cloud-docs/api-docs/workspaces#update-a-workspace) to use the new `oauth-token-id`. 1. [List all registry modules](/terraform/registry/api-docs#list-modules) and use their `source` property to determine which ones came from the old VCS connection. 1. [Delete each affected module](/terraform/cloud-docs/api-docs/private-registry/modules#delete-a-module), then [create a new module](/terraform/cloud-docs/api-docs/private-registry/modules#publish-a-private-module-from-a-vcs) from the new connection's version of the relevant repo. 1. Delete the old VCS connection. ### Reauthorizing VCS OAuth Providers If a VCS OAuth connection breaks, you can reauthorize an existing VCS provider while retaining any VCS connected resources, like workspaces. We recommend only using this feature to fix broken VCS connections. We also recommend reauthorizing using the same VCS account to avoid permission changes to your repositories. ~> \*\*Important:\*\* Reauthorizing is not available when the [TFE Provider](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/oauth\_client) is managing the OAuth Client. Instead, you can update the [oauth\_token](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/oauth\_client#oauth\_token) argument with a new token from your VCS Provider. To reauthorize a VCS connection, complete the following steps: 1. Go to your organization's settings and click \*\*Providers\*\* under \*\*Version Control\*\*. 1. Click \*\*Reauthorize\*\* in the \*\*OAuth Token ID\*\* column. 1. Confirm the reauthorization. HCP Terraform redirects you to your VCS Provider where you can reauthorize the connection. ## Certificate Errors on Terraform Enterprise When debugging failures of VCS connections due to certificate errors, running additional diagnostics using the OpenSSL command may provide more information about the failure. First, attach a bash session to the application container: ``` docker exec -it ptfe\_atlas sh -c "stty rows 50 && stty cols 150 && bash" ``` Then run the `openssl s\_client` command, using the certificate | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/troubleshooting.mdx | main | terraform | [
-0.014173411764204502,
0.0073570371605455875,
0.0013297904515638947,
-0.06499762088060379,
-0.019707804545760155,
-0.08150045573711395,
-0.09781817346811295,
-0.05509471520781517,
0.057216204702854156,
0.03512614592909813,
-0.009703834541141987,
-0.05476390942931175,
0.028197528794407845,
... | -0.021827 |
errors, running additional diagnostics using the OpenSSL command may provide more information about the failure. First, attach a bash session to the application container: ``` docker exec -it ptfe\_atlas sh -c "stty rows 50 && stty cols 150 && bash" ``` Then run the `openssl s\_client` command, using the certificate at `/tmp/cust-ca-certificates.crt` in the container: ``` openssl s\_client -showcerts -CAfile /tmp/cust-ca-certificates.crt -connect git-server-hostname:443 ``` For example, a Gitlab server that uses a self-signed certificate might result in an error like `verify error:num=18:self signed certificate`, as shown in the output below: ``` bash-4.3# openssl s\_client -showcerts -CAfile /tmp/cust-ca-certificates.crt -connect gitlab.local:443 CONNECTED(00000003) depth=0 CN = gitlab.local verify error:num=18:self signed certificate verify return:1 depth=0 CN = gitlab.local verify return:1 --- Certificate chain 0 s:/CN=gitlab.local i:/CN=gitlab.local -----BEGIN CERTIFICATE----- MIIC/DCCAeSgAwIBAgIJAIhG2GWtcj7lMA0GCSqGSIb3DQEBCwUAMCAxHjAcBgNV BAMMFWdpdGxhYi1sb2NhbC5oYXNoaS5jbzAeFw0xODA2MDQyMjAwMDhaFw0xOTA2 MDQyMjAwMDhaMCAxHjAcBgNVBAMMFWdpdGxhYi1sb2NhbC5oYXNoaS5jbzCCASIw DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMMgrpo3zsoy2BP/AoGIgrYwEMnj PwSOFGNHbclmiVBCW9jvrZrtva8Qh+twU7CSQdkeSP34ZgLrRp1msmLvUuVMgPts i7isrI5hug/IHLLOGO5xMvxOcrHknvySYJRmvYFriEBPNRPYJGJ9O1ZUVUYeNwW/ l9eegBDpJrdsjGmFKCOzZEdUA3zu7PfNgf788uIi4UkVXZNa/OFHsZi63OYyfOc2 Zm0/vRKOn17dewOOesHhw77yYbBH8OFsEiC10JCe5y3MD9yrhV1h9Z4niK8rHPXz XEh3JfV+BBArodmDbvi4UtT+IGdDueUllXv7kbwqvQ67OFmmek0GZOY7ZvMCAwEA AaM5MDcwIAYDVR0RBBkwF4IVZ2l0bGFiLWxvY2FsLmhhc2hpLmNvMBMGA1UdJQQM MAoGCCsGAQUFBwMBMA0GCSqGSIb3DQEBCwUAA4IBAQCfkukNV/9vCA/8qoEbPt1M mvf2FHyUD69p/Gq/04IhGty3sno4eVcwWEc5EvfNt8vv1FykFQ6zMJuWA0jL9x2s LbC8yuRDnsAlukSBvyazCZ9pt3qseGOLskaVCeOqG3b+hJqikZihFUD95IvWNFQs RpvGvnA/AH2Lqqeyk2ITtLYj1AcSB1hBSnG/0fdtao9zs0JQsrS59CD1lbbTPPRN orbKtVTWF2JlJxl2watfCNTw6nTCPI+51CYd687T3MuRN7LsTgglzP4xazuNjbWB QGAiQRd6aKj+xAJnqjzXt9wl6a493m8aNkyWrxZGHfIA1W70RtMqIC/554flZ4ia -----END CERTIFICATE----- --- Server certificate subject=/CN=gitlab.local issuer=/CN=gitlab.local --- No client certificate CA names sent Peer signing digest: SHA512 Server Temp Key: ECDH, P-256, 256 bits --- SSL handshake has read 1443 bytes and written 433 bytes --- New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384 Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : ECDHE-RSA-AES256-GCM-SHA384 Session-ID: AF5286FB7C7725D377B4A5F556DEB6DDC38B302153DDAE90C552ACB5DC4D86B8 Session-ID-ctx: Master-Key: DB75AEC12C6E7B62246C653C8CB8FC3B90DE86886D68CB09898A6A6F5D539007F7760BC25EC4563A893D34ABCFAAC28A Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None TLS session ticket lifetime hint: 300 (seconds) TLS session ticket: 0000 - 03 c1 35 c4 ff 6d 24 a8-6c 70 61 fb 2c dc 2e b8 ..5..m$.lpa.,... 0010 - de 4c 6d b0 2c 13 8e b6-63 95 18 ee 4d 33 a6 dc .Lm.,...c...M3.. 0020 - 0d 64 24 f0 8d 3f 9c aa-b8 a4 e2 4f d3 c3 4d 88 .d$..?.....O..M. 0030 - 58 99 10 73 83 93 70 4a-2c 61 e7 2d 41 74 d3 e9 X..s..pJ,a.-At.. 0040 - 83 8c 4a 7f ae 7b e8 56-5c 51 fc 6f fe e3 a0 ec ..J..{.V\Q.o.... 0050 - 3c 2b 6b 13 fc a0 e5 15-a8 31 16 19 11 98 56 43 <+k......1....VC 0060 - 16 86 c4 cd 53 e6 c3 61-e2 6c 1b 99 86 f5 a8 bd ....S..a.l...... 0070 - 3c 49 c0 0a ce 81 a9 33-9b 95 2c e1 f4 6d 05 1e | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/troubleshooting.mdx | main | terraform | [
-0.02177046239376068,
0.08256052434444427,
-0.04074959084391594,
0.01445502694696188,
0.007419764529913664,
-0.10364940017461777,
-0.027274690568447113,
0.05330584943294525,
0.057550154626369476,
-0.024693526327610016,
-0.033586286008358,
-0.09746302664279938,
0.11959248781204224,
0.084459... | -0.050022 |
# Connect to Private VCS Providers Connect HCP Terraform to your private VCS provider using a self-hosted HCP Terraform agent to use HCP Terraform within your private network without exposing your provider to the public internet. @include "tfc-package-callouts/private-vcs.mdx" ## Background You can use HCP Terraform agents to connect HCP Terraform to your private VCS providers. The following are examples of private VCS providers that you can manage locally on your private network: - GitHub Enterprise - GitLab Enterprise - BitBucket Data Center For more information about HCP Terraform agents, refer to the [HCP Terraform agent documentation](/terraform/cloud-docs/agents). ## Requirements You must meet the following requirements to configure a connection to your private VCS provider: - HCP Terraform agent v1.15.0 or newer for workspaces or v1.26.0 for Stacks. - Network connectivity between the HCP Terraform agent and private VCS provider. - Outbound network connectivity from the HCP Terraform agent to HCP Terraform. Refer to [networking requirements](/terraform/cloud-docs/agents/requirements#networking-requirements) for more information. ## Configure the agent pool and agent Before you start your HCP Terraform agent, you must create an agent pool and token. Refer to [Create an Agent Pool](/terraform/cloud-docs/agents/agent-pools#create-an-agent-pool) for a list of steps to create an agent pool. To configure your HCP Terraform agent with private VCS support, you must set the following environment variables in the environment you run the agent. You can also set these environment variables with optional command-line flags. | Variable | Value | Command-Line Flag | | -------- | ----- | ----------------- | | `\_TFC\_AGENT\_REQUEST\_FORWARDING\_ENABLED` | `true` | | | `TFC\_AGENT\_REQUEST\_FORWARDING` | `true` | `-request-forwarding` | | `TFC\_AGENT\_ACCEPT` | A comma-separated list of values that must include `ingress` for workspaces or `source\_bundle` for Stacks. Refer to [Install and Run Agents](/terraform/cloud-docs/agents/agents#accept) to learn more. | `-accept` | Below is an example command to start the HCP Terraform agent for a workspace: ```shell-session $ export TFC\_AGENT\_TOKEN=<...> ``` ```shell-session $ \_TFC\_AGENT\_REQUEST\_FORWARDING\_ENABLED=true \ tfc-agent \ -name private-vcs-test-01 \ -request-forwarding=true \ -accept "ingress" \ -log-level "debug" ``` Below is an example command to start the HCP Terraform agent for a Stack: ```shell-session $ \_TFC\_AGENT\_REQUEST\_FORWARDING\_ENABLED=true \ tfc-agent \ -name private-vcs-test-01 \ -request-forwarding=true \ -accept "source\_bundle" \ -log-level "debug" ``` We recommend creating a separate agent pool to test your Stacks private VCS operations. Refer to [software requirements](/terraform/cloud-docs/agents/requirements#software) to learn more. ## Configure the private VCS connection To create a private VCS connection, complete the following steps: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to add the VCS connection. 1. Choose \*\*Settings\*\* from the sidebar, then click \*\*Providers\*\*. 1. Click \*\*Add a VCS provider\*\*. 1. Select your VCS Provider.This must be a self-managed provider, such as GitHub Enterprise. 1. Under \*\*VCS Access\*\*, select “Private”. 1. Select the agent pool that you created for private VCS. 1. The remainder of the setup follows the standard VCS setup workflow. Refer to the [standard VCS setup instructions](/terraform/cloud-docs/vcs) for provider specific instructions. ## Troubleshooting There are two sources of information to help diagnose issues with Private VCS and the HCP Terraform agent: 1. HCP Terraform agent logs - These display events as seen by the HCP Terraform agent. - They can aid in diagnosing errors between the HCP Terraform agent and the VCS provider during VCS ingestion, as well as any issues occurring during request forwarding. 1. VCS events in HCP Terraform (Organization \*\*Settings > Version Control > Events\*\*) - VCS events include errors that have resulted from making requests for private VCS during setup of the VCS Connection, and during normal operation. - This will not include messages during normal operations of private VCS. To aid in troubleshooting, | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/private.mdx | main | terraform | [
0.013556471094489098,
-0.012115747667849064,
0.005650936160236597,
-0.048360321670770645,
-0.039777133613824844,
0.02992713637650013,
-0.048709578812122345,
-0.0015176606830209494,
0.01267161313444376,
0.016614748165011406,
-0.013790084980428219,
-0.09111737459897995,
0.03197247534990311,
... | 0.011969 |
in HCP Terraform (Organization \*\*Settings > Version Control > Events\*\*) - VCS events include errors that have resulted from making requests for private VCS during setup of the VCS Connection, and during normal operation. - This will not include messages during normal operations of private VCS. To aid in troubleshooting, you can increase the verbosity of the HCP Terraform agent's log messages to `debug` and `trace` and retry the attempted action. Refer to [Install and Run Agents](/terraform/cloud-docs/agents/agents#log-level) for more information. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/vcs/private.mdx | main | terraform | [
0.07391350716352463,
0.01510696206241846,
0.06728809326887131,
-0.01044012513011694,
0.008839042857289314,
-0.007636372931301594,
-0.06178536266088486,
-0.07936704903841019,
0.03189407289028168,
0.06604129076004028,
0.006796852685511112,
-0.11424660682678223,
-0.000851709337439388,
-0.0015... | -0.024282 |
# Variables overview Variables let you customize configurations, modify Terraform's behavior, setup [dynamic provider credentials](/terraform/cloud-docs/dynamic-provider-credentials), and store information like static provider credentials. You can set variables specifically for each workspace or you can create variable sets to reuse the same variables across multiple workspaces and Stacks. For example, you could define a variable set of provider credentials and automatically apply it to all of the workspaces and Stacks using that provider. For workspaces, you can use the command line to specify workspace variable values for each plan or apply. Otherwise, HCP Terraform applies workspace variables to all runs within that workspace. [permissions-citation]: #intentionally-unused---keep-for-maintainers ## Types You can create both environment variables and Terraform variables in HCP Terraform. > \*\*Hands-on:\*\* Try the [Create and Use a Variable Sets](/terraform/tutorials/cloud-get-started/cloud-create-variable-set) and [Create Infrastructure](/terraform/tutorials/cloud-get-started/cloud-workspace-configure) tutorials to set environment and Terraform variables in HCP Terraform. ### Environment variables HCP Terraform performs Terraform runs on disposable Linux worker VMs using a POSIX-compatible shell. Before running Terraform operations, HCP Terraform uses the `export` command to populate the shell with environment variables. Environment variables can store provider credentials and other data. Refer to your provider's Terraform Registry documentation for a full list of supported shell environment variables (e.g., authentication variables for [AWS](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#environment-variables), [Google Cloud Platform](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting\_started#adding-credentials), and [Azure](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#argument-reference)). Environment variables can also [modify Terraform's behavior](/terraform/cli/config/environment-variables). For example, `TF\_LOG` enables detailed logs for debugging. To learn more about accessing environment variable values in Stacks, refer to [Variable sets and Stacks](/terraform/cloud-docs/variables/managing-variables#variable-sets-and-stacks). #### Parallelism In workspaces, you can use the `TFE\_PARALLELISM` environment variable when your infrastructure providers produce errors on concurrent operations or use non-standard rate limiting. The `TFE\_PARALLELISM` variable sets the `-parallelism=` flag for `terraform plan` and `terraform apply` ([more about `parallelism`](/terraform/internals/graph#walking-the-graph)). Valid values are between 1 and 256, inclusive, and the default is `10`. HCP Terraform agents do not support `TFE\_PARALLELISM`, but you can specify flags as environment variables directly via [`TF\_CLI\_ARGS\_name`](/terraform/cli/config/environment-variables#tf-cli-args). In these cases, use `TF\_CLI\_ARGS\_plan="-parallelism="` or `TF\_CLI\_ARGS\_apply="-parallelism="` instead. !> \*\*Warning:\*\* We recommend reading and understanding [Terraform parallelism](https://support.hashicorp.com/hc/en-us/articles/10348130482451) prior to setting `TFE\_PARALLELISM`. You can also contact HashiCorp support for direct advice. #### Dynamic credentials Dynamic credentials lets you use temporary per-run credentials and eliminates the need to manually rotate secrets. You can configure [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials) for certain providers using environment variables [at the workspace level](/terraform/cloud-docs/variables/managing-variables#workspace-specific-variables) or using [variable sets](/terraform/cloud-docs/variables/managing-variables#variable-sets). If you are configuring a Stack, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate) to learn the workflow of authenticating your Stack deployments with dynamic credentials. ### Terraform variables In workspaces, Terraform variables refer to [input variables](/terraform/language/block/variable) that define parameters without hardcoding them into the configuration. For example, you could create variables that let users specify the number and type of Amazon Web Services EC2 instances they want to provision with a Terraform module. ```hcl variable "instance\_count" { description = "Number of instances to provision." type = number default = 2 } ``` You can then reference this variable in your configuration. ```hcl module "ec2\_instances" { source = "./modules/aws-instance" instance\_count = var.instance\_count ## ... } ``` If a required input variable is missing, Terraform plans in the workspace will fail and print an explanation in the log. To learn more about accessing Terraform variable values in Stacks, refer to [Variable sets and Stacks](/terraform/cloud-docs/variables/managing-variables#variable-sets-and-stacks). ## Scope Each environment and Terraform variable can have one of the following scopes: | Scope | Description | Resources | | ----------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Workspace run-specific | Apply to a specific run within a single workspace. | [Specify Run-Specific Variables](/terraform/cloud-docs/variables/managing-variables#run-specific-variables) | | Workspace-Specific | Apply to a single workspace. | [Create Workspace-Specific Variables](/terraform/cloud-docs/variables/managing-variables#workspace-specific-variables), [Loading Variables from Files](/terraform/cloud-docs/variables/managing-variables#loading-variables-from-files), [Workspace-Specific Variables API](/terraform/cloud-docs/api-docs/workspace-variables). | | Workspace-Scoped Variable Set | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/index.mdx | main | terraform | [
-0.0023658417630940676,
-0.0016287489561364055,
0.005259988363832235,
0.02874952368438244,
-0.07475904375314713,
0.03074699267745018,
0.026213958859443665,
-0.04381122067570686,
-0.021743465214967728,
0.025435104966163635,
-0.029407812282443047,
-0.08443213999271393,
0.07707328349351883,
-... | -0.029758 |
| | ----------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Workspace run-specific | Apply to a specific run within a single workspace. | [Specify Run-Specific Variables](/terraform/cloud-docs/variables/managing-variables#run-specific-variables) | | Workspace-Specific | Apply to a single workspace. | [Create Workspace-Specific Variables](/terraform/cloud-docs/variables/managing-variables#workspace-specific-variables), [Loading Variables from Files](/terraform/cloud-docs/variables/managing-variables#loading-variables-from-files), [Workspace-Specific Variables API](/terraform/cloud-docs/api-docs/workspace-variables). | | Workspace-Scoped Variable Set | Apply to multiple workspaces within the same organization. | [Create Variable Sets](/terraform/cloud-docs/variables/managing-variables#variable-sets) and [Variable Sets API](/terraform/cloud-docs/api-docs/variable-sets) | | Project-Scoped Variable Set | Automatically applied and available to all current and future workspaces and Stacks within a project. | [Create Variable Sets](/terraform/cloud-docs/variables/managing-variables#variable-sets) and [Variable Sets API](/terraform/cloud-docs/api-docs/variable-sets) | | Global Variable Set | Automatically applied to all current and future workspaces and Stacks within an organization. | [Create Variable Sets](/terraform/cloud-docs/variables/managing-variables#variable-sets) and [Variable Sets API](/terraform/cloud-docs/api-docs/variable-sets) | ## Variable set ownership Projects and organizations can both own variable sets. The owner of a variable set can determine the precedence of that set. Use organization-owned variable sets to share variables across multiple projects. Managing organization-owned variable sets [requires a higher permission level](/terraform/cloud-docs/variables/managing-variables#permissions) because you can apply these sets to any project in your organization. Use project-owned variable sets to share variables across multiple workspaces within a single project. Project-owned variable sets only require permissions on the project itself, rather than organization-level permissions. Refer to [\*\*Manage variable sets\*\*](/terraform/cloud-docs/variables/managing-variables#permissions) for more details on variable set permissions. ## Precedence > \*\*Hands On:\*\* The [Manage Multiple Variable Sets in HCP Terraform](/terraform/tutorials/cloud/cloud-multiple-variable-sets) tutorial shows how to manage multiple variable sets and demonstrates variable precedence. There may be cases when a workspace contains conflicting variables of the same type with the same key. HCP Terraform marks overwritten variables in the UI. Stacks directly reference individual variable sets using the `store` block, so they do not need to heed the following precedence rules. HCP Terraform prioritizes and overwrites conflicting variables in workspaces according to the following precedence: ### 1. Priority global variable sets If [prioritized](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets), variables in a global variable set have precedence over all other variables with the same key. ### 2. Priority project-scoped variable set owned by an organization If [prioritized](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets), variables in a priority project-scoped variable set have precedence over variables with the same key set at a more specific scope. Prioritized variables sets owned by organizations take precedence over priority variable sets owned by projects. ### 3. Priority workspace-scoped variable set owned by an organization If [prioritized](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets), variables in an organization-owned variable set scoped to a workspace have precedence over variables with the same key set at a more specific scope. Prioritized variables sets owned by organizations take precedence over sets owned by projects. ### 4. Priority project-scoped variable set owned by a project If [prioritized](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets), variables in a priority project-scoped variable set have precedence over variables with the same key set at a more specific scope. ### 5. Priority workspace-scoped variable set owned by a project If [prioritized](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets), variables in a priority workspace-scoped variable set have precedence over variables with the same key set at a more specific scope. ### 6. Command line argument variables When using a CLI workflow, variables applied to a run with either `-var` or `-var-file` overwrite workspace-specific and variable set variables that have the same key. ### 7. Local environment variables prefixed with `TF\_VAR\_` When using a CLI workflow, local environment variables prefixed with `TF\_VAR\_` (e.g., `TF\_VAR\_replicas`) overwrite workspace-specific, variable set, and `.auto.tfvars` file variables that have the same key. ### 8. Workspace-specific variables Workspace-specific variables always overwrite variables from variable sets that have the same key. Refer to [overwrite variables from variable sets](/terraform/cloud-docs/variables/managing-variables#overwrite-variable-sets) for details. ### 9. Workspace-scoped variable owned by a project Variables in workspace-scoped variable sets are only | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/index.mdx | main | terraform | [
-0.04067615047097206,
0.0016279533738270402,
-0.04379346966743469,
-0.03140496090054512,
-0.09659241884946823,
0.01186291128396988,
-0.0011829602299258113,
0.043840132653713226,
0.00023470541054848582,
-0.06208382919430733,
0.05728145316243172,
-0.02426823042333126,
-0.03413430601358414,
-... | 0.060961 |
and `.auto.tfvars` file variables that have the same key. ### 8. Workspace-specific variables Workspace-specific variables always overwrite variables from variable sets that have the same key. Refer to [overwrite variables from variable sets](/terraform/cloud-docs/variables/managing-variables#overwrite-variable-sets) for details. ### 9. Workspace-scoped variable owned by a project Variables in workspace-scoped variable sets are only applied to a subset of workspaces in a project. When workspace-scoped variable sets have conflicting variables, HCP Terraform compares the variable set names and uses values from the variable set with lexical precedence. Terraform and HCP Terraform operate on UTF-8 strings, and HCP Terraform sorts variable set names based on the lexical order of Unicode code points. For example, if you apply `A\_Variable\_Set` and `B\_Variable\_Set` to the same workspace, HCP Terraform will use any conflicting variables from `A\_Variable\_Set`. This is the case regardless of which variable set has been edited most recently. HCP Terraform only considers the lexical ordering of variable set names when determining precedence. Variables sets scoped to workspaces that are owned by projects take precedence over sets with the same scope that are owned by organizations. ### 10. Project-scoped variable set owned by a project Variables in project-scoped variable sets are only applied to the workspaces within the specified projects. When project-scoped variable sets have conflicting variables, HCP Terraform compares the variable set names and uses values from the variable set with lexical precedence. Terraform and HCP Terraform operate on UTF-8 strings, and HCP Terraform sorts variable set names based the on lexical order of Unicode code points. For example, if you apply `A\_Variable\_Set` and `B\_Variable\_Set` to the same project, HCP Terraform uses any conflicting variables from `A\_Variable\_Set`. This is the case regardless of which variable set has been edited most recently. HCP Terraform only considers the lexical ordering of variable set names when determining precedence. Variables sets owned by projects take precedence over those owned by organizations. ### 11. Workspace-scoped variable set owned by an organization Variables in workspace-scoped variable sets are only applied to the specified workspaces in an organization. When workspace-scoped variable sets have conflicting variables, HCP Terraform compares the variable set names and uses values from the variable set with lexical precedence. Terraform and HCP Terraform operate on UTF-8 strings, and HCP Terraform sorts variable set names based on the lexical order of Unicode code points. For example, if you apply `A\_Variable\_Set` and `B\_Variable\_Set` to the same workspace, HCP Terraform will use any conflicting variables from `A\_Variable\_Set`. This is the case regardless of which variable set has been edited most recently. HCP Terraform only considers the lexical ordering of variable set names when determining precedence. ### 12. Project-scoped variable set owned by an organization Variables in project-scoped variable sets are only applied to the workspaces within the specified projects. When project-scoped variable sets have conflicting variables, HCP Terraform compares the variable set names and uses values from the variable set with lexical precedence. Terraform and HCP Terraform operate on UTF-8 strings, and HCP Terraform sorts variable set names based the on lexical order of Unicode code points. For example, if you apply `A\_Variable\_Set` and `B\_Variable\_Set` to the same project, HCP Terraform uses any conflicting variables from `A\_Variable\_Set`. This is the case regardless of which variable set has been edited most recently. HCP Terraform only considers the lexical ordering of variable set names when determining precedence. ### 13. Global variable sets Workspace and project-scoped variable sets always take precedence over global variable sets that are applied to all workspaces within an organization. Terraform does not allow global variable sets to contain variables with the same key, so they cannot conflict. ### 14. `\*.auto.tfvars` variable | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/index.mdx | main | terraform | [
0.02488621138036251,
-0.006238655187189579,
0.04219992458820343,
0.008704892359673977,
-0.06642888486385345,
0.026730874553322792,
0.057821132242679596,
-0.08174169808626175,
0.008702477440237999,
0.026830971240997314,
-0.007325929589569569,
-0.02989085391163826,
0.05728716403245926,
0.004... | -0.037613 |
determining precedence. ### 13. Global variable sets Workspace and project-scoped variable sets always take precedence over global variable sets that are applied to all workspaces within an organization. Terraform does not allow global variable sets to contain variables with the same key, so they cannot conflict. ### 14. `\*.auto.tfvars` variable files Variables in the HCP Terraform workspace and variables provided through the command line always overwrite variables with the same key from files ending in `.auto.tfvars`. ### 15. `terraform.tfvars` variable file Variables in the `.auto.tfvars` files take precedence over variables in the `terraform.tfvars` file. Although HCP Terraform uses variables from `terraform.tfvars`, Terraform Enterprise currently ignores this file. ### Precedence with priority variable sets You can select to prioritize all values of the variables in a variable set. When a variable set is priority, the values take precedence over any variables with the same key set at a more specific scope. For example, variables in a priority global variable set would take precedence over all variables with the same key. If two priority variable sets with the same scope and ownership include the same variable key, HCP Terraform will determine precedence by the alphabetical order of the variable sets' names. While a priority variable set can enforce that Terraform variables use designated values, it does not guarantee that the configuration uses the variable. A user can still directly modify the Terraform configuration to remove usage of a variable and replace it with a hard-coded value. For stricter enforcement, we recommend using policy checks or run tasks. ## Precedence example Consider an example workspace that has the following different kinds of variables and variable sets: | Source | Priority | Ownership | Scope | | ------------------------------------------------------------- | -------- | ------------ | --------- | | Priority \*\*global\*\* variable set | true | organization | global | | Priority organization-owned \*\*project-scoped\*\* variable set | true | organization | project | | Priority organization-owned \*\*workspace-scoped\*\* variable set | true | organization | workspace | | Priority project-owned \*\*project-scoped\*\* variable set | true | project | project | | Priority project-owned \*\*workspace-scoped\*\* variable set | true | project | workspace | | Command line argument | N/A | N/A | run | | Local environment variable | N/A | N/A | workspace | | \*\*Workspace-specific\*\* variable | N/A | N/A | workspace | | Project-owned \*\*workspace-scoped\*\* variable set | false | project | workspace | | Project-owned \*\*project-scoped\*\* variable set | false | project | project | | Organization-owned \*\*workspace-scoped\*\* variable set | false | organization | workspace | | Organization-owned \*\*project-scoped\*\* variable set | false | organization | project | | \*\*Global\*\* variable set | false | organization | global | If these variables and variable sets had the following variables applied: | Source (priority/ownership/scope) | Region | Var1 | Replicas | | ------------------------------------------------------------- | ----------- | ---- | -------- | | Priority \*\*global\*\* variable set | `us-east-1` | | | | Priority organization-owned \*\*project-scoped\*\* variable set | `us-east-2` | | | | Priority organization-owned \*\*workspace-scoped\*\* variable set | `us-west-1` | | | | Priority project-owned \*\*project-scoped\*\* variable set | `eu-east-2` | | | | Priority project-owned \*\*workspace-scoped\*\* variable set | `eu-west-1` | | | | Command line argument | `us-west-2` | | `9` | | Local environment variable | | | `8` | | \*\*Workspace-specific\*\* variable | | `h` | `1` | | Project-owned \*\*workspace-scoped\*\* variable set | | `y` | `2` | | Project-owned \*\*project-scoped\*\* variable set | | | `4` | | Organization-owned \*\*workspace-scoped\*\* variable set | | `z` | `3` | | Organization-owned \*\*project-scoped\*\* variable set | | | `5` | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/index.mdx | main | terraform | [
0.008325055241584778,
0.004529065918177366,
0.031166765838861465,
-0.02619369886815548,
-0.040528297424316406,
0.00527715589851141,
0.024724489077925682,
-0.04975902661681175,
-0.014051919803023338,
0.04620249941945076,
0.010709686204791069,
-0.01742265373468399,
0.03750777617096901,
0.038... | -0.008821 |
\*\*Workspace-specific\*\* variable | | `h` | `1` | | Project-owned \*\*workspace-scoped\*\* variable set | | `y` | `2` | | Project-owned \*\*project-scoped\*\* variable set | | | `4` | | Organization-owned \*\*workspace-scoped\*\* variable set | | `z` | `3` | | Organization-owned \*\*project-scoped\*\* variable set | | | `5` | | \*\*Global\*\* variable set | | | `6` | When you trigger a run through the command line, these are the final values HCP Terraform assigns to each variable: | Variable | Value | | -------- | ----------- | | Region | `us-east-1` | | Var1 | `h` | | Replicas | `9` | | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/index.mdx | main | terraform | [
0.009154831059277058,
-0.007197486236691475,
-0.021884091198444366,
0.004550744313746691,
-0.06690710037946701,
-0.010778496973216534,
0.041472289711236954,
-0.057445477694272995,
-0.058064334094524384,
0.04563506320118904,
0.008128938265144825,
-0.12178585678339005,
0.07860127836465836,
-... | 0.03528 |
# Manage variables and variable sets You can set variables specifically for each workspace or you can create variable sets to reuse the same variables across multiple workspaces and Stacks. Refer to the [variables overview](/terraform/cloud-docs/variables) for more information about variable types, scope, and precedence. You can also set variable values specifically for each workspace run on the command line. You can create and edit workspace-specific variables through: - The HCP Terraform UI, as detailed below. - The Variables API for [workspace-specific variables](/terraform/cloud-docs/api-docs/workspace-variables) and [variable sets](/terraform/cloud-docs/api-docs/variable-sets). - The `tfe` provider's [`tfe\_variable`](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) resource, which can be more convenient for bulk management. ## Permissions You must have [\*\*Read variables\*\* permission](/terraform/cloud-docs/users-teams-organizations/permissions/organization/workspace) to view the variables for a particular workspace and to view the variable sets in your organization. To create or edit workspace-specific variables within a workspace, you must have [\*\*Read and write variables\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/workspace) for that workspace. To create, update, or delete organization-owned variable sets, you must be one of the following: - A member of the [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) - A member of a team with [\*\*Manage all projects\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-all-projects) - A member of a team with [\*\*Manage all workspaces\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-all-workspaces) To create, edit, or apply project-owned variable sets, you must be part of a team with one of the following: - \*\*Write\*\* project permissions - \*\*Maintain\*\* project permissions - \*\*Admin\*\* project permissions - [\*\*Manage variable sets\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/project#manage-variable-sets) project permissions - [\*\*Manage all projects\*\*](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-all-projects) organization permissions ## Workspace run-specific variables Terraform 1.1 and later lets you set [Terraform variable](/terraform/cloud-docs/variables#terraform-variables) values for a particular plan or apply on the command line. These variable values will overwrite workspace-specific and variable set variables with the same key. Refer to the [variable precedence](/terraform/cloud-docs/variables#precedence) documentation for more details. You can set run-specific Terraform variable values by: - Specifying `-var` and `-var-file` arguments. For example: ``` terraform apply -var="key=value" -var-file="testing.tfvars" ``` - Creating local environment variables prefixed with `TF\_VAR\_`. For example, if you declare a variable called `replicas` in your configuration, you could create a local environment variable called `TF\_VAR\_replicas` and set it to a particular value. When you use the [CLI Workflow](/terraform/cloud-docs/workspaces/run/cli), Terraform automatically identifies these environment variables and applies their values to the run. Refer to the [variables on the command line](/terraform/language/values/variables#variables-on-the-command-line) documentation for more details and examples. ## Workspace-specific variables To view and manage a workspace's variables, go to the workspace and click the \*\*Variables\*\* tab. The \*\*Variables\*\* page appears, showing all workspace-specific variables and variable sets applied to the workspace. This is where you can add, edit, and delete workspace-specific variables. You can also apply and remove variable sets from the workspace. The \*\*Variables\*\* page is not available for workspaces configured with `Local` [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode). HCP Terraform does not evaluate workspace variables or variable sets in local execution mode. ### Add a variable To add a variable to a workspace: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and select the workspace you want to define a variable for. 1. Go to the workspace \*\*Variables\*\* page and click \*\*+ Add variable\*\* in the \*\*Workspace Variables\*\* section. 1. Choose a variable category (Terraform or environment), optionally mark the variable as [sensitive](#sensitive-values), and enter a variable key, value, and optional description. For Terraform variables only, you can check the \*\*HCL\*\* checkbox to enter a value in HashiCorp Configuration Language. Refer to [variable values and format](#variable-values-and-format) for variable limits, allowable values, and formatting. 1. Click \*\*Save variable\*\*. The variable now appears in the list of the workspace's variables and HCP Terraform will apply it to runs. ### Edit a variable To edit a variable on a workspace: 1. Click the ellipses next to the variable you want to edit and select | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/managing-variables.mdx | main | terraform | [
0.022401535883545876,
-0.027595745399594307,
-0.026399502530694008,
0.033591318875551224,
-0.06703879684209824,
-0.02538854256272316,
0.023636244237422943,
-0.05200415104627609,
-0.032263923436403275,
0.04150529205799103,
-0.0020583432633429766,
-0.08835375308990479,
0.056971002370119095,
... | 0.051829 |
and formatting. 1. Click \*\*Save variable\*\*. The variable now appears in the list of the workspace's variables and HCP Terraform will apply it to runs. ### Edit a variable To edit a variable on a workspace: 1. Click the ellipses next to the variable you want to edit and select \*\*Edit\*\*. 1. Make any desired changes and click \*\*Save variable\*\*. ### Delete a variable To delete a variable from a workspace: 1. Click the ellipses next to the variable you want to delete and select \*\*Delete\*\*. 1. Click \*\*Yes, delete variable\*\* to confirm your action. ## Loading variables from files You can set [Terraform variable](/terraform/cloud-docs/variables#terraform-variables) values for a workspace by providing any number of [files ending in `.auto.tfvars`](/terraform/language/values/variables#variable-files) to workspaces that use Terraform 0.10.0 or later. When you trigger a run, Terraform automatically loads and uses the variables defined in these files. If any variable from the workspace has the same key as a variable in the file, the workspace variable overwrites variable from the file. You can only do this with files ending in `auto.tfvars` or `terraform.tfvars`. You can apply other types of `.tfvars` files [using the command line](#run-specific-variables) for each run. ~> \*\*Note:\*\* HCP Terraform loads variables from files ending in `auto.tfvars` for each workspace run, but does not automatically persist those variables to the HCP Terraform workspace or display them in the \*\*Variables\*\* section of the workspace UI. ## Variable sets > \*\*Hands On:\*\* Try the [Manage Variable Sets in HCP Terraform tutorial](/terraform/tutorials/cloud/cloud-multiple-variable-sets) tutorial. Variable sets are reusable collections of variables that you can apply to multiple workspaces and Stacks. You can create variable sets under an organization or a project. Whether the variable set is owned by an organization or a project determines the permissions required to manage that set. Learn more about [variable set permissions](#permissions). HCP Terraform does not evaluate variable sets during Terraform runs for workspaces configured with `Local` [execution mode](/terraform/cloud-docs/workspaces/settings#execution-mode). Organizations or projects can own variable sets. To view variable sets, click \*\*Settings\*\* in your organization or project, then click \*\*Variable sets\*\*. The \*\*Variable sets\*\* page lists all of the organization's or project's variable sets. Click on a variable set to open it and review details about its variables and scoping. ### Create variable sets To create a variable set: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the \*\*Settings\*\* page for your organization or project. 1. Click \*\*Variable Sets\*\*. 1. Click \*\*Create variable set\*\*. 1. Choose a descriptive \*\*Name\*\* for the variable set. You can use any combination of numbers, letters, and characters. 1. Write an optional \*\*Description\*\* that tells other users about the purpose of the variable set and what it contains. 1. Choose a variable set scope: - Organization-owned - \*\*Apply globally:\*\* HCP Terraform automatically applies this global variable set to all existing and future workspaces. - \*\*Apply to specific projects, Stacks, or workspaces:\*\* Use the text fields to search for and select workspaces, Stacks, and projects to apply this variable set to. This affects all current and future workspaces and Stacks for any selected projects. After creation, users can also [add this variable set to their workspaces](#apply-or-remove-variable-sets-from-inside-a-workspace). - Project-owned - \*\*Apply to the entire project:\*\* HCP Terraform automatically applies this variable set to all existing and future workspaces and Stacks in the project. - \*\*Apply to specific workspaces and Stacks in the project:\*\* Use the text fields to search for and select workspaces and Stacks to apply this variable set to. After creation, users can also [add this variable set to their workspaces](#apply-or-remove-variable-sets-from-inside-a-workspace). 1. Add one or more variables: Click \*\*+ Add variable\*\*, choose a | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/managing-variables.mdx | main | terraform | [
0.03457295522093773,
0.04010310769081116,
0.03111748956143856,
0.06691562384366989,
-0.03810364753007889,
0.04213295504450798,
0.05782947689294815,
-0.09028173983097076,
-0.001754780183546245,
0.08941546082496643,
-0.035778697580099106,
-0.044091690331697464,
0.058564744889736176,
-0.01752... | -0.013488 |
to specific workspaces and Stacks in the project:\*\* Use the text fields to search for and select workspaces and Stacks to apply this variable set to. After creation, users can also [add this variable set to their workspaces](#apply-or-remove-variable-sets-from-inside-a-workspace). 1. Add one or more variables: Click \*\*+ Add variable\*\*, choose a variable type (Terraform or environment), optionally mark the variable as [sensitive](#sensitive-values), and enter a variable name, value, and optional description. Then, click \*\*Save variable\*\*. Refer to [variable values and format](#variable-values-and-format) for variable limits, allowable values, and formatting. ~> \*\*Note:\*\* HCP Terraform will error if you try to declare variables with the same key in multiple global variable sets. 1. Click \*\*Create variable set.\*\* HCP Terraform adds the new variable set to any specified workspaces and displays it on the \*\*Variable Sets\*\* page. ### Edit variable sets To edit or remove a variable set: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the \*\*Settings\*\* page for your organization or project. 1. Click \*\*Variable Sets\*\*. 1. Select the variable set you want to edit. That specific variable set page appears, where you can change the variable set settings. Refer to [create variable sets](#create-variable-sets) for details. ### Delete variable sets Deleting a variable set can be a disruptive action, especially if the variables are required to execute runs. We recommend informing organization, project ,Stack, and workspace owners before removing a variable set. To delete a variable set: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the \*\*Settings\*\* page for your organization or project. 1. Click \*\*Variable Sets\*\*. 1. Select \*\*Delete variable set\*\*. Enter the variable set name and click \*\*Delete variable set\*\* to confirm this action. HCP Terraform deletes the variable set. Runs within those workspaces and Stacks can no longer use the variables from the variable set. ### Apply or remove variable sets from inside a workspace To apply a variable set to a specific workspace: 1. Navigate to the workspace and click the \*\*Variables\*\* tab. The \*\*Variables\*\* page appears, showing all workspace-specific variables and variable sets applied to the workspace. 1. In the \*\*Variable sets\*\* section, click \*\*Apply Variable Set\*\*. Select the variable set you want to apply to your workspace, and click \*\*Apply variable set\*\*. The variable set appears in the workspace's variable sets list and HCP Terraform will now apply the variables to runs. To remove a variable set from within a workspace: 1. Navigate to the workspace and click the \*\*Variables\*\* tab. The \*\*Variables\*\* page appears, showing all workspace-specific variables and variable sets applied to the workspace. 1. Click the ellipses button next to the variable set and select \*\*Remove variable set\*\*. 1. Click \*\*Remove variable set\*\* in the dialog box. HCP Terraform removes the variable set from this workspace, but it remains available to other workspaces in the organization. ## Variable sets and Stacks In Stacks, you can use the [`store` block](/terraform/language/block/stack/tfdeploy/store) to access variable sets. Your Stack must be able to access the variable set you are targeting, by giving your Stack's project access, or by making the variable set globally available. You can then reference a variable set in your deployment configuration, `.tfdeploy.hcl`, using the `store` block. In the following example, the `store` block can access [Terraform variable values](/terraform/cloud-docs/variables#terraform-variables) in a variable set named `"Database passwords"`: ```hcl store "varset" "secrets" { name = "Database passwords" category = "terraform" } ``` Your Stack deployments can directly reference variable values using `store.varset..` syntax. In the following example, the deployment uses the `db\_password` variable to configure the `production` deployment: ```hcl store "varset" "secrets" { name = "MY\_COOL\_VARSET" category = "terraform" | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/managing-variables.mdx | main | terraform | [
0.006153840571641922,
-0.021831519901752472,
-0.00741598941385746,
0.05899845436215401,
-0.0669039785861969,
0.027482302859425545,
0.019099880009889603,
-0.061431679874658585,
-0.034115202724933624,
0.06229473277926445,
-0.005719946697354317,
-0.12874041497707367,
0.07884716242551804,
-0.0... | -0.023452 |
store "varset" "secrets" { name = "Database passwords" category = "terraform" } ``` Your Stack deployments can directly reference variable values using `store.varset..` syntax. In the following example, the deployment uses the `db\_password` variable to configure the `production` deployment: ```hcl store "varset" "secrets" { name = "MY\_COOL\_VARSET" category = "terraform" } deployment "production" { inputs = { database\_password = store.varset.secrets.db\_password instance\_count = 5 } } ``` Stacks reference variable sets during deployment runs, so any changes to variable set values are automatically reflected in future deployments. If a variable set is removed from a Stack's project or organization, the Stack fails to deploy if it references that variable set. Because Stacks reference variable sets directly by name or ID, variable [precedence](/terraform/cloud-docs/variables#precedence) does not affect Stacks. If a Stack references a variable set, the Stack always uses the values from that set, even if there are organization-level variables or other variable sets with variables that have the same name. To learn more about authenticating Stacks using values from variable sets, refer to [Authenticate a Stack](/terraform/language/stacks/deploy/authenticate). To learn more about the syntax of referencing variable sets with examples, refer to [the `store` block reference](/terraform/language/stacks/tfdeploy/store). ## Overwrite variable sets You can overwrite variables defined in variable sets within a workspace. For example, you may want to use a different set of provider credentials in a specific workspace. To overwrite a variable from a variable set, [create a new workspace-specific variable](#workspace-specific-variables) of the same type with the same key. HCP Terraform marks any variables that you overwrite with a yellow \*\*OVERWRITTEN\*\* flag. When you click the overwritten variable, HCP Terraform highlights the variable it will use during runs. Variables within a variable set can also automatically overwrite variables with the same key in other variable sets applied to the same workspace. Though variable sets are created for the organization or project, these overwrites occur within each workspace. Refer to [variable precedence](/terraform/cloud-docs/variables#precedence) for more details. ## Priority variable sets The values in priority variable sets overwrite any variables with the same key set at more specific scopes. This includes variables set using command line flags, or through`.\*auto.tfvars` and `terraform.tfvars` files. It is still possible for a user to directly modify the Terraform configuration and remove usage of a variable and replace it with a hard coded value. For stricter enforcement, we recommend using policy checks or run tasks. Refer to [variable precedence](/terraform/cloud-docs/variables#precedence-with-priority-variable-sets) for more details. ## Variable values and format The limits, allowable values, and required format are the same for both workspace-specific variables and variable sets. ### Security HCP Terraform encrypts all variable values securely using [Vault's transit backend](/vault/docs/secrets/transit) prior to saving them. This ensures that no out-of-band party can read these values without proper authorization. However, HCP Terraform stores variable [descriptions](#variable-description) in plain text, so be careful with the information you save in a variable description. We also recommend passing credentials to Terraform as environment variables instead of Terraform variables when possible, since Terraform runs receive the full text of all Terraform variable values, including [sensitive](#sensitive-values) ones. It may print the values in logs and state files if the configuration sends the value to an output or a resource parameter. Sentinel mocks downloaded from runs will also contain the sensitive values of Terraform variables. Although HCP Terraform does not store environment variables in state, it can include them in log files if `TF\_LOG` is set to `TRACE`. #### Dynamic credentials An alternative to passing static credentials for some providers is to use [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials). Dynamic credentials allows for using temporary per-run credentials and eliminates the need to manually rotate secrets. ### Character limits | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/managing-variables.mdx | main | terraform | [
-0.02217639610171318,
-0.023530784994363785,
-0.020758692175149918,
0.04417413845658302,
-0.10039236396551132,
-0.0025913601275533438,
0.02694818377494812,
-0.061640020459890366,
0.056182511150836945,
0.03482215479016304,
0.03270885720849037,
-0.06389057636260986,
0.0870831087231636,
-0.06... | -0.026777 |
state, it can include them in log files if `TF\_LOG` is set to `TRACE`. #### Dynamic credentials An alternative to passing static credentials for some providers is to use [dynamic credentials](/terraform/cloud-docs/dynamic-provider-credentials). Dynamic credentials allows for using temporary per-run credentials and eliminates the need to manually rotate secrets. ### Character limits The following limits apply to variables: | Component | Limit | | ----------- | -------------- | | description | 512 characters | | key | 128 characters | | value | 256 kilobytes | ### Multi-line text You can type or paste multi-line text into variable value text fields. ### HashiCorp configuration language (HCL) You can use HCL for Terraform variables, but not for environment variables. The same Terraform version that performs runs in the workspace will interpret the HCL. Variable values are strings by default. To enter list or map values, click the variable’s \*\*HCL\*\* checkbox (visible when editing) and enter the value with the same HCL syntax you would use when writing Terraform code. For example: ```hcl { us-east-1 = "image-1234" us-west-2 = "image-4567" } ``` ### Sensitive values !> \*\*Warning:\*\* There are some cases when even sensitive variables are included in logs and state files. Refer to [security](#security) for more information. Terraform often needs cloud provider credentials and other sensitive information that should not be widely available within your organization. To protect these secrets, you can mark any Terraform or environment variable as sensitive data by clicking its \*\*Sensitive\*\* checkbox that is visible during editing. Marking a variable as sensitive makes it write-only and prevents all users (including you) from viewing its value in the HCP Terraform UI or reading it through the Variables API endpoint. Users with permission to read and write variables can set new values for sensitive variables, but other attributes of a sensitive variable cannot be modified. To update other attributes, delete the variable and create a new variable to replace it. [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Variable description !> \*\*Warning:\*\* Variable descriptions are not encrypted, so do not include any sensitive information. Variable descriptions are optional, and help distinguish between similarly named variables. They are only shown on the \*\*Variables\*\* page and are completely independent from any variable descriptions declared in Terraform CLI. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/variables/managing-variables.mdx | main | terraform | [
-0.001947773969732225,
0.011408114805817604,
-0.03784200921654701,
-0.005460245069116354,
-0.06106949597597122,
-0.028765074908733368,
0.031913865357637405,
-0.035471074283123016,
0.03275235742330551,
0.014541571959853172,
-0.013956820592284203,
-0.07589525729417801,
0.07044214010238647,
-... | 0.026645 |
# HCP Terraform private registry overview HCP Terraform's private registry works similarly to the [public Terraform Registry](/terraform/registry) and helps you share [Terraform providers](/terraform/language/providers) and [Terraform modules](/terraform/language/modules) across your organization. It includes support for versioning and a searchable list of available providers and modules. > \*\*Hands-on:\*\* Try the [Add Public Providers and Modules to your Private Registry](/terraform/tutorials/modules/private-registry-add) tutorial and [Share Modules in the Private Registry](/terraform/tutorials/modules/module-private-registry-share) tutorials. ## Public Providers and Modules [Public modules and providers](/terraform/cloud-docs/registry/add) are hosted on the public Terraform Registry and HCP Terraform can automatically synchronize them to an organization's private registry. This lets you clearly designate which public providers and modules are recommended for the organization and makes their supporting documentation and examples centrally accessible. For more information about publishing artifacts to the public registry with an HCP Terraform organization, refer to [Namespaces](/terraform/cloud-docs/public-namespace). -> \*\*Note:\*\* Your Terraform Enterprise instance must allow access to `registry.terraform.io`, `https://yy0ffni7mf-dsn.algolia.net/` and `github.com`. ## Private Providers and Modules [Private providers](/terraform/cloud-docs/registry/publish-providers) and [private modules](/terraform/cloud-docs/registry/publish-modules) are hosted on an organization's private registry and are only available to members of that organization. In Terraform Enterprise, private providers and modules are also available to other organizations that are [configured to share](/terraform/enterprise/admin/application/registry-sharing) with that organization. ## Managing Usage You can create [Sentinel policies](/terraform/cloud-docs/policy-enforcement) to manage how members of your organization can use modules from the private registry. For example, you can mandate that all non-root modules in Terraform configurations must be private or public modules from your own private registry. You can also apply a policy that requires all modules to use recent versions. Refer to our [example policy on GitHub](https://github.com/hashicorp/terraform-sentinel-policies/blob/main/cloud-agnostic/http-examples/use-recent-versions-from-pmr.sentinel). | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/index.mdx | main | terraform | [
-0.016969328746199608,
-0.04199274629354477,
-0.020936068147420883,
-0.02157491259276867,
0.025375572964549065,
0.04227201268076897,
-0.028312234207987785,
-0.060091663151979446,
-0.009775454178452492,
0.023013433441519737,
0.006718916352838278,
-0.05912886932492256,
0.023772217333316803,
... | 0.07971 |
# Manage module versions You can manage the lifecycle of module versions in your organization’s private registry by deprecating or revoking module versions as you stop maintaining and supporting those versions. @include "tfc-package-callouts/manage-module-versions.mdx" Deprecating a module version adds warnings to the module's registry page and warnings in the run outputs of any users of that version. Revoking a module version adds warnings to the module's registry page, warnings in the run outputs of existing users, and prevents new users from consuming that version. You can also [deprecate or revoke module versions using the HCP Terraform API](/terraform/cloud-docs/api-docs/private-registry/manage-module-versions). ## Overview Deprecating a private module version enables platform teams and module authors to signal to consumers that a version is still maintained and supported but is not recommended. HCP Terraform urges existing and new users of deprecated versions to upgrade that version in their configuration. The private registry also denotes which module versions are deprecated, alerting new consumers to use a non-deprecated version. You can revert a module version’s deprecation if you decide to continue supporting that version. Reverting a version’s deprecation removes all warnings from that version in both the module’s registry page and the run outputs of that version’s consumers. You can revoke a private module to mark that you not longer support it. Revoking a module version adds similar warnings to deprecation in a module's registry page and the run outputs of current consumers. Revoking a module version also blocks the runs of any new users attempting to add that version to their configuration. Reverting a module version’s revocation sets it back to a deprecated state, signaling that the version is still maintained and supported but not recommended. ## Requirements To deprecate a module version or to revert a version’s deprecation: - you must have permission to manage [private registry modules](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-private-registry) - the module must be in the [private](/terraform/cloud-docs/registry/publish-modules) registry - you must be a member of an organization on the HCP Terraform \*\*Standard\*\* edition To revoke or to revert a module version’s status: - you must have permission to manage [private registry modules](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-private-registry) - the module must be in an organization's [private registry](/terraform/cloud-docs/registry/publish-modules) - you must be a member of an organization on the HCP Terraform \*\*Premium\*\* edition ## Deprecate a module version To deprecate a module version, perform the following steps: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to your organization. 1. Choose \*\*Registry\*\* in the sidebar then find the module you want to deprecate a version of. 1. Open the \*\*Manage module for organization\*\* dropdown. 1. Select a module version for deprecation. 1. You can optionally provide an explanation in the \*\*Reason for module deprecation\*\* field to help users understand why this module version is being deprecated. This custom message is displayed to module users in deprecation warnings. 1. You can optionally enter a URL into the \*\*Link to additional information\*\* field if there is a website where consumers can learn more about that module version’s deprecation. 1. Click \*\*Deprecate\*\*. If the module version you are deprecating has the [\*\*No-code ready\*\*](/terraform/cloud-docs/workspaces/no-code-provisioning/module-design#updating-a-module-s-version) pin, then HCP Terraform lets you select another version to create no-code modules from. We recommend adding the \*\*No-code ready\*\* pin to another non-deprecated module version so that users provisioning workspaces from your module can use a version that you plan to continue supporting. ### Deprecation warnings After you deprecate a module version, consumers of that version receive warnings in their operation outputs urging them to update that version in both HCP Terraform and the Terraform CLI. ~> \*\*Note\*\*: Only workspaces in the [remote or agent execution modes](/terraform/cloud-docs/workspaces/settings#execution-mode) can receive warnings for | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/manage-module-versions.mdx | main | terraform | [
0.016200266778469086,
0.05007157474756241,
0.05099879205226898,
-0.027850758284330368,
0.04196850582957268,
-0.00019479783077258617,
-0.039609815925359726,
-0.07185486704111099,
0.013377057388424873,
0.03114054538309574,
0.011083021759986877,
0.010386263951659203,
0.013522496446967125,
-0.... | -0.011518 |
continue supporting. ### Deprecation warnings After you deprecate a module version, consumers of that version receive warnings in their operation outputs urging them to update that version in both HCP Terraform and the Terraform CLI. ~> \*\*Note\*\*: Only workspaces in the [remote or agent execution modes](/terraform/cloud-docs/workspaces/settings#execution-mode) can receive warnings for a module version’s deprecation. If you provided a reason for a module version’s deprecation, then deprecation warnings contain that reason: ```shell Found the following deprecated module versions, consider using an updated version. ``` A run’s output mode affects where a version's deprecation warning appears. If a workspace is in the default [\*\*Structured Run Output\*\*](/terraform/cloud-docs/workspaces/settings#user-interface) mode, then module deprecation warnings show up under a run’s \*\*Diagnostics\*\* dropdown. If a run is in the \*\*Console UI\*\* mode, module deprecation warnings appear in the run’s logs: ```shell Warning: Deprecated modules found, consider installing an updating version. The following are affected: Version X.X.X of ``` ## Revert the deprecation of a module version To revert a module version’s deprecation, perform the following steps: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to your organization. 1. Choose \*\*Registry\*\* in the sidebar, then find the module version you want to revert the deprecation of. 1. Open the \*\*Manage module for organization\*\* dropdown. 1. Select \*\*Revert module version deprecation X.X.X\*\*. 1. Click \*\*Revert Deprecation\*\*. Reverting the deprecation of a module version removes all warnings from that version in both the module’s registry page and in the run outputs of that module version’s consumers. ## Revoke a module version To revoke a module version, perform the following steps: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to your organization. 1. Choose \*\*Registry\*\* in the sidebar, then select the module version you want to revoke. 1. If you have not already, [deprecate the module version](#deprecate-a-module-version) you want to revoke. 1. Open the \*\*Manage module for organization\*\* dropdown. 1. Optionally explain why you are deprecating this module version in the \*\*Reason for module revocation\*\* field. This custom message is displayed to users in revocation run warnings and on the registry page. 1. Optionally, enter a URL into the \*\*Link to additional information\*\* field if there is a website where consumers can learn more about that module version’s revocation. 1. Click \*\*Revoke\*\*. If the module version you are revoking has the [\*\*No-code ready\*\*](/terraform/cloud-docs/workspaces/no-code-provisioning/module-design#updating-a-module-s-version) pin, you must select another version to create no-code modules from. This is to ensure users provisioning workspaces from your module use a version that you are currently supporting. ### Revocation warnings Like deprecation, revoking a module version displays a warning on the private registry and sends current consumers warnings in operation outputs in HCP Terraform and the Terraform CLI. The difference between deprecation and revocation is that Terraform blocks new consumers from using a revoked module version by erroring out in runs. ~> \*\*Note\*\*: Only workspaces in the [remote or agent execution modes](/terraform/cloud-docs/workspaces/settings#execution-mode) can receive warnings for a module version’s revocation. After you revoke a module version, current consumers of that version receive warnings in their operation outputs in HCP Terraform and the Terraform CLI. If you provided a reason for a module version’s revocation, HCP Terraform displays that reason to users in run outputs: ```shell This run references revoked module versions, but this will proceed due to referencing a previously used module version. Module version X.X.X of is revoked. ``` A run’s output mode affects where a version's revocation warnings appear. If a workspace is in the default [\*\*Structured Run Output\*\*](/terraform/cloud-docs/workspaces/settings#user-interface) mode, then module revocation warnings show up under a run’s \*\*Diagnostics\*\* dropdown. If a run is in the \*\*Console | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/manage-module-versions.mdx | main | terraform | [
-0.007648382801562548,
0.03159286454319954,
0.08275159448385239,
0.020202068611979485,
0.03202934190630913,
-0.006728473585098982,
-0.052724163979291916,
-0.07293190807104111,
-0.016399383544921875,
0.0388324074447155,
-0.0066978419199585915,
-0.05415366590023041,
0.05180772393941879,
-0.0... | -0.008579 |
used module version. Module version X.X.X of is revoked. ``` A run’s output mode affects where a version's revocation warnings appear. If a workspace is in the default [\*\*Structured Run Output\*\*](/terraform/cloud-docs/workspaces/settings#user-interface) mode, then module revocation warnings show up under a run’s \*\*Diagnostics\*\* dropdown. If a run is in the \*\*Console UI\*\* mode, module revocation warnings appear in the run’s logs: ```shell Warning: This run will continue because it references a revoked module version that was previously used in this workspace. Net new workspaces that reference this module version will be blocked from making new runs. Version X.X.X of ``` If a new user attempts to add a revoked module version to their configuration, their runs fail. If you provided a reason for a module version’s revocation, HCP Terraform displays that reason to users in run outputs: ```shell This run references revoked module versions, this run will not proceed. Module version of is revoked. ``` A run’s output mode affects where a module revocation’s warning appears. If a run set to the default [\*\*Structured Run Output\*\*](/terraform/cloud-docs/workspaces/settings#user-interface) mode, then module revocation warnings show up under a run’s \*\*Diagnostics\*\* dropdown. If a run is in the \*\*Console UI\*\* mode, module revocation warnings appear in the run’s logs: ```shell │ Alert: Revoked modules found, this run will not continue. The following modules have been revoked: │ │ Version X.X.X of │ │ ``` ## Revert the revocation of a module version When you revert the revocation of a module version, HCP Terraform sets that version as deprecated, signaling that it is still maintained and supported but not recommended. Deprecated module versions still produce warnings in the registry and run outputs, but new users can still use them. To revert a module version’s revocation, perform the following steps: 1. Sign in to [HCP Terraform](https://app.terraform.io/) and navigate to your organization. 1. Choose \*\*Registry\*\* in the sidebar, then find the revoked module version you want to revert. 1. Open the \*\*Manage module for organization\*\* dropdown. 1. Select \*\*Revert module version revocation X.X.X\*\*. 1. Click \*\*Revert\*\*. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/manage-module-versions.mdx | main | terraform | [
-0.0215216763317585,
0.026216527447104454,
0.059626612812280655,
0.021549006924033165,
0.026735324412584305,
-0.04090069606900215,
-0.019980860874056816,
-0.0911598727107048,
0.06122562289237976,
0.018084600567817688,
0.0200334619730711,
0.04735797643661499,
0.03596486151218414,
-0.0044330... | 0.00059 |
[vcs]: /terraform/cloud-docs/vcs # Publish private modules to the private registry This topic describes how to publish private modules to an organization's private registry. For instructions on adding modules from the public registry, refer to [Add modules from the Terraform registry](/terraform/cloud-docs/registry/add). > \*\*Hands-on:\*\* Try the [Share Modules in the Private Module Registry](/terraform/tutorials/modules/module-private-registry-share) tutorial. ## Introduction When publishing modules to the private registry, the registry downloads the module source code. The registry handles downloads and controls access with HCP Terraform API tokens, so consumers do not need access to the module's source repository, even when running Terraform from the command line. The private registry uses your [version control system (VCS) integrations][vcs] and delegates management tasks, such as handling new version releases, to your VCS provider. The only manual tasks are adding a new module and deleting module versions. ### Access to private modules Private modules are only available to members of the organization that owns the private registry. In Terraform Enterprise, they are also available to organizations that you configure to [share modules](/terraform/enterprise/admin/application/registry-sharing) with that organization. ### Publishing workflows You can publish modules according to VCS tags or branches. Refer to [Tag-based publishing considerations](#tag-based-publishing-considerations) and [Branch-based publishing considerations](#branch-based-publishing-considerations) for more information. ## Requirements Verify that you have met the following requirements before completing these instructions. [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Permissions You must be a member of the [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) and teams with [\*\*Manage private registry\*\* permissions](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-private-registry) enabled to publish and delete modules from the private registry. ### VCS provider settings - You must configure a VCS provider connection. Refer to [Connect to VCS Providers](/terraform/cloud-docs/vcs) for more information. - The source directory settings in your VCS must specify the path to the module configuration files. ### Repository configuration The registry automatically detects module names and versions in the repository. Your module repository must meet all of the following requirements before adding it to the registry. - The repository must be in one of your configured [VCS providers][vcs]. - The HCP Terraform or Terraform Enterprise user account must have admin access to the repository. The registry needs admin access to create the webhooks to import new module versions. - GitLab repositories must be in the main organization or group and not in any subgroups. - Subfolders that contain module source code must adhere to the [standard module structure](/terraform/language/modules/develop/structure) so that the registry can inspect your module, generate documentation, and track resource usage. ### Release tag prefixes In a repository that contains code for multiple modules, specify a prefix to filter repository Git tags when using the [tag-based publishing type](#tag-based-publishing-considerations). Without a prefix, HCP Terraform and Terraform Enterprise publish new versions for all modules with valid Git tags that use semantic versioning. For example, you could use the following release tags in your Git repository: - `v1.0.0` - `app-v1.0.0` Then, you could specify `app-` in the \*\*Module Tag Prefix\*\* field when configuring the settings for publishing modules in HCP Terraform or Terraform Enterprise. As a result, the platform selects the module tagged with `app-v1.0.0` and publishes `v1.0.0` to the registry. In this example, HCP Terraform or Terraform Enterprise would also publish version `v1.0.1` of the module when a new release in the repository is tagged with `app-v1.0.1`. To change the default behavior, you can disable the \*\*Publish modules to your private registry from a single repository\*\* option in your organization settings. When disabled, you should store the source code for each module in separate repositories, otherwise HCP Terraform and Terraform Enterprise may publish new versions of all modules in the repository each time you create a new release tag. ## Publish a new module You can | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-modules.mdx | main | terraform | [
-0.033886250108480453,
-0.03382578864693642,
-0.04269443824887276,
0.027946704998612404,
0.02055446244776249,
0.019247058779001236,
-0.03296203911304474,
-0.029425015673041344,
0.039557069540023804,
0.06984959542751312,
0.04597879573702812,
-0.03625723719596863,
0.02562740631401539,
-0.012... | 0.036548 |
option in your organization settings. When disabled, you should store the source code for each module in separate repositories, otherwise HCP Terraform and Terraform Enterprise may publish new versions of all modules in the repository each time you create a new release tag. ## Publish a new module You can publish modules using either the UI or API. Refer to [Publish a Private Module from a VCS](/terraform/cloud-docs/api-docs/private-registry/modules#publish-a-private-module-from-a-vcs) for instructions on using API. Note that you can also call the API to publish modules without a VCS repository as the source, which is not possible in the UI. 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to publish a module. 1. Select \*\*Registry\*\* from the sidebar. 1. Choose \*\*Module\*\* from the \*\*Publish\*\* and drop-down menu. The \*\*Add Module\*\* page appears with a list of available repositories. 1. Click on a VCS connection. The screen advances to the \*\*Configure VCS Settings\*\* step. 1. In the \*\*Select a VCS Repository\*\* field, choose the repository containing your modules' source code. You can search the list by typing part or all of a repository name into the filter field. VCS providers use `/` strings to locate repositories. The namespace is an organization name for most providers, but Bitbucket Data Center, not Bitbucket Cloud, uses project keys, such as `INFRA`. 1. Enable either the \*\*Tag\*\* or \*\*Branch\*\* module publishing type. Refer to [Tag-based publishing considerations](#tag-based-publishing-considerations) and [Branch-based publishing considerations](#branch-based-publishing-considerations) for more information. 1. Complete the fields for your publishing type. When \*\*Tag\*\* is enabled: - In the \*\*Module Tag Prefix\*\* field, specify a Git tag prefix. The registry uses the prefix and a release version as a unique identifier when sourcing code for multiple modules in a single repository. Refer to [Release tag prefixes](#release-tag-prefixes) for more information about setting up tags. - In the \*\*Source Directory\*\* field, specify the path to the module source code. When \*\*Branch\*\* is enabled: - In the \*\*Branch Name\*\* field, specify the name of the branch to scan for the module code. - In the \*\*Module Version\*\* field, specify the version of the module. - In the \*\*Source Directory\*\* field, specify the path to the module source code. 1. Click \*\*Next\*\* to advance to the \*\*Confirm selection\*\* screen. 1. In the \*\*Module Name\*\* field, specify a name for the module. This is the name that appears in the registry. HCP Terraform and Terraform Enterprise use the name in the module address. 1. In the \*\*Provider Name\*\* field, specify the name of the provider that integrates the module. HCP Terraform and Terraform Enterprise use the name in the module address. 1. It is optional, but if this module is a [no-code ready module](/terraform/cloud-docs/workspaces/no-code-provisioning/module-design), enable the \*\*Add Module to no-code provision allowlist\*\* option to allow your organization members to provision resources defined by this module using the no-code workflow. Refer to [Provision no-code infrastructure](/terraform/cloud-docs/workspaces/no-code-provisioning/provisioning) for more information. @include 'tfc-package-callouts/nocode.mdx' 1. Click \*\*Publish module\*\*. HCP Terraform and Terraform Enterprise displays a loading page while it imports the module versions and then directs you to the new module's details page. On the details page, you can view available versions, read documentation, and copy a usage example. ### Tag-based publishing considerations To enable the \*\*Tag\*\* module publishing type, your registry must use the `x.y.z` format for release tags to identify module versions. Your repository must contain at least one release tag for you to publish a module. Release tag names must be a [semantic version](http://semver.org), which you can optionally prefix with a `v`. For example, `v1.0.4` and `0.9.2`. The registry ignores tags that do not match these | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-modules.mdx | main | terraform | [
-0.00273302779532969,
-0.051420796662569046,
-0.03664948046207428,
0.02195633016526699,
0.005589573178440332,
0.026495305821299553,
-0.10969166457653046,
-0.06746458262205124,
0.027887117117643356,
0.09126319736242294,
0.01612616330385208,
-0.026637578383088112,
0.05390439182519913,
-0.040... | 0.001528 |
tags to identify module versions. Your repository must contain at least one release tag for you to publish a module. Release tag names must be a [semantic version](http://semver.org), which you can optionally prefix with a `v`. For example, `v1.0.4` and `0.9.2`. The registry ignores tags that do not match these formats. To publish modules from a single repository, you should also include a tag prefix so that HCP Terraform can publish individual modules in the repository when you create new version tags. Refer to [Release tag prefixes](#release-tag-prefixes) for more information. ### Branch-based publishing considerations To enable the \*\*Branch\*\* module publishing type, you must provide the name of an existing branch in your VCS repository and provide the module with a module version. Your VCS repository does not need to contain a matching tag or release. You can only enable testing on modules published using branch-based publishing. Refer to the [test-integrated modules](/terraform/cloud-docs/registry/test) documentation for more information. Module testing is disabled when the \*\*Publish modules to your private registry from a single repository\*\* option is enabled in your workspace's general settings. ## Release new module versions The process to release a new module version differs between the tag-based and branch-based publishing workflows. ### Tag-based publishing workflow To release a new version of a module in the tag-based publishing workflow, push a new release tag to its VCS repository. The registry automatically imports the new version. Refer to [Preparing a Module Repository](#preparing-a-module-repository) for details about release tag requirements. ### Branch-based publishing workflow To release a new version of a module using the branch-based publishing workflow, navigate to the module overview screen, then click the \*\*Publish New Version\*\* button. Select the commit SHA that the new version will point to, and assign a new module version. You cannot re-use an existing module version. ## Update publish settings After publishing your module, you can change between tag-based and branch-based publishing. To update your module's publish settings, navigate to the the module overview page, click the \*\*Manage Module for Organization\*\* dropdown, and then click \*\*Publish Settings\*\*. - To change from tag-based to branch-based publishing, you must configure a \*\*Module branch\*\* and [create a new module version](#branch-based-publishing-workflow), as HCP Terraform will not automatically create one. - To change from branch-based publishing to tag-based publishing, you must create at least one tag in your VCS repository. ## Delete versions and modules You can delete individual versions of a module or the entire module. Deleting a tag from your VCS repository does not automatically remove the version from the private registry. If deleting a module version would leave a module with no versions, HCP Terraform removes the entire module. To delete a module or version: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the module's details page. 1. If you want to delete a single version, use the \*\*Versions\*\* menu to select it. 1. Click \*\*Delete module\*\*. 1. Select an action from the menu: - \*\*Delete only this module version:\*\* Deletes only the version of the module you were viewing when you clicked \*\*Delete module\*\*. - \*\*Delete all versions for this provider for this module:\*\* Deletes the entire module for a single provider. This action is important if you have modules with the same name but with different providers. For example, if you have module repos named `terraform-aws-appserver` and `terraform-azure-appserver`, the registry treats them as alternate providers of the same `appserver` module. - \*\*Delete all providers and versions for this module:\*\* Deletes all modules with this name, even if they are from different providers. For example, this action deletes both `terraform-aws-appserver` and `terraform-azure-appserver`. 1. Type | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-modules.mdx | main | terraform | [
0.01823953539133072,
-0.04553361237049103,
0.007699673064053059,
-0.0020425422117114067,
0.005968845449388027,
-0.003168324241414666,
-0.05901763588190079,
-0.04068687558174133,
-0.01361026056110859,
0.0509004145860672,
0.05598876252770424,
-0.06266318261623383,
0.039333514869213104,
-0.02... | -0.00635 |
repos named `terraform-aws-appserver` and `terraform-azure-appserver`, the registry treats them as alternate providers of the same `appserver` module. - \*\*Delete all providers and versions for this module:\*\* Deletes all modules with this name, even if they are from different providers. For example, this action deletes both `terraform-aws-appserver` and `terraform-azure-appserver`. 1. Type the module name and click \*\*Delete\*\*. ### Restore a deleted module or version Deletion is permanent, but there are ways to restore deleted modules and module versions. - To restore a deleted module, re-add it as a new module. - To restore a deleted version, either delete the corresponding tag from your VCS and push a new tag with the same name, or delete the entire module from the registry and re-add it. ## Share modules across organizations HCP Terraform does not typically allow one organization's workspaces to use private modules from a different organization. This restriction is because HCP Terraform gives Terraform temporary credentials to access modules that are only valid for that workspace's organization. Although it is possible to mix modules from multiple organizations when you run Terraform on the command line, we strongly recommend against it. Instead, you can share modules across organizations by sharing the underlying VCS repository. Grant each organization access to the module's repository, and then add the module to each organization's registry. When you push tags to publish new module versions, both organizations update accordingly. Terraform Enterprise administrators can configure [module sharing](/terraform/enterprise/admin/application/registry-sharing) to allow organizations to use private modules from other organizations. ## Generate module tests @include 'beta.mdx' You can generate and run generated tests for your module with [the `terraform test` command](/terraform/cli/commands/test). Before you can generate tests for a module, it must have at least one version published. Tests can only be generated once per module and are intended to be reviewed by the module's authors before being checked into version control and maintained with the rest of the module's content. If the module's configuration files exceed 128KB in total size, HCP Terraform will not be able to generate tests for that module. You must have [permission to manage registry modules](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-private-registry) and [permission to manage module test generation](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-module-test-generation-beta) to generate tests. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-modules.mdx | main | terraform | [
-0.08596344292163849,
-0.06420252472162247,
-0.028994359076023102,
-0.018769266083836555,
0.05155263841152191,
0.012677262537181377,
-0.009008422493934631,
-0.13359205424785614,
0.046858880668878555,
0.03840264305472374,
0.06364504247903824,
0.004657624755054712,
0.066465362906456,
0.03300... | -0.000033 |
# Use the configuration designer HCP Terraform's private registry includes a configuration designer that can help you spend less time writing boilerplate code in a module-centric Terraform workflow. The configuration designer lets you outline a configuration for a new workspace by choosing any number of private modules. It then lists those modules' variables as a fillable HTML form, with a helper interface for finding values that you can interpolate. When you are finished, the designer returns the text of a `main.tf` configuration. This is the same Terraform code you would have written in your text editor. ## Accessing the Configuration Designer Go to your organization's private registry, and then click \*\*<\> Design Configuration\*\*. The \*\*Select Modules\*\* page appears. ## Adding Modules Filter and search the left side of the \*\*Select Modules\*\* page to find private modules that you can add to your configuration. Click \*\*Add Module\*\* for all of the modules you want to use in your configuration. These modules appear in the \*\*Selected Modules\*\* list on the right side of the page. ### Setting Versions Selecting a module adds its most recent version to the configuration. To specify a different version: 1. Click the module's version number from the \*\*Selected Modules\*\* list on the right. 1. Select an alternate version from the menu. ## Setting Variables When you finish selecting modules, click \*\*Next »\*\* to go to the \*\*Set Variables\*\* page. The left side of this page lists your chosen modules, and the right side lists all variables for the currently selected module. Each variable is labeled as required or optional. You can switch between modules without losing your work; click a module's \*\*Configure\*\* button to switch to its variable list. Once you set a value for all of a module's required variables, its \*\*Configure\*\* button changes to a green \*\*Configured\*\* button. ### Interpolation Searching Variable values can be literal strings, or can interpolate other values. When you start typing an interpolation token (`${`), the designer displays a help message. As you continue typing, it searches the available outputs in your other selected modules, as well as outputs from workspaces where you are authorized to read state outputs. You can select one of these search results, or type a full name if you need to reference a value HCP Terraform does not know about. [permissions-citation]: #intentionally-unused---keep-for-maintainers ### Deferring Variables Sometimes, configuration users should be able to set certain variables according to their use cases. Select the \*\*Deferred\*\* checkbox to delegate a variable to configuration users. This ties the variable's value to a new top-level Terraform variable with no default value. All users that create a workspace from your configuration will have to provide a value for that variable. ## The Output Configuration When all modules are configured, click \*\*Next »\*\*. The \*\*Publish\*\* page appears. Use the \*\*Preview configuration\*\* menu to review the generated code. The configuration designer does not create any repositories or workspaces. To create workspaces with the configuration, you must download the generated code, save it as the `main.tf` file in a new directory, and commit it to version control. After you download the code, you can make any necessary changes or additions. For example, you may want to add non-module resources. When you are sure you have downloaded the results, click \*\*Done\*\* to discard the configuration. HCP Terraform does not save output from previous configuration designer runs. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/design.mdx | main | terraform | [
-0.04051299765706062,
0.024049261584877968,
-0.021221531555056572,
0.013179420493543148,
0.005626922473311424,
-0.00761213107034564,
-0.05981694161891937,
-0.0389319472014904,
-0.041828300803899765,
0.08039737492799759,
-0.03994804620742798,
-0.06596031039953232,
0.07428555935621262,
-0.04... | 0.066503 |
HCP Terraform does not save output from previous configuration designer runs. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/design.mdx | main | terraform | [
0.04404082149267197,
0.055124878883361816,
0.016705114394426346,
0.007703529205173254,
0.009097657166421413,
0.02246668189764023,
-0.09167511761188507,
-0.09408906102180481,
-0.04142322018742561,
0.03636155277490616,
-0.030526177957654,
-0.07122088223695755,
0.06202815845608711,
-0.0680595... | -0.079019 |
# Publish private providers to the HCP Terraform private registry In addition to [curating public providers from the Terraform Registry](/terraform/cloud-docs/registry/add), you can publish private providers to an organization's HCP Terraform private registry. Once you have published a private provider through the API, members of your organization can search for it in the private registry UI and use it in configurations. ## Requirements Review the following before publishing a new provider or provider version. ### Permissions Users must be members of an organization to access its registry and private providers. In Terraform Enterprise, providers are also available to organizations that you configure to [share registry access](/terraform/enterprise/admin/application/registry-sharing). You must be a member of the [owners team](/terraform/cloud-docs/users-teams-organizations/permissions/organization#organization-owners) or a team with [Manage Private Registry permissions](/terraform/cloud-docs/users-teams-organizations/permissions/organization#manage-private-registry) to publish and delete private providers from the private registry. ### Release files You must publish at least one version of your provider that follows [semantic versioning format](http://semver.org). For each version, you must upload the `SHA256SUMS` file, `SHA256SUMS.sig` file, and one or more provider binaries. Using GoReleaser to [create a release on GitHub](/terraform/registry/providers/publishing#creating-a-github-release) or [create a release locally](/terraform/registry/providers/publishing#using-goreleaser-locally) generates these files automatically. The private registry does not have strict naming conventions, but we recommend using GoReleaser file naming schemes for consistency. Private providers do not currently support documentation. ### Signed releases GPG signing is required for private providers, and you must upload the public key of the GPG keypair used to sign the release. Refer to [Preparing and Adding a Signing Key](/terraform/registry/providers/publishing#preparing-and-adding-a-signing-key) for more details. Unlike the public Terraform Registry, the private registry does not automatically upload new releases. You must manually add new provider versions and the associated release files. -> \*\*Note\*\*: If you are using the [provider API](/terraform/cloud-docs/api-docs/private-registry/providers) to upload an official HashiCorp public provider into your private registry, use [HashiCorp's public PGP key](https://www.hashicorp.com/.well-known/pgp-key.txt). You do not need to upload this public key, and it is automatically included in Terraform Enterprise version v202309-1 and newer. ## Publishing a provider Before consumers can use a private provider, you must do the following: 1. [Create the provider](#create-the-provider) 2. [Upload a GPG signing key](#add-your-public-key) 3. [Create at least one version](#create-a-version) 4. [Create at least one platform for that version](#create-a-provider-platform) 5. [Upload release files](#upload-provider-binary) ### Create the provider Create a file named `provider.json` with the following contents. Replace `PROVIDER\_NAME` with the name of your provider and replace `ORG\_NAME` with the name of your organization. ```json { "data": { "type": "registry-providers", "attributes": { "name": "PROVIDER\_NAME", "namespace": "ORG\_NAME", "registry-name": "private" } } } ``` Use the [Create a Provider endpoint](/terraform/cloud-docs/api-docs/private-registry/providers#create-a-provider) to create the provider in HCP Terraform. Replace `TOKEN` in the `Authorization` header with your HCP Terraform API token and replace `ORG\_NAME` with the name of your organization. ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @provider.json \ https://app.terraform.io/api/v2/organizations/ORG\_NAME/registry-providers ``` The provider is now available in your organization’s HCP Terraform private registry, but consumers cannot use it until you add a version and a platform. To create a version and a platform, you need the following resources: \* The Provider binaries \* A public GPG signing key \* A `SHA256SUMS` file \* A `SHA256SUMS.sig` file from at least one release ### Add your public key -> \*\*Note\*\*: If you are uploading an official HashiCorp public provider into your private registry, skip this step and instead use [HashiCorp's public PGP key](https://www.hashicorp.com/.well-known/pgp-key.txt) in the the [create a version](#create-a-version) step. The key ID for HashiCorp's public ID is `34365D9472D7468F`, and you can verify the ID by [importing the public key locally](/terraform/tutorials/cli/verify-archive#download-and-import-hashicorp-s-public-key). Create a file named `key.json` with the following contents. Replace `ORG\_NAME` with the name of | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-providers.mdx | main | terraform | [
-0.012579026632010937,
-0.011255146004259586,
-0.027422374114394188,
0.005256079137325287,
-0.025465218350291252,
0.017776433378458023,
-0.0272675808519125,
-0.05251257121562958,
-0.017714552581310272,
0.07499814033508301,
0.011839437298476696,
-0.05273284390568733,
0.04577906057238579,
0.... | 0.019267 |
and instead use [HashiCorp's public PGP key](https://www.hashicorp.com/.well-known/pgp-key.txt) in the the [create a version](#create-a-version) step. The key ID for HashiCorp's public ID is `34365D9472D7468F`, and you can verify the ID by [importing the public key locally](/terraform/tutorials/cli/verify-archive#download-and-import-hashicorp-s-public-key). Create a file named `key.json` with the following contents. Replace `ORG\_NAME` with the name of your organization, and input your public key in an RSA or DSA format in the `ascii-armor` field. ```hcl { "data": { "type": "gpg-keys", "attributes": { "namespace": "ORG\_NAME", "ascii-armor": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINB...=txfz\n-----END PGP PUBLIC KEY BLOCK-----\n" } } } ``` Use the [Add a GPG key endpoint](/terraform/cloud-docs/api-docs/private-registry/gpg-keys#add-a-gpg-key) to add the public key that matches the signing key for the release. Replace `TOKEN` in the `Authorization` header with your HCP Terraform API token. ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @key.json \ https://app.terraform.io/api/registry/private/v2/gpg-keys ``` The response contains a `key-id` that you will use to create a provider version. ```json "key-id": "34365D9472D7468F" ``` ### Create a version Create a file named `version.json` with the following contents. Replace the value of the `version` field with the version of your provider, and replace the `key-id` field with the id of the GPG key that you created in the [Add your public key](#add-your-public-key) step. If you are uploading an official HashiCorp public provider, use the value `34365D9472D7468F` for your `key-id`. ```hcl { "data": { "type": "registry-provider-versions", "attributes": { "version": "5.14.0", "key-id": "34365D9472D7468F", "protocols": ["5.0"] } } } ``` Use the [Create a Provider Version endpoint](/terraform/cloud-docs/api-docs/private-registry/provider-versions-platforms#create-a-provider-version) to create a version for your provider, and replace the following values: 1. Replace `TOKEN` in the `Authorization` header with your HCP Terraform API token. 1. Replace both instances of `ORG\_NAME` with the name of your organization. 1. Replace `TF\_PROVIDER\_NAME` with your provider name. ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @version.json \ https://app.terraform.io/api/v2/organizations/ORG\_NAME/registry-providers/private/ORG\_NAME/TF\_PROVIDER\_NAME/versions ``` The response includes URL links that you will use to upload the `SHA256SUMS` and `SHA256.sig` files. ```json "links": { "shasums-upload": "https://archivist.terraform.io/v1/object/dmF1b64hd73ghd63", "shasums-sig-upload": "https://archivist.terraform.io/v1/object/dmF1b37dj37dh33d" } ``` ### Upload signatures Upload the `SHA256SUMS` and `SHA256SUMS.sig` files to the URLs [returned in the previous step](#create-a-version). The example command below uploads the files from your local machine. First upload the `SHA256SUMS` file to the URL returned in the `shasums-upload` field. ```shell-session $ curl \ -T terraform-provider-aws\_5.14.0\_SHA256SUMS \ https://archivist.terraform.io/v1/object/dmF1b64hd73ghd63... ``` Next, upload the `SHA256SUMS.sig` file to the URL returned in the `shasums-sig-upload` field. ```shell-session $ curl \ -T terraform-provider-aws\_5.14.0\_SHA256SUMS.72D7468F.sig \ https://archivist.terraform.io/v1/object/dmF1b37dj37dh33d... ``` ### Create a provider platform First, calculate the SHA256 hash of the provider binary that you intend to upload. This should match the SHA256 hash of the file listed in the `SHA256SUMS` file. ```shell-session $ shasum -a 256 terraform-provider-aws\_5.14.0\_linux\_amd64.zip f1d83b3e5a29bae471f9841a4e0153eac5bccedbdece369e2f6186e9044db64e terraform-provider-aws\_5.14.0\_linux\_amd64.zip ``` Next, create a file named `platform.json`. Replace the `os`, `arch`, `filename`, and `shasum` fields with the values that match the provider you intend to upload. ```json { "data": { "type": "registry-provider-version-platforms", "attributes": { "os": "linux", "arch": "amd64", "shasum": "f1d83b3e5a29bae471f9841a4e0153eac5bccedbdece369e2f6186e9044db64e", "filename": "terraform-provider-aws\_5.14.0\_linux\_amd64.zip" } } } ``` Use the [Create a Provider Platform endpoint](/terraform/cloud-docs/api-docs/private-registry/provider-versions-platforms#create-a-provider-platform) to create a platform for the version. Platforms are binaries that allow the provider to run on a particular operating system and architecture combination (e.g., Linux and AMD64). Replace `TOKEN` in the `Authorization` header with your HCP Terraform API token and replace both instances of `ORG\_NAME` with the name of your organization. ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @platform.json \ https://app.terraform.io/api/v2/organizations/ORG\_NAME/registry-providers/private/ORG\_NAME/aws/versions/5.14.0/platforms ``` The response includes a `provider-binary-upload` URL that you will use to upload the binary file for the platform. ```json "links": | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-providers.mdx | main | terraform | [
-0.022690944373607635,
0.055337391793727875,
-0.045513786375522614,
-0.0255491454154253,
-0.015485920011997223,
-0.03339826688170433,
-0.06716971844434738,
-0.08327101916074753,
0.016627322882413864,
0.05221745744347572,
-0.004590052179992199,
-0.05339132621884346,
0.02672983519732952,
-0.... | -0.014175 |
instances of `ORG\_NAME` with the name of your organization. ```shell-session $ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @platform.json \ https://app.terraform.io/api/v2/organizations/ORG\_NAME/registry-providers/private/ORG\_NAME/aws/versions/5.14.0/platforms ``` The response includes a `provider-binary-upload` URL that you will use to upload the binary file for the platform. ```json "links": { "provider-binary-upload": "https://archivist.terraform.io/v1/object/dmF1b45c367djh45nj78" } ``` ### Upload provider binary Upload the platform binary file to the `provider-binary-upload` URL returned in the [previous step](#create-a-version). The example command below uploads the binary from your local machine. ```shell-session $ curl -T local-example/terraform-provider-random\_5.14.0\_linux\_amd64.zip https://archivist.terraform.io/v1/object/dmF1b45c367djh45nj78 ``` The version is available in the HCP Terraform user interface. Consumers can now begin using this provider version in configurations. You can repeat these steps starting from [Create a provider platform](#create-a-provider-platform) to add additional platform binaries for the release. ## Checking Release Files Consumers cannot use a private provider version until you upload all required [release files](#release-files). To determine whether these files have been uploaded: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization where you want to publish a private provider. 1. Click \*\*Registry\*\* and click the private provider to go to its details page. 1. Use the version menu to navigate to the version you want to check. The UI shows a warning banner for versions that do not have all required release files. 1. Open the \*\*Manage Provider\*\* menu and select \*\*Show release files\*\*. The \*\*Release Files\*\* page appears containing lists of uploaded and missing files for the current version. ## Managing private providers Use the HCP Terraform API to create, read, update, and delete the following: - [GPG keys](/terraform/cloud-docs/api-docs/private-registry/gpg-keys) - [Private providers](/terraform/cloud-docs/api-docs/private-registry/providers) - [Provider versions and platforms](/terraform/cloud-docs/api-docs/private-registry/provider-versions-platforms) ## Deleting private providers and versions In addition to the [Registry Providers API](/terraform/cloud-docs/api-docs/private-registry/providers#delete-a-provider), you can delete providers and provider versions through the HCP Terraform UI. To delete providers and versions in the UI: 1. Sign in to [HCP Terraform](https://app.terraform.io/) or Terraform Enterprise and navigate to the organization whose private registry you want to delete a provider or provider version from. 1. Click \*\*Registry\*\* and click the private provider to go to its details page. 1. If you want to delete a single version, use the \*\*Versions\*\* menu to select it. 1. Open the \*\*Manage Provider\*\* menu and select \*\*Delete Provider\*\*. The \*\*Delete Provider from Organization\*\* box appears. 1. Select an action from the menu: - \*\*Delete only this provider version:\*\* Deletes only the version of the provider you are currently viewing. - \*\*Delete all versions for this provider:\*\* Deletes the entire provider and all associated versions. 1. Type the provider name into the confirmation box and click \*\*Delete\*\*. The provider version or entire provider has been deleted from this organization's private registry and its data has been removed. Consumers will no longer be able to reference it in configurations. ### Restoring a deleted provider Deletion is permanent, but you can restore a deleted private provider by re-adding it to your organization and recreating its versions and platforms. | https://github.com/hashicorp/web-unified-docs/blob/main//content/terraform-docs-common/docs/cloud-docs/registry/publish-providers.mdx | main | terraform | [
-0.04590954631567001,
0.014096505008637905,
-0.032182853668928146,
-0.029213305562734604,
0.0018046186305582523,
-0.0487714521586895,
-0.09262599796056747,
-0.011566569097340107,
0.03185390681028366,
0.12450224161148071,
-0.028777282685041428,
-0.04249155893921852,
0.028648963198065758,
-0... | 0.046045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.