Skip to content

Commit 045fed2

Browse files
authored
fix: More docs fixes (#3919)
* fix: Cleaning up overview * feat: Adding global flags and resolving a bit more of the gaps in the docs before fleshing out content for CLI * fix: Fixing links * fix: Removing hanging thought * fix: Adding URL validation for link in flags * fix: Making examples mandatory * fix: Nits from CodeRabbit * fix: Adding some whitespace after headings * fix: Adding migration guide for cli-redesign * fix: Nit from CodeRabbit * fix: Adding mechanism for flag data lookup * fix: Addressing nits * feat: Add flags as data for all flags * fix: Fixing env var in legacy docs * fix: Fixing some typos in the old docs * fix: Reworking all flags so that they offer rich information * fix: Fixing all broken links for `cli-options` * fix: Adding redirects for old routes * fix: Adding docs for the `unit` block * Delete astro.config.mjs
1 parent 237f07a commit 045fed2

File tree

129 files changed

+2744
-487
lines changed

Some content is hidden

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

129 files changed

+2744
-487
lines changed

docs-starlight/TODO.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,34 @@ The Starlight rewrite of the Terragrunt website is a work in progress.
55
Here are some of the tasks that need to be completed:
66

77
## Infrastructure
8+
89
- [x] **Docker compose local dev setup**
910
- [x] **Vercel deployment**
1011
- [x] **Vercel preview deployments**
1112
- [x] **Custom domain setup** - [terragrunt-v1.gruntwork.io](https://terragrunt-v1.gruntwork.io)
13+
- [ ] **Remove the no-index robots.txt**
14+
- [ ] **Add a sitemap.xml**
15+
- [x] **Add sitemap for terragrunt-v1.gruntwork.io**
16+
- [ ] **Update sitemap to use terragrunt.gruntwork.io as the URL**
1217

1318
## Content
14-
- [ ] **Content parity with current docs site**
19+
20+
- [x] **Content parity with current docs site**
1521
- [x] **Parity for all docs except CLI reference**
16-
- [ ] **Parity for CLI reference**
17-
- [ ] **Redesign reference to use cards**
18-
- [ ] **Setup redirects for all old URLs**
22+
- [x] **Parity for CLI reference**
23+
- [x] **Redesign reference to use cards**
24+
- [x] **Setup redirects for all old URLs**
1925
- [x] **Automate keeping versions updated**
2026
- [x] **Automate Terragrunt version lookup in docs**
2127
- [x] **Automate IaC Engine version lookup in docs**
2228

2329
## User Experience
30+
2431
- [x] **User feedback collection**
25-
- [ ] **Broken link checking**
32+
- [x] **Broken link checking**
2633
- [x] **Automate broken link checking**
27-
- [ ] **Fix broken links**
28-
- [ ] **Fix broken links in CLI reference**
34+
- [x] **Fix broken links**
35+
- [x] **Fix broken links in CLI reference**
2936
- [x] **Fix broken links in all other docs**
3037
- [x] **Require link checking**
3138
- [ ] **Jekyll site banner indicating new site**

docs-starlight/astro.config.mjs

+54-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const sidebar = [
3333
{ label: 'Experiments', slug: 'docs/reference/experiments' },
3434
{ label: 'Supported Versions', slug: 'docs/reference/supported-versions' },
3535
{ label: 'Lock Files', slug: 'docs/reference/lock-files' },
36+
{ label: 'Logging', autogenerate: { directory: '04-reference/07-logging', collapsed: true } },
3637
{ label: 'Terragrunt Cache', slug: 'docs/reference/terragrunt-cache' },
3738
],
3839
},
@@ -48,6 +49,7 @@ export const sidebar = [
4849

4950
// https://astro.build/config
5051
export default defineConfig({
52+
site: 'https://terragrunt-v1.gruntwork.io',
5153
output: 'server',
5254
adapter: vercel({
5355
isr: {
@@ -75,11 +77,60 @@ export default defineConfig({
7577
'http://localhost:16686/',
7678
'http://localhost:9090/',
7779

78-
// TODO: Remove these once the CLI redesign is done
79-
'/docs/reference/cli**/*',
80-
'/docs/reference/cli*',
80+
// Unfortunately, these have to be ignored, as they're
81+
// referencing links that exist outside the file.
82+
'/docs/reference/cli/commands/run#*',
8183
],
8284
})],
8385
}),
8486
],
87+
redirects: {
88+
// Pages that have been rehomed.
89+
"/docs/features/debugging/": "/docs/troubleshooting/debugging/",
90+
"/docs/upgrade/upgrading_to_terragrunt_0.19.x/": "/docs/migrate/upgrading_to_terragrunt_0.19.x/",
91+
92+
// Redirects to external sites.
93+
"/contact/": "https://gruntwork.io/contact",
94+
"/commercial-support/": "https://gruntwork.io/support",
95+
"/cookie-policy/": "https://gruntwork.io/legal/cookie-policy/",
96+
97+
// Restructured docs
98+
"/docs/reference/configuration/": "/docs/reference/hcl/",
99+
"/docs/reference/cli-options/": "/docs/reference/cli/",
100+
"/docs/reference/built-in-functions/": "/docs/reference/hcl/functions/",
101+
"/docs/reference/config-blocks-and-attributes/": "/docs/reference/hcl/blocks/",
102+
"/docs/reference/strict-mode/": "/docs/reference/strict-controls/",
103+
"/docs/reference/log-formatting/": "/docs/reference/logging/formatting/",
104+
"/docs/features/aws-authentication/": "/docs/features/authentication/",
105+
106+
// Support old doc structure paths
107+
"/docs/": "/docs/getting-started/quick-start/",
108+
"/docs/getting-started/": "/docs/getting-started/quick-start/",
109+
"/docs/features/": "/docs/features/units/",
110+
"/docs/reference/": "/docs/reference/hcl/",
111+
"/docs/troubleshooting/": "/docs/troubleshooting/debugging/",
112+
"/docs/migrate/": "/docs/migrate/migrating-from-root-terragrunt-hcl/",
113+
114+
// Support old community paths
115+
"/docs/community/": "/docs/community/contributing/",
116+
"/support/": "/docs/community/support/",
117+
118+
// Support old reference paths
119+
"/docs/reference/cli/commands/": "/docs/reference/cli/",
120+
"/docs/reference/hcl/functions/": "/docs/reference/hcl/functions/",
121+
122+
// Support old feature paths
123+
"/docs/features/inputs/": "/docs/features/units/",
124+
"/docs/features/locals/": "/docs/features/units/",
125+
"/docs/features/keep-your-terraform-code-dry/": "/docs/features/units/",
126+
"/docs/features/execute-terraform-commands-on-multiple-units-at-once/": "/docs/features/stacks/",
127+
"/docs/features/keep-your-terragrunt-architecture-dry/": "/docs/features/includes/",
128+
"/docs/features/keep-your-remote-state-configuration-dry/": "/docs/features/state-backend/",
129+
"/docs/features/keep-your-cli-flags-dry/": "/docs/features/extra-arguments/",
130+
"/docs/features/aws-auth/": "/docs/features/aws-authentication/",
131+
"/docs/features/work-with-multiple-aws-accounts/": "/docs/features/aws-authentication/",
132+
"/docs/features/auto-retry/": "/docs/features/runtime-control/",
133+
"/docs/features/provider-cache/": "/docs/features/provider-cache-server/",
134+
"/docs/features/provider-caching/": "/docs/features/provider-cache-server/",
135+
},
85136
});

