Skip to content

Commit 3d64854

Browse files
Merge branch 'main' into TFDN-1107-add-agent-sort-docs
2 parents f112c5e + 875deac commit 3d64854

File tree

860 files changed

+61247
-11522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

860 files changed

+61247
-11522
lines changed

.github/labeler.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Add a Terraform label to changes under the related folders:
2+
#
3+
# Folder | Labels
4+
# --------------------------- | ------------------------------------------------
5+
# terraform | Terraform CE
6+
# terraform-cdk | None
7+
# terraform-docs-agents | Terraform agents
8+
# terraform-docs-common | HCP Terraform
9+
# terraform-enterprise | Terraform Enterprise
10+
# terraform-migrate | Terraform migrate
11+
# terraform-plugin-framework | TF Plugin Framework
12+
# terraform-plugin-log | None
13+
# terraform-plugin-mux | None
14+
# terraform-plugin-sdk | None
15+
# terraform-plugin-testing | None
16+
17+
Terraform CE:
18+
- any:
19+
- changed-files:
20+
- any-glob-to-any-file: [
21+
'content/terraform/**'
22+
]
23+
24+
Terraform agents:
25+
- any:
26+
- changed-files:
27+
- any-glob-to-any-file: [
28+
'content/terraform-docs-agents/**'
29+
]
30+
31+
HCP Terraform:
32+
- any:
33+
- changed-files:
34+
- any-glob-to-any-file: [
35+
'content/terraform-docs-common/**'
36+
]
37+
38+
Terraform Enterprise:
39+
- any:
40+
- changed-files:
41+
- any-glob-to-any-file: [
42+
'content/terraform-enterprise/**'
43+
]
44+
45+
Terraform migrate:
46+
- any:
47+
- changed-files:
48+
- any-glob-to-any-file: [
49+
'content/terraform-migrate/**'
50+
]
51+
52+
TF Plugin Framework:
53+
- any:
54+
- changed-files:
55+
- any-glob-to-any-file: [
56+
'content/terraform-plugin-framework/**'
57+
]
58+
59+
60+
# Add 'Vault' label to changes under 'content/vault'
61+
#
62+
# Label | Rule
63+
# --------------- | ------------------------------------------------------------
64+
# Vault | Default; applies to all doc updates
65+
# Vault IC update | Updates on "Important changes" related docs
66+
67+
Vault:
68+
- any:
69+
- changed-files:
70+
- any-glob-to-any-file: [
71+
'content/vault/**'
72+
]
73+
74+
Vault IC:
75+
- any:
76+
- changed-files:
77+
- any-glob-to-any-file: [
78+
'content/vault/global/partials/important-changes/**',
79+
'content/vault/*/content/docs/updates/change-tracker.mdx',
80+
'content/vault/*/content/docs/updates/important-changes.mdx',
81+
'content/vault/*/content/docs/updates/lts-tracker.mdx'
82+
]
83+
84+
# Add 'WAF' label to changes under 'content/well-architected-framework'
85+
#
86+
# Label | Rule
87+
# --------------- | ------------------------------------------------------------
88+
# WAF | Default; applies to all doc updates
89+
90+
WAF:
91+
- any:
92+
- changed-files:
93+
- any-glob-to-any-file: [
94+
'content/well-architected-framework/**'
95+
]
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Check Prebuild Binaries
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'scripts/prebuild/**'
7+
- 'scripts/utils/**'
8+
- 'scripts/algolia/**'
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
check-prebuild-binaries:
15+
runs-on: ubuntu-latest
16+
name: Validate prebuild binaries are updated
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
21+
22+
- name: Get changed files
23+
id: changed-files
24+
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
25+
with:
26+
files: |
27+
scripts/prebuild/**
28+
scripts/utils/**
29+
scripts/algolia/**
30+
files_ignore: |
31+
scripts/prebuild/prebuild-arm-mac-binary.gz
32+
scripts/prebuild/prebuild-x64-linux-binary.gz
33+
scripts/prebuild/prebuild-arm-linux-binary.gz
34+
35+
- name: Check if prebuild scripts changed
36+
id: check-changes
37+
run: |
38+
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
39+
if [[ "${{ steps.changed-files.outputs.any_changed }}" == "true" ]]; then
40+
echo "prebuild_changed=true" >> $GITHUB_OUTPUT
41+
echo "✅ Prebuild scripts have changed"
42+
else
43+
echo "prebuild_changed=false" >> $GITHUB_OUTPUT
44+
echo "ℹ️ No prebuild script changes detected"
45+
fi
46+
47+
- name: Check if binaries were updated
48+
id: check-binaries
49+
if: steps.check-changes.outputs.prebuild_changed == 'true'
50+
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
51+
with:
52+
files: |
53+
scripts/prebuild/prebuild-arm-mac-binary.gz
54+
scripts/prebuild/prebuild-x64-linux-binary.gz
55+
scripts/prebuild/prebuild-arm-linux-binary.gz
56+
57+
- name: Validate binary updates
58+
if: steps.check-changes.outputs.prebuild_changed == 'true'
59+
run: |
60+
echo "Prebuild scripts changed: ${{ steps.check-changes.outputs.prebuild_changed }}"
61+
echo "Binaries changed: ${{ steps.check-binaries.outputs.any_changed }}"
62+
echo "Changed binaries: ${{ steps.check-binaries.outputs.all_changed_files }}"
63+
64+
if [[ "${{ steps.check-binaries.outputs.any_changed }}" != "true" ]]; then
65+
echo "❌ ERROR: Prebuild scripts have been modified but the required gzipped binaries have not been updated!"
66+
echo ""
67+
echo "The following files were changed in scripts/prebuild/:"
68+
echo "${{ steps.changed-files.outputs.all_changed_files }}"
69+
echo ""
70+
echo "Please ensure you have updated the following gzipped binaries:"
71+
echo "- scripts/prebuild/prebuild-arm-mac-binary.gz"
72+
echo "- scripts/prebuild/prebuild-x64-linux-binary.gz"
73+
echo "- scripts/prebuild/prebuild-arm-linux-binary.gz"
74+
echo ""
75+
echo "ℹ️ You can rebuild them with 'npm run compile-prebuild' and then commit the changes."
76+
exit 1
77+
78+
else
79+
# Check if all binaries were updated
80+
ARM_MAC_UPDATED=false
81+
X64_LINUX_UPDATED=false
82+
ARM_LINUX_UPDATED=false
83+
84+
if echo "${{ steps.check-binaries.outputs.all_changed_files }}" | grep -q "prebuild-arm-mac-binary.gz"; then
85+
ARM_MAC_UPDATED=true
86+
echo "✅ ARM Mac binary updated"
87+
fi
88+
89+
if echo "${{ steps.check-binaries.outputs.all_changed_files }}" | grep -q "prebuild-x64-linux-binary.gz"; then
90+
X64_LINUX_UPDATED=true
91+
echo "✅ x64 Linux binary updated"
92+
fi
93+
94+
if echo "${{ steps.check-binaries.outputs.all_changed_files }}" | grep -q "prebuild-arm-linux-binary.gz"; then
95+
ARM_LINUX_UPDATED=true
96+
echo "✅ ARM Linux binary updated"
97+
fi
98+
99+
if [[ "$ARM_MAC_UPDATED" != "true" || "$X64_LINUX_UPDATED" != "true" || "$ARM_LINUX_UPDATED" != "true" ]]; then
100+
echo "⚠️ WARNING: Not all required binaries were updated:"
101+
[[ "$ARM_MAC_UPDATED" != "true" ]] && echo " - Missing: scripts/prebuild/prebuild-arm-mac-binary.gz"
102+
[[ "$X64_LINUX_UPDATED" != "true" ]] && echo " - Missing: scripts/prebuild/prebuild-x64-linux-binary.gz"
103+
[[ "$ARM_LINUX_UPDATED" != "true" ]] && echo " - Missing: scripts/prebuild/prebuild-arm-linux-binary.gz"
104+
echo ""
105+
echo "ℹ️ You can rebuild them with 'npm run compile-prebuild' and then commit the changes."
106+
exit 1
107+
fi
108+
fi
109+
110+
- name: No changes detected
111+
if: steps.check-changes.outputs.prebuild_changed == 'false'
112+
run: |
113+
echo "✅ No prebuild script changes detected. No binary validation required."
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Apply a product label based on the content files modified in the pull request
2+
# and configuration details in .github/labeler.yml.
3+
#
4+
# For more information, see: https://github.com/actions/labeler
5+
6+
name: 🏷️ Label content PRs
7+
8+
on: [pull_request_target]
9+
10+
jobs:
11+
12+
label-the-pr:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
steps:
18+
- uses: actions/labeler@v5
19+
with:
20+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
21+
sync-labels: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ tfe-releases-repos.json
5656

5757
# copy-cloud-docs-for-tfe action
5858
.github/actions/copy-cloud-docs-for-tfe/node_modules
59+
60+
# prebuild binaries as they are too large
61+
scripts/prebuild/prebuild-arm-mac-binary
62+
scripts/prebuild/prebuild-x64-linux-binary
63+
scripts/prebuild/prebuild-arm-linux-binary

CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @hashicorp/web-devdot
33

44
# Content CODEOWNERS
5+
/docs @hashicorp/vault-education-approvers @hashicorp/education
56

67
# Terraform documentation ownership
78
/content/terraform-plugin-framework @hashicorp/terraform-devex @hashicorp/terraform-education
@@ -20,7 +21,7 @@
2021
/content/terraform/*/docs/language/backend/s3.mdx @hashicorp/terraform-education @hashicorp/terraform-core @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-aws
2122

