-
Notifications
You must be signed in to change notification settings - Fork 106
Update HCP Terraform Secrets Engine docs to clarify API token types, scope limitations, and usage examples #1268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
resolves #1267 |
Vercel Previews Deployed
|
Broken Link CheckerNo broken links found! 🎉 |
| HCP Terraform [Account | ||
| API](/terraform/cloud-docs/api-docs/account) to find the | ||
| desired User ID. | ||
| to determine the appropriate API token for use with the secret engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| to determine the appropriate API token for use with the secret engine. | |
| to determine the appropriate API token for Terraform plugin. |
| Vault issues dynamic Team API tokens by mapping a role to an existing HCP Terraform | ||
| team. Vault manages these tokens’ lifecycle and automatically expires them according | ||
| to the role’s `ttl` and `max_ttl`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Vault issues dynamic Team API tokens by mapping a role to an existing HCP Terraform | |
| team. Vault manages these tokens’ lifecycle and automatically expires them according | |
| to the role’s `ttl` and `max_ttl`. | |
| Vault issues dynamic API tokens by mapping the Terrafrom role to an existing | |
| HCP Terraform team. Vault also manages the API token lifecycle and | |
| automatically expires the token according to the `ttl` and `max_ttl` | |
| settings on the role. |
Style correction: avoid possessives, reserve capitalization for product names
| You will need to know the Team ID in order to generate Team API tokens for that team. You | ||
| can use the HCP Terraform Teams API to find the desired Team ID. To find the Team ID, use the | ||
| [HCP Terraform Teams API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/teams) | ||
| or navigate to the Teams section in the HCP Terraform UI. Similarly, to find a User ID, use the | ||
| [Account Details API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/account#show-the-current-user) | ||
| or check your user profile in the UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You will need to know the Team ID in order to generate Team API tokens for that team. You | |
| can use the HCP Terraform Teams API to find the desired Team ID. To find the Team ID, use the | |
| [HCP Terraform Teams API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/teams) | |
| or navigate to the Teams section in the HCP Terraform UI. Similarly, to find a User ID, use the | |
| [Account Details API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/account#show-the-current-user) | |
| or check your user profile in the UI. | |
| You need to know your Terraform team ID or user ID to generate API tokens | |
| for that client: | |
| - To find your team ID, use the | |
| [HCP Terraform Teams API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/teams) | |
| or navigate to the **Teams** section in the HCP Terraform GUI. | |
| - To find a user ID, use the | |
| [Account Details API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/account#show-the-current-user) | |
| or check your user profile in the HCP Terraform GUI. |
Style correction: write in active voice, reserve capitalization for product/endpoint names
|
|
||
| Generate a new credential by reading from the `/creds` endpoint with the name | ||
| of the role: | ||
| Generate a new token by reading from the `/creds` endpoint with the role name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Generate a new token by reading from the `/creds` endpoint with the role name: | |
| Generate a new token by calling the `/creds` endpoint with the role name: |
| ~> **IMPORTANT:** When selecting an anchor credential for the Terraform Secrets | ||
| Engine, choose a token whose scope matches your intended use case. For example, a | ||
| user token can only manage that user’s own resources, while a team token can manage | ||
| team-level resources or other teams’ tokens if the appropriate permissions are granted. | ||
| Using a token that is too narrowly scoped may prevent Vault from issuing tokens for your | ||
| intended workflows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ~> **IMPORTANT:** When selecting an anchor credential for the Terraform Secrets | |
| Engine, choose a token whose scope matches your intended use case. For example, a | |
| user token can only manage that user’s own resources, while a team token can manage | |
| team-level resources or other teams’ tokens if the appropriate permissions are granted. | |
| Using a token that is too narrowly scoped may prevent Vault from issuing tokens for your | |
| intended workflows. | |
| When you select an anchor credential for the Terraform plugin, always choose a | |
| token with a scope that matches your intended use case. | |
| User tokens should only have permission to manage the resources owned by that | |
| user. Team tokens should only have permission to manage team-level resources | |
| owned by that team. Only create tokens with cross-team permissions when a more | |
| narrowly-defined scope prevents Vault from issuing appropriate tokens or | |
| interferes with your intended workflows. |
Style correction: write in active voice, provide explicit guidance whenever possible, avoid unnecessary callouts (warnings, tips, etc.)
| Traditionally, Vault secrets engines create dynamic users and credentials for those users. | ||
| At this time, the HCP Terraform API does not support creating dynamic users. Instead, the | ||
| HCP Terraform secrets engine issues dynamic User API tokens by configuring a Vault role to | ||
| manage an existing HCP Terraform user. | ||
|
|
||
| Vault manages the lifecycle of these tokens and automatically expires them based on the | ||
| role’s configured `ttl` and `max_ttl`. Keep in mind that User API tokens are scoped to the | ||
| individual user account — they cannot create or manage tokens for other users. If you need | ||
| Vault to issue tokens that operate across teams or support automation workflows, use a team | ||
| API token instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Traditionally, Vault secrets engines create dynamic users and credentials for those users. | |
| At this time, the HCP Terraform API does not support creating dynamic users. Instead, the | |
| HCP Terraform secrets engine issues dynamic User API tokens by configuring a Vault role to | |
| manage an existing HCP Terraform user. | |
| Vault manages the lifecycle of these tokens and automatically expires them based on the | |
| role’s configured `ttl` and `max_ttl`. Keep in mind that User API tokens are scoped to the | |
| individual user account — they cannot create or manage tokens for other users. If you need | |
| Vault to issue tokens that operate across teams or support automation workflows, use a team | |
| API token instead. | |
| Traditionally, Vault secrets engines create dynamic users and credentials for those users. | |
| The HCP Terraform API does not support creating dynamic users so the Terraform | |
| plugin issues dynamic User API tokens by configuring Vault roles to manage | |
| existing HCP Terraform users. | |
| Vault manages the lifecycle of user tokens and automatically expires them based | |
| on the `ttl` and `max_ttl` values of the role. Vault scopes User API tokens to | |
| the individual user account. As a result, the associated account cannot create | |
| or manage tokens for other users. Use a team API token if you need Vault to | |
| issue tokens that operate across teams or support automation workflows. |
Style correction: avoid cross-sentence pronouns, avoid em dashes, avoid possessives
| API token instead. | ||
|
|
||
| Below is an example of creating a Vault role to manage manage User API tokens: | ||
| Below is an example of creating a Vault role to manage User API tokens: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Below is an example of creating a Vault role to manage User API tokens: | |
| The `terraform/role/{user}` endpoint can create a Vault role to manage User API tokens. For example: |
| taken according to `ttl` and `max_ttl` settings. In addition to that behavior, | ||
| using the `max_ttl` Vault will set an `ExpiredAt` date in HCP Terraform | ||
| which will ensure the token expires at the Max TTL time. This prevents | ||
| which will ensure the token expires at the `max_ttl` time. This prevents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| which will ensure the token expires at the `max_ttl` time. This prevents | |
| which ensures that the token expires at the `max_ttl` time and prevents |
Style correction: write in active voice, avoid "this" as a pronoun
| collisions, the secret engine generates a random string as a suffix to the description. It is | ||
| highly recommended you set an additional description. | ||
| collisions, the secret engine generates a random string as a suffix to the description. | ||
| It is highly recommended you set an additional description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| It is highly recommended you set an additional description. | |
| We highly recommended setting an additional description. |
Style correction: write in active voice
| It is highly recommended you set an additional description. | ||
|
|
||
| Below is an example of creating a Vault role to manage manage Team API tokens: | ||
| Below is an example of creating a Vault role to manage Team API tokens: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Below is an example of creating a Vault role to manage Team API tokens: | |
| For example, to set a description when you create a Vault role to manage Team API tokens, use the `description` parameter: |
This update revises the HCP Terraform Secrets Engine documentation to:
These changes improve accuracy and help prevent misconfiguration in real-world Vault deployments.