docs-starlight/mise.toml

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[tools]
22
bun = "1.2.2"
3+
poetry = "2.1.1"
4+
python = "3.13.2"

docs-starlight/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
},
1212
"dependencies": {
1313
"@astrojs/starlight": "^0.31.1",
14-
"@zachleat/table-saw": "^1.0.6",
1514
"@astrojs/vercel": "^8.0.7",
15+
"@zachleat/table-saw": "^1.0.6",
1616
"astro": "^5.2.1",
1717
"gray-matter": "^4.0.3",
1818
"sharp": "^0.32.5",

docs-starlight/public/robots.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
User-agent: * Disallow: /
Loading

docs-starlight/src/components/Command.astro

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
import { Aside, Badge, Code, Card } from '@astrojs/starlight/components';
2+
import { Aside, Code } from '@astrojs/starlight/components';
33
import { getEntry, render } from 'astro:content';
44
import type { CollectionEntry } from 'astro:content';
5+
import Flag from './Flag.astro';
56
67
const { path } = Astro.props;
78
@@ -49,23 +50,9 @@ const { Content } = await render(command);
4950
data?.flags ? (
5051
<h2 id="flags">Flags</h2>
5152
<div>
52-
{data?.flags.map((flag) => (
53-
flag &&
54-
<section id={flag?.name} >
55-
<Card title={"--" + flag?.name} icon="custom:terragrunt">
56-
<p id={flag?.name}>{flag?.description}</p>
57-
<div>
58-
<span>Type: </span><Badge text={flag?.type} variant="note" style={{ fontWeight: 'bold' }}/>
59-
</div>
60-
<p>Environment Variables:</p>
61-
<ul>
62-
{flag?.env.map((env) => (
63-
<li><code dir="auto">{env}</code></li>
64-
))}
65-
</ul>
66-
</Card>
67-
</section>
53+
{data?.flags.map((flagName) => (
54+
flagName && <Flag name={flagName} />
6855
))}
69-
</div>
56+
</div>
7057
) : null
7158
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
import { Badge, Card } from '@astrojs/starlight/components';
3+
import type { CollectionEntry } from 'astro:content';
4+
import { render, getEntry } from 'astro:content';
5+
6+
interface Props {
7+
name: string;
8+
}
9+
10+
const { name } = Astro.props;
11+
12+
const flagEntry = await getEntry('flags', name) as CollectionEntry<'flags'>;
13+
const { Content } = await render(flagEntry);
14+
const { description, type, env } = flagEntry.data;
15+
---
16+
17+
<section id={name}>
18+
<Card title={"--" + name} icon="custom:terragrunt">
19+
<p id={name}>{description}</p>
20+
<Content />
21+
<div>
22+
<span>Type: </span><Badge text={type} variant="note" style={{ fontWeight: 'bold' }}/>
23+
</div>
24+
{env && (
25+
<>
26+
<p>Environment Variables:</p>
27+
<ul>
28+
{env.map((envVar: string) => (
29+
<li><code dir="auto">{envVar}</code></li>
30+
))}
31+
</ul>
32+
</>
33+
)}
34+
</Card>
35+
</section>

docs-starlight/src/content.config.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const docs = defineCollection({
1212
}),
1313
}),
1414
},
15-
1615
)
1716
});
1817

@@ -30,18 +29,23 @@ const commands = defineCollection({
3029
examples: z.array(z.object({
3130
code: z.string(),
3231
description: z.string().optional(),
33-
})).optional(),
34-
flags: z.array(z.object({
35-
name: z.string(),
36-
description: z.string(),
37-
env: z.array(z.string()),
38-
type: z.string(),
39-
})).optional(),
32+
})),
33+
flags: z.array(z.string()).optional(),
4034
experiment: z.object({
4135
control: z.string(),
4236
name: z.string(),
4337
}).optional(),
4438
}),
4539
});
4640

47-
export const collections = { docs, commands };
41+
const flags = defineCollection({
42+
loader: glob({ pattern: "**/*.mdx", base: "src/data/flags" }),
43+
schema: z.object({
44+
name: z.string(),
45+
description: z.string(),
46+
type: z.string(),
47+
env: z.array(z.string()).optional(),
48+
}),
49+
});
50+
51+
export const collections = { docs, commands, flags };

docs-starlight/src/content/docs/01-getting-started/01-quick-start.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This tutorial will not assume the following:
4646
2. You have any experience with Terragrunt.
4747
3. You have any existing Terragrunt, OpenTofu or Terraform projects.
4848

49-
\* Note that if you have _both_ OpenTofu and Terraform installed, you'll want to read the [tf-path](/docs/reference/cli-options/#tf-path) docs to understand how Terragrunt determines which binary to use.
49+
\* Note that if you have _both_ OpenTofu and Terraform installed, you'll want to read the [tf-path](/docs/reference/cli/commands/run#tf-path) docs to understand how Terragrunt determines which binary to use.
5050

5151
If you would like a less gentle introduction geared towards users with an active AWS account, familiarity with OpenTofu/Terraform, and potentially a team actively using Terragrunt, consider starting with the [Overview](/docs/getting-started/overview/).
5252

docs-starlight/src/content/docs/01-getting-started/04-terminology.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ While not a requirement, a general tendency experienced when working with Terrag
4848

4949
A common pattern used in the repository structure for Terragrunt projects is to have a single `terragrunt.hcl` file located at the root of the repository, and multiple subdirectories each containing their own `terragrunt.hcl` file. This is typically done to promote code-reuse, as it allows for any configuration common to all units to be defined in the root `terragrunt.hcl` file, and for unit-specific configuration to be defined in child directories. In this pattern, the root `terragrunt.hcl` file is not considered a unit, while all the child directories containing `terragrunt.hcl` files are.
5050

51-
Note that units don't technically need to call their configuration files `terragrunt.hcl` (that's configurable via the [--config](/docs/reference/cli-options/#config)), and users don't technically need to use a root `terragrunt.hcl` file or to name it that. This is the most common pattern followed by the community, however, and deviation from this pattern should be justified in the context of the project. It can help others with Terragrunt experience understand the project more easily if industry standard patterns are followed.
51+
Note that units don't technically need to call their configuration files `terragrunt.hcl` (that's configurable via the [--config](/docs/reference/cli/commands/run#config)), and users don't technically need to use a root `terragrunt.hcl` file or to name it that. This is the most common pattern followed by the community, however, and deviation from this pattern should be justified in the context of the project. It can help others with Terragrunt experience understand the project more easily if industry standard patterns are followed.
5252

5353
### Stack
5454

@@ -154,17 +154,17 @@ These utilities are part of what makes Terragrunt so powerful, as they allow use
154154

155155
The Run Queue is the queue of all units that Terragrunt will do work on over one or more runs.
156156

157-
Certain commands like [run-all](/docs/reference/cli-options/#run-all) populate the Run Queue with all units in a stack, while other commands like `plan` or `apply` will only populate the Run Queue with the unit that the command was run in.
157+
Certain commands like [run-all](/docs/reference/cli/commands/run#all) populate the Run Queue with all units in a stack, while other commands like `plan` or `apply` will only populate the Run Queue with the unit that the command was run in.
158158

159-
Certain flags like [--include-dir](/docs/reference/cli-options/#include-dir) can be used to adjust the Run Queue to include additional units. Conversely, there are flags like [--exclude-dir](/docs/reference/cli-options/#exclude-dir) that can be used to adjust the Run Queue to exclude units.
159+
Certain flags like [--include-dir](/docs/reference/cli/commands/run#include-dir) can be used to adjust the Run Queue to include additional units. Conversely, there are flags like [--exclude-dir](/docs/reference/cli/commands/run#exclude-dir) that can be used to adjust the Run Queue to exclude units.
160160

161161
Terragrunt will always attempt to run until the Run Queue is empty.
162162

163163
### Runner Pool
164164

165165
The Runner Pool is the pool of available resources that Terragrunt can use to execute runs.
166166

167-
Units are dequeued from the Runner Pool into the Runner Pool depending on factors like [parallelism](/docs/reference/cli-options/#parallelism) and the DAG.
167+
Units are dequeued from the Runner Pool into the Runner Pool depending on factors like [parallelism](/docs/reference/cli/commands/run#parallelism) and the DAG.
168168

169169
Units are only considered "running" when they are in the Runner Pool.
170170

@@ -207,15 +207,15 @@ By default, Terragrunt will interact with OpenTofu/Terraform in order to retriev
207207

208208
Terragrunt does have the ability to mock outputs, which is useful when dependencies do not yet have outputs to be consumed (e.g. during the run of a unit with a dependency that has not been applied).
209209

210-
Terragrunt also has the ability to fetch outputs without interacting with OpenTofu/Terraform via [--fetch-dependency-output-from-state](/docs/reference/cli-options/#fetch-dependency-output-from-state) for dependencies where state is stored in AWS. This is an experimental feature, and more tooling is planned to make this easier to use.
210+
Terragrunt also has the ability to fetch outputs without interacting with OpenTofu/Terraform via [--fetch-dependency-output-from-state](/docs/reference/cli/commands/run#fetch-dependency-output-from-state) for dependencies where state is stored in AWS. This is an experimental feature, and more tooling is planned to make this easier to use.
211211

212212
### Feature
213213

214-
A [feature](/docs/reference/cli-options/#feature) is a configuration that can be dynamically controlled in Terragrunt configurations.
214+
A [feature](/docs/reference/cli/commands/run#feature) is a configuration that can be dynamically controlled in Terragrunt configurations.
215215

216216
They operate very similarly to variables, but are designed to be used to dynamically adjust the behavior of Terragrunt configurations, rather than OpenTofu/Terraform configurations.
217217

218-
Features can be adjusted using feature flags, which are set in Terragrunt configurations using the [feature block](/docs/reference/hcl/blocks#feature) and the [feature flag](/docs/reference/cli-options#feature) attribute.
218+
Features can be adjusted using feature flags, which are set in Terragrunt configurations using the [feature block](/docs/reference/hcl/blocks#feature) and the [feature flag](/docs/reference/cli/commands/run#feature) attribute.
219219

220220
Like all good feature flags, you are encouraged to use them with good judgement and to avoid using them as a crutch to avoid making decisions about permanent adjustments to your infrastructure.
221221

docs-starlight/src/content/docs/02-features/01-units.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,4 @@ specified via the `path` parameter. It behaves exactly as if you had copy/pasted
346346
included file `generate` configuration into the child, but this approach is much easier to maintain\!
347347
## Further Reading
348348
Note that if you're considering this solution because you're struggling with dynamic provider authentication in AWS,
349-
you may be interested in the dedicated documentation on [working with multiple AWS accounts](/docs/features/aws-authentication).
349+
you may be interested in the dedicated documentation on [working with multiple AWS accounts](/docs/features/authentication).

docs-starlight/src/content/docs/02-features/02-stacks.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Right now, there is no special syntax for defining a stack as a single file, but
4343
Regardless of whether you are using the new syntax or not, the core functionality provided by Stacks are the same.
4444
The new `terragrunt.stack.hcl` file is merely a shorthand for defining a stack, just like you could by placing units directly in a folder.
4545

46-
## The `run-all` command
46+
## The `run --all` command
4747

4848
To solve the problem above, first convert the OpenTofu/Terraform modules into units. This is done simply by adding an empty `terragrunt.hcl` file within each root module folder.
4949

@@ -95,10 +95,10 @@ terragrunt run-all output
9595

9696
Finally, if you make some changes to your project, you could evaluate the impact by using `run-all` command with `plan`:
9797

98-
Note: It is important to realize that you could get errors running `run-all plan` if you have dependencies between your
98+
Note: It is important to realize that you could get errors running `run --all plan` if you have dependencies between your
9999
projects and some of those dependencies haven’t been applied yet.
100100

101-
_Ex: If unit A depends on unit B and unit B hasn’t been applied yet, then run-all plan will show the plan for B, but exit with an error when trying to show the plan for A._
101+
_Ex: If unit A depends on unit B and unit B hasn’t been applied yet, then `run --all plan` will show the plan for B, but exit with an error when trying to show the plan for A._
102102

103103
```bash
104104
cd root
@@ -109,7 +109,7 @@ terragrunt run-all plan
109109

110110
If your units have dependencies between them, for example, you can’t deploy the backend-app until MySQL and redis are deployed. You’ll need to express those dependencies in your Terragrunt configuration as explained in the next section.
111111

112-
Additional note: If your units have dependencies between them, and you run a `terragrunt run-all destroy` command, Terragrunt will destroy all the units under the current working directory, _as well as each of the unit dependencies_ (that is, units you depend on via `dependencies` and `dependency` blocks)! If you wish to use exclude dependencies from being destroyed, add the `--ignore-external-dependencies` flag, or use the `--exclude-dir` once for each directory you wish to exclude.
112+
Additional note: If your units have dependencies between them, and you run a `terragrunt run --all destroy` command, Terragrunt will destroy all the units under the current working directory, _as well as each of the unit dependencies_ (that is, units you depend on via `dependencies` and `dependency` blocks)! If you wish to prevent external dependencies from being destroyed, add the `--queue-exclude-external` flag, or use the `--exclude-dir` once for each directory you wish to exclude.
113113

114114
## Cutting down the file count
115115

@@ -549,10 +549,10 @@ cd root/us-east-1
549549
terragrunt run-all apply
550550
```
551551

552-
Terragrunt will only include the units in the `us-east-1` stack and its children in the queue of units to run (unless external dependencies are pulled in, as discussed in the [run-all command](#the-run-all-command) section).
552+
Terragrunt will only include the units in the `us-east-1` stack and its children in the queue of units to run (unless external dependencies are pulled in, as discussed in the [run --all command](#the-run---all-command) section).
553553

554554
Generally speaking, this is the primary tool Terragrunt users use to control the blast radius of their changes. For the most part, it is the current working directory that determines the blast radius of a `run-all` command.
555555

556-
In addition to using your working directory to control what's included in a [run queue](/docs/getting-started/terminology/#run-queue), you can also use flags like [--include-dir](/docs/reference/cli-options/#include-dir) and [--exclude-dir](/docs/reference/cli-options/#exclude-dir) to explicitly control what's included in a run queue within a stack, or outside of it.
556+
In addition to using your working directory to control what's included in a [run queue](/docs/getting-started/terminology/#run-queue), you can also use flags like [--include-dir](/docs/reference/cli/commands/run#include-dir) and [--exclude-dir](/docs/reference/cli/commands/run#exclude-dir) to explicitly control what's included in a run queue within a stack, or outside of it.
557557

558-
There are more flags that control the behavior of the `run-all` command, which you can find in the [CLI Options](/docs/reference/cli-options) section.
558+
There are more flags that control the behavior of the `run` command, which you can find in the [`run` docs](/docs/reference/cli/commands/run).

0 commit comments

Comments
 (0)