Skip to content

Commit eb9d3b8

Browse files
authored
Merge branch 'main' into RK/tfe-may-release-to-tfc
2 parents d9e55d9 + d4a2dca commit eb9d3b8

File tree

10 files changed

+192
-19
lines changed

10 files changed

+192
-19
lines changed

content/terraform-docs-common/docs/cloud-docs/integrations/service-now/service-catalog-terraform/index.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,12 @@ Terraform.
110110
**Save the organization name for later.**
111111
2. [Create a team](/terraform/cloud-docs/users-teams-organizations/teams) for that
112112
organization called "ServiceNow", and ensure that it has [permission to
113-
manage
114-
workspaces](/terraform/cloud-docs/users-teams-organizations/permissions#manage-all-workspaces).
113+
manage workspaces](/terraform/cloud-docs/users-teams-organizations/permissions#manage-all-workspaces).
115114
You do not need to add any users to this team.
116115
[permissions-citation]: #intentionally-unused---keep-for-maintainers
117116
3. On the "ServiceNow" team's settings page, generate a [team API
118-
token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens).
117+
token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens). HCP Terraform now supports fine-grained permissions for team tokens at the project level. You can assign teams and their associated tokens permission levels on specific projects. To learn more about the different permissions necessary to provision resources, refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions#project-permissions).
119118
**Save the team API token for later.**
120-
4. After [generating a team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens) in HCP Terraform, you can add that token to your ServiceNow context by doing the following:
121-
1. Navigate to **Terraform Configs** in ServiceNow
122-
2. Select **New** and add your token.
123-
3. Use your HCP Terraform team name as your **Org name**.
124119
5. If you are using the [VCS flow](/terraform/cloud-docs/integrations/service-now/service-catalog-terraform/service-catalog-config#vcs-configuration):
125120
1. Ensure your Terraform organization is [connected to a VCS provider](/terraform/cloud-docs/vcs). Repositories that are connectable to HCP Terraform workspaces can also be used as workspace templates in the ServiceNow integration.
126121
2. On your organization's VCS provider settings page (**Settings** > **VCS Providers**), find the OAuth Token ID for the VCS provider(s) that you intend to use with the ServiceNow integration. HCP Terraform uses the OAuth token ID to identify and authorize the VCS provider. **Save the OAuth token ID for later.**
@@ -224,8 +219,7 @@ update request items.
224219
### Team Tokens
225220

226221
Team-scoped tokens can help you manage a team's access to things in HCP Terraform, but team tokens are limited within the ServiceNow context. We recommend only using one API team token, regardless of the number of teams accessing ServiceNow.
227-
228-
You can assign teams and their associated tokens permission levels on specific projects. To learn more about the different permissions necessary to provision resources, refer to [Permissions](/terraform/cloud-docs/users-teams-organizations/permissions#project-permissions). To learn more about API tokens, refer to [Team tokens](https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens).
222+
To learn more about API tokens, refer to [Team tokens](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens).
229223

230224
### ServiceNow Developer Reference
231225

content/terraform-enterprise/v202505-1/data/enterprise-nav-data.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
}
5353
]
5454
},
55+
{ "title": "Ping", "path": "api-docs/ping" },
56+
{ "title": "Usage Bundle", "path": "api-docs/usage-bundle" },
5557
{
5658
"title": "Agent Pools",
5759
"path": "api-docs/agents"

content/terraform-enterprise/v202505-1/docs/enterprise/api-docs/index.mdx

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,52 @@ source: terraform-docs-common
3838

3939
[JSON API error object]: https://jsonapi.org/format/#error-objects
4040

41-
# HCP Terraform API documentation
41+
# API Documentation
42+
43+
## HCP Terraform API
4244

4345
HCP Terraform provides an API for a subset of its features. If you need assistance or want to submit a feature request, visit the [HashiCorp support center](https://support.hashicorp.com/hc/en-us) and open a ticket.
4446

4547
-> **Note:** Before planning an API integration, consider whether [the `tfe` Terraform provider](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs) meets your needs. It can't create or approve runs in response to arbitrary events, but it's a useful tool for managing your organizations, teams, and workspaces as code.
4648

4749
HashiCorp provides a [stability policy](/terraform/enterprise/api-docs/stability-policy) for the HCP Terraform API, ensuring backwards compatibility for stable endpoints. The [changelog](/terraform/enterprise/api-docs/changelog) tracks changes to the API for HCP Terraform and Terraform Enterprise.
4850

51+
## API Types
52+
53+
HCP Terraform provides two types of API endpoints:
54+
55+
- **Application Endpoints** - These are the primary endpoints used for interacting with HCP Terraform resources such as workspaces, runs, and variables. Unless otherwise specified, all documentation on this site refers to application endpoints.
56+
- **System Endpoints** - These endpoints are used for system-level operations, such as health checks and usage reporting. System endpoints have different authentication and rate limiting requirements than application endpoints.
57+
58+
### System Endpoints Overview
59+
60+
The following table lists the available system API endpoints in Terraform Enterprise:
61+
62+
| Endpoint | Description | Path | Documentation |
63+
|---------|-------------|------|---------------|
64+
| Ping | Health check endpoint to verify system operation | `/api/v1/ping` | [System Ping API](/terraform/enterprise/api-docs/ping) |
65+
| Usage/Bundle | Retrieves usage data bundle | `/api/v1/usage/bundle` | [System Usage/Bundle API](/terraform/enterprise/api-docs/usage-bundle) |
66+
67+
-> **Terraform Enterprise Only:** The System API is exclusive to Terraform Enterprise. It enables access to deployment configuration and data.
68+
4969
## Authentication
5070

51-
All requests must be authenticated with a bearer token. Use the HTTP header `Authorization` with the value `Bearer <token>`. If the token is absent or invalid, HCP Terraform responds with [HTTP status 401][401] and a [JSON API error object][]. The 401 status code is reserved for problems with the authentication token; forbidden requests with a valid token result in a 404.
71+
### Application Endpoints
72+
73+
For application endpoints, all requests must be authenticated with a bearer token. Use the HTTP header `Authorization` with the value `Bearer <token>`. If the token is absent or invalid, HCP Terraform responds with [HTTP status 401][401] and a [JSON API error object][]. The 401 status code is reserved for problems with the authentication token; forbidden requests with a valid token result in a 404.
5274

5375
You can use the following types of tokens to authenticate:
5476

55-
- [User tokens](/terraform/enterprise/users-teams-organizations/users#api-tokens) each HCP Terraform user can have any number of API tokens, which can make requests on their behalf.
56-
- [Team tokens](/terraform/enterprise/users-teams-organizations/api-tokens#team-api-tokens) each team can have one API token at a time. This is intended for performing plans and applies via a CI/CD pipeline.
57-
- [Organization tokens](/terraform/enterprise/users-teams-organizations/api-tokens#organization-api-tokens) each organization can have one API token at a time. This is intended for automating the management of teams, team membership, and workspaces. The organization token cannot perform plans and applies.
77+
- [User tokens](/terraform/enterprise/users-teams-organizations/users#api-tokens) each HCP Terraform user can have any number of API tokens, which can make requests on their behalf.
78+
- [Team tokens](/terraform/enterprise/users-teams-organizations/api-tokens#team-api-tokens) each team can have one API token at a time. This is intended for performing plans and applies via a CI/CD pipeline.
79+
- [Organization tokens](/terraform/enterprise/users-teams-organizations/api-tokens#organization-api-tokens) each organization can have one API token at a time. This is intended for automating the management of teams, team membership, and workspaces. The organization token cannot perform plans and applies.
5880
<!-- BEGIN: TFC:only -->
59-
- [Audit trails token](/terraform/enterprise/users-teams-organizations/api-tokens#audit-trails-tokens) - each organization can have a single token that can read that organization's audit trails. Use this token type to authenticate integrations pulling audit trail data, for example, using the [HCP Terraform for Splunk](/terraform/enterprise/integrations/splunk) app.
81+
- [Audit trails token](/terraform/enterprise/users-teams-organizations/api-tokens#audit-trail-tokens) - each organization can have a single token that can read that organization's audit trails. Use this token type to authenticate integrations pulling audit trail data, for example, using the [HCP Terraform for Splunk](/terraform/enterprise/integrations/splunk) app.
6082
<!-- END: TFC:only -->
6183

84+
### System Endpoints
85+
@include "api-code-blocks/authentication.mdx"
86+
6287
### Blob Storage Authentication
6388

6489
HCP Terraform relies on a HashiCorp-developed blob storage service for storing statefiles and multiple other pieces of customer data, all of which are documented on our [data security page](/terraform/enterprise/architectural-details/data-security).
@@ -175,16 +200,20 @@ We return 404 Not Found codes for resources that a user doesn't have access to,
175200

176201
## Versioning
177202

178-
The API documented in these pages is the second version of HCP Terraform's API, and resides under the `/v2` prefix.
203+
The API documented in these pages is the second version of HCP Terraform's application API, and resides under the `/v2` prefix.
179204

180205
Future APIs will increment this version, leaving the `/v1` API intact, though in the future we might deprecate certain features. In that case, we'll provide ample notice to migrate to the new API.
181206

207+
System endpoints may follow different versioning patterns, which are documented in their respective sections.
208+
182209
## Paths
183210

184-
All V2 API endpoints use `/api/v2` as a prefix unless otherwise specified.
211+
All V2 application API endpoints use `/api/v2` as a prefix unless otherwise specified.
185212

186213
For example, if the API endpoint documentation defines the path `/runs` then the full path is `/api/v2/runs`.
187214

215+
System endpoints follow their own path structure, which is documented in their respective pages.
216+
188217
## JSON API Formatting
189218

190219
The HCP Terraform endpoints use the [JSON API specification](https://jsonapi.org/), which specifies key aspects of the API. Most notably:
@@ -342,7 +371,9 @@ $ curl \
342371

343372
## Rate Limiting
344373

345-
You can make up to 30 requests per second to most API endpoints as an authenticated or unauthenticated request. If you reach the rate limit then your access will be throttled and an error response will be returned.
374+
### Application Endpoints
375+
376+
You can make up to 30 requests per second to the application API endpoints as an authenticated or unauthenticated request. If you reach the rate limit then your access will be throttled and an error response will be returned. Some endpoints have lower rate limits to prevent abuse, including endpoints that poll Terraform for a list of runs and endpoints related to user authentication. The adjusted limits are unnoticeable under normal use. If you receive a rate-limited response, the limit is reflected in the `x-ratelimit-limit` header once triggered.
346377

347378
Requests are per user, not per token. As a result, you cannot use multiple tokens to make more than 30 requests per second.
348379

@@ -364,7 +395,7 @@ Unauthenticated requests are associated with the requesting IP address.
364395
}
365396
```
366397

367-
### Lower rate limits for some endoints
398+
#### Lower rate limits for some endpoints
368399

369400
To prevent abuse, some endpoints have lower rate limits. The lower limits are unnoticeable under normal use. If you trigger a rate-limited response, you can see that limit in the `x-ratelimit-limit` header.
370401

@@ -382,6 +413,9 @@ The following endpoints have lower rate limits:
382413
| <p>`POST /account/reconfirm`</p> | Send emails | 40 per hour |
383414
| <p>`POST /auth`</p> | Send emails | 40 per hour per email address |
384415

416+
### System Endpoints
417+
@include "api-code-blocks/rate-limit.mdx"
418+
385419
## Client libraries and tools
386420

387421
HashiCorp maintains [go-tfe](https://github.com/hashicorp/go-tfe), a Go client for HCP Terraform's API.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
page_title: System Ping API reference for Terraform Enterprise
3+
description: >-
4+
Use the Ping endpoint to check the health of the System API of your Terraform Enterprise system.
5+
---
6+
7+
# `/ping` endpoint reference
8+
9+
This endpoint provides a simple health check to verify that the Terraform Enterprise system is operational. Authentication is required to use this endpoint.
10+
11+
`GET /api/v1/ping`
12+
13+
## Sample request
14+
15+
```shell
16+
curl \
17+
--header "Authorization: Bearer $TOKEN" \
18+
--request GET \
19+
https://tfe.example.com:8443/api/v1/ping
20+
```
21+
22+
## Response codes
23+
24+
| Status | Response | Reason |
25+
| ------- | -------- | ---------------------------------- |
26+
| [200][] | `pong` | The system is operational |
27+
| [403][] | [JSON API error object][] | Not authorized to access this endpoint |
28+
| [429][] | [JSON API error object][] | Too many requests |
29+
| [500][] | [JSON API error object][] | Internal server error |
30+
31+
@include "api-code-blocks/system-api.mdx"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
page_title: System Usage/Bundle API reference for Terraform Enterprise
3+
description: >-
4+
Use the Usage/Bundle endpoint to download a usage bundle.
5+
---
6+
7+
# `/usage/bundle` endpoint reference
8+
9+
This endpoint provides a usage bundle. For more information about the product usage data structure and the specific metrics that Terraform Enterprise collects, refer to the [Terraform Enterprise usage data reference](/terraform/enterprise/deploy/reference/product-data).
10+
11+
`GET /api/v1/usage/bundle`
12+
13+
## Sample request
14+
15+
```shell
16+
curl \
17+
--header "Authorization: Bearer $TOKEN" \
18+
--request GET \
19+
https://tfe.example.com:8443/api/v1/usage/bundle
20+
```
21+
22+
### Response Codes
23+
24+
| Status | Response | Reason |
25+
| ------- | ------------------------- | ------------------------------------------ |
26+
| [200][] | JSON usage bundle | Successfully retrieved usage data |
27+
| [403][] | [JSON API error object][] | Not authorized to access this endpoint |
28+
| [429][] | [JSON API error object][] | Too many requests |
29+
| [500][] | [JSON API error object][] | Internal server error |
30+
31+
@include "api-code-blocks/system-api.mdx"
32+
33+
## Related Resources
34+
35+
* [Enable automated product usage reports](/terraform/enterprise/deploy/manage/product-report) - Instructions for configuring Terraform Enterprise to automatically send product usage data to HashiCorp
36+
* [Generate product usage report using the CLI](/terraform/enterprise/deploy/reference/cli#generate-product-usage-report) - Instructions for generating product usage reports manually

content/terraform-enterprise/v202505-1/docs/enterprise/deploy/reference/cli.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,42 @@ Each specific run of the admin `usage-report` command generates the product usag
164164

165165
To send product usage reports to HashiCorp, visit the [**Licensing utilization reporting** page](https://portal.cloud.hashicorp.com/license-utilization/reports/create) and use the upload form.
166166

167+
## Manage admin API tokens
168+
169+
Terraform Enterprise provides commands to manage authentication tokens for the Admin API, which allows programmatic access to administrative functions.
170+
171+
### Generate an admin API token
172+
173+
To create a new admin API token, use the `admin api-token generate` command with a required description that helps identify the token's purpose or owner:
174+
175+
```shell-session
176+
$ tfectl admin api-token generate --description "Token description"
177+
```
178+
179+
By default, tokens expire after 720 hours (30 days). You can specify a custom time-to-live (TTL) in hours using the `--ttl` flag:
180+
181+
```shell-session
182+
$ tfectl admin api-token generate --description "Token description" --ttl 2000
183+
```
184+
185+
### List admin API tokens
186+
187+
To list all existing admin API tokens along with their metadata (excluding the actual token value), use:
188+
189+
```shell-session
190+
$ tfectl admin api-token list
191+
```
192+
193+
This command displays the token ID, creation date, expiration date, last used date, and description for each token. The output is ordered by creation date.
194+
195+
### Revoke an admin API token
196+
197+
To revoke an admin API token, use the `admin api-token revoke` command with the token ID (obtained from the `list` command):
198+
199+
```shell-session
200+
$ tfectl admin api-token revoke --id "1"
201+
```
202+
167203
## List all Terraform Enterprise installation nodes
168204

169205
To get a list of valid node values, use the following command:

content/terraform-enterprise/v202505-1/docs/enterprise/deploy/reference/configuration.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ Specifies which hostname Terraform Enterprise should use to federate run task wo
371371

372372
Default is `primary`.
373373

374+
### `TFE_ADMIN_HTTPS_PORT`
375+
376+
Specifies the port that the [system API endpoints](/terraform/enterprise/api-docs/index#system-endpoints-overview) listen on for HTTPS requests.
377+
Defaults to `8443`.
378+
374379
## Observability settings
375380

376381
### `TFE_LOG_FORWARDING_CONFIG_PATH`
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
System API requests must be authenticated with a bearer token generated specifically for this API using the `tfectl admin api-token generate` command. For more information on the token creation, and management, refer to the [tfectl documentation](/terraform/enterprise/deploy/reference/cli).
2+
Use the HTTP Header `Authorization` with the value `Bearer <token>`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All System API endpoints are rate limited to 1 request per second per authentication token.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[200]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200
2+
[400]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
3+
[401]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
4+
[403]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
5+
[404]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
6+
[429]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429
7+
[500]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
8+
[JSON API error object]: https://jsonapi.org/format/#error-objects
9+
10+
## System API Overview
11+
12+
-> **Terraform Enterprise Only:** The System API is exclusive to Terraform Enterprise. It enables access to deployment configuration and data.
13+
14+
This API is distinct from the regular Admin API and the Backup and Restore API, with its own authentication mechanism.
15+
16+
## Authentication
17+
@include "api-code-blocks/authentication.mdx"
18+
19+
## Rate Limiting
20+
@include "api-code-blocks/rate-limit.mdx"
21+
22+
## Port Configuration
23+
24+
By default, the System API is accessible on HTTPS port `8443`. This port can be configured through the `TFE_ADMIN_HTTPS_PORT` environment variable in your deployment configuration.
25+
26+
Refer to [Network settings](/terraform/enterprise/deploy/reference/configuration#network-settings) in the configuration reference for more information about network configuration.
27+
28+
## Versioning
29+
30+
The System API is versioned under the `/api/v1` prefix and is separate from the main Terraform Enterprise API.
31+
32+
For example, if the API endpoint documentation defines the path `/ping` then the full path is `/api/v1/ping`.

0 commit comments

Comments
 (0)