2223
/content/terraform-docs-common/ @hashicorp/team-docs-packer-and-terraform
23-
/content/terraform-docs-common/docs/plugin/ @hashicorp/terraform-devex
24+
/content/terraform-docs-common/docs/plugin/ @hashicorp/terraform-devex
2425
/content/terraform-docs-common/data/plugin-nav-data.json @hashicorp/terraform-devex
2526

2627
/content/terraform-enterprise @hashicorp/team-docs-packer-and-terraform @hashicorp/ptfe-review

app/api/all-docs-paths/route.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
import { expect, test, vi, afterEach } from 'vitest'
77
import docsPathsMock from '__fixtures__/docsPathsAllVersionsMock.json'
88
import { GET } from './route'
9-
import * as getDocsPaths from '@utils/allDocsPaths'
10-
import { mockRequest } from '@utils/mockRequest'
9+
import * as getDocsPaths from '#utils/allDocsPaths'
10+
import { mockRequest } from '#utils/mockRequest'
1111

1212
afterEach(() => {
1313
vi.restoreAllMocks()
1414
})
1515

16-
vi.mock('@api/versionMetadata.json', () => {
16+
vi.mock('#api/versionMetadata.json', () => {
1717
return {
1818
default: {},
1919
}
2020
})
2121

22-
vi.mock('@api/docsPathsAllVersions.json', () => {
22+
vi.mock('#api/docsPathsAllVersions.json', () => {
2323
return {
2424
default: {},
2525
}

app/api/all-docs-paths/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* SPDX-License-Identifier: BUSL-1.1
44
*/
55

6-
import { errorResultToString } from '@utils/result'
7-
import { getDocsPaths } from '@utils/allDocsPaths'
8-
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'
6+
import { errorResultToString } from '#utils/result'
7+
import { getDocsPaths } from '#utils/allDocsPaths'
8+
import { PRODUCT_CONFIG } from '#productConfig.mjs'
99

1010
export async function GET(req: Request) {
1111
const url = new URL(req.url)

app/api/assets/[productSlug]/[version]/[...assetPath]/route.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55

66
import { expect, test, vi } from 'vitest'
77
import { GET } from './route'
8-
import { getAssetData } from '@utils/file'
9-
import { getProductVersionMetadata } from '@utils/contentVersions'
10-
import { mockRequest } from '@utils/mockRequest'
8+
import { getAssetData } from '#utils/file'
9+
import { getProductVersionMetadata } from '#utils/contentVersions'
10+
import { mockRequest } from '#utils/mockRequest'
1111

12-
vi.mock('@utils/file')
13-
vi.mock('@utils/contentVersions')
14-
vi.mock('@utils/productConfig.mjs', () => {
12+
vi.mock('#utils/file')
13+
vi.mock('#utils/contentVersions')
14+
vi.mock('#productConfig.mjs', () => {
1515
return {
1616
PRODUCT_CONFIG: {
1717
terraform: {},
1818
},
1919
}
2020
})
2121

22-
vi.mock('@api/versionMetadata.json', () => {
22+
vi.mock('#api/versionMetadata.json', () => {
2323
return {}
2424
})
2525

app/api/assets/[productSlug]/[version]/[...assetPath]/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* SPDX-License-Identifier: BUSL-1.1
44
*/
55

6-
import { getAssetData, joinFilePath } from '@utils/file'
7-
import { getProductVersionMetadata } from '@utils/contentVersions'
8-
import { errorResultToString } from '@utils/result'
9-
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'
10-
import { VersionedProduct } from '@api/types'
6+
import { getAssetData, joinFilePath } from '#utils/file'
7+
import { getProductVersionMetadata } from '#utils/contentVersions'
8+
import { errorResultToString } from '#utils/result'
9+
import { PRODUCT_CONFIG } from '#productConfig.mjs'
10+
import { VersionedProduct } from '#api/types'
1111

1212
export type GetParams = VersionedProduct & {
1313
/**

app/api/content-versions/route.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import { expect, test, vi, beforeEach, afterEach } from 'vitest'
77
import { GET } from './route'
8-
import { mockRequest } from '@utils/mockRequest'
8+
import { mockRequest } from '#utils/mockRequest'
9+
import { findDocVersions } from '#utils/findDocVersions'
910

1011
import { vol } from 'memfs'
1112

@@ -14,7 +15,7 @@ vi.mock('node:fs')
1415
vi.mock('node:fs/promises')
1516

1617
// Mock PRODUCT_CONFIG
17-
vi.mock('@utils/productConfig.mjs', () => {
18+
vi.mock('#productConfig.mjs', () => {
1819
return {
1920
PRODUCT_CONFIG: {
2021
'terraform-cdk': {
@@ -30,6 +31,12 @@ vi.mock('@utils/productConfig.mjs', () => {
3031
}
3132
})
3233

34+
vi.mock('#utils/findDocVersions', () => {
35+
return {
36+
findDocVersions: vi.fn(),
37+
}
38+
})
39+
3340
beforeEach(() => {
3441
// Reset the state of in-memory fs
3542
vol.reset()
@@ -76,13 +83,8 @@ test('should return 404 if the product is invalid', async () => {
7683
})
7784

7885
test('should return 200 and array of strings on valid params', async () => {
79-
vi.mock('@utils/findDocVersions.ts', () => {
80-
return {
81-
findDocVersions: () => {
82-
return ['v0.20.x', 'v0.21.x']
83-
},
84-
}
85-
})
86+
vi.mocked(findDocVersions).mockReturnValue(['v0.20.x', 'v0.21.x'])
87+
8688
const mockedResponse = {
8789
versions: ['v0.20.x', 'v0.21.x'],
8890
}

0 commit comments

Comments
 (0)