Skip to content

Commit a542638

Browse files
committed
fix: Adding HCL configuration reference for Azure and Custom auth
1 parent df85b9e commit a542638

File tree

2 files changed

+90
-7
lines changed

2 files changed

+90
-7
lines changed

docs/2.0/reference/pipelines/configurations-as-code/api.md renamed to docs/2.0/reference/pipelines/configurations-as-code/api.mdx

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ For a more comprehensive walkthrough of how blocks work please see the Pipelines
99

1010

1111
### `environment` block
12+
1213
<HclListItem name="environment" requirement="optional" type="labeled-block">
1314
<HclListItemDescription>
1415
Environment blocks are used to define configurations that are applicable to a specific environment within a repository.
@@ -182,6 +183,24 @@ The label applied to an accounts block is the name of the Accounts block. This i
182183

183184
An AWS OIDC authentication block that determines how Pipelines will authenticate with AWS using OIDC. See more [below](#aws_oidc-block-attributes).
184185

186+
### `azure_oidc` block
187+
188+
<HclListItem name="azure_oidc" requirement="optional" type="block">
189+
<HclListItemDescription>
190+
191+
An Azure OIDC authentication block that determines how Pipelines will authenticate with Azure using OIDC. See more [below](#azure_oidc-block-attributes).
192+
</HclListItemDescription>
193+
</HclListItem>
194+
195+
</HclListItemDescription>
196+
</HclListItem>
197+
198+
### `custom` block
199+
200+
<HclListItem name="custom" requirement="optional" type="block">
201+
<HclListItemDescription>
202+
203+
A custom authentication block that determines how Pipelines will authenticate with custom authentication logic when running Terragrunt commands. See more [below](#custom-block-attributes).
185204
</HclListItemDescription>
186205
</HclListItem>
187206

@@ -280,7 +299,7 @@ Whether or not Pipelines will consolidate deleted resources when running Terragr
280299

281300
The Infrastructure as Code(Iac) binary that Pipelines will instruct Terragrunt to use. Valid values are:
282301
- `opentofu` (default): Use OpenTofu for managing infrastructure. Gruntwork recommends customers use OpenTofu.
283-
- `terraform`: Use Terraform for managing infrastructure.
302+
- `terraform`: Use Terraform for managing infrastructure.
284303

285304
:::note
286305

@@ -344,27 +363,31 @@ This is to make it convenient to tuck the `accounts.yml` file away somewhere in
344363
<HclListItemDescription>
345364

346365
The AWS account ID that Pipelines will authenticate with.
366+
347367
</HclListItemDescription>
348368
</HclListItem>
349369

350370
<HclListItem name="plan_iam_role_arn" requirement="required" type="string">
351371
<HclListItemDescription>
352372

353373
The IAM role ARN that Pipelines will assume when running Terragrunt plan commands.
374+
354375
</HclListItemDescription>
355376
</HclListItem>
356377

357378
<HclListItem name="apply_iam_role_arn" requirement="required" type="string">
358379
<HclListItemDescription>
359380

360381
The IAM role ARN that Pipelines will assume when running Terragrunt apply commands.
382+
361383
</HclListItemDescription>
362384
</HclListItem>
363385

364386
<HclListItem name="region" requirement="optional" type="string">
365387
<HclListItemDescription>
366388

367389
The AWS region that Pipelines will use when running Terragrunt commands.
390+
368391
</HclListItemDescription>
369392
<HclListItemDefaultValue defaultValue="us-east-1"/>
370393
</HclListItem>
@@ -377,3 +400,53 @@ The duration in seconds that the AWS session will be valid for.
377400
</HclListItemDescription>
378401
<HclListItemDefaultValue defaultValue="3600"/>
379402
</HclListItem>
403+
404+
### `azure_oidc` block attributes
405+
406+
<HclListItem name="tenant_id" requirement="required" type="string">
407+
<HclListItemDescription>
408+
409+
The Azure tenant ID that Pipelines will authenticate with.
410+
411+
</HclListItemDescription>
412+
</HclListItem>
413+
414+
<HclListItem name="subscription_id" requirement="required" type="string">
415+
<HclListItemDescription>
416+
417+
The Azure subscription ID that Pipelines will authenticate with.
418+
419+
</HclListItemDescription>
420+
</HclListItem>
421+
422+
<HclListItem name="plan_client_id" requirement="required" type="string">
423+
<HclListItemDescription>
424+
425+
The Azure client ID that Pipelines will authenticate with when running Terragrunt plan commands.
426+
427+
</HclListItemDescription>
428+
</HclListItem>
429+
430+
<HclListItem name="apply_client_id" requirement="required" type="string">
431+
<HclListItemDescription>
432+
433+
The Azure client ID that Pipelines will authenticate with when running Terragrunt apply commands.
434+
435+
</HclListItemDescription>
436+
</HclListItem>
437+
438+
### `custom` block attributes
439+
440+
<HclListItem name="auth_provider_cmd" requirement="required" type="string">
441+
<HclListItemDescription>
442+
443+
The command that Pipelines will execute to authenticate with the custom authentication logic.
444+
445+
:::tip
446+
447+
You can learn more about how custom authentication works in the [Custom Authentication](/2.0/docs/pipelines/concepts/cloud-auth/custom) documentation.
448+
449+
:::
450+
451+
</HclListItemDescription>
452+
</HclListItem>

docs/2.0/reference/pipelines/configurations-as-code/index.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ To process configurations, Pipelines parses all `.hcl` files within a `.gruntwor
99
We recommend reviewing our [concepts page](/2.0/docs/pipelines/concepts/hcl-config-language) on the HCL language to ensure familiarity with its features before configuring Pipelines.
1010
:::
1111

12-
1312
## Basic configuration
1413

15-
The minimum configuration required for Pipelines to function depends on the specific context. In most scenarios, Pipelines must determine how to authenticate with a cloud provider to execute Terragrunt commands. If authentication is not configured where required, Pipelines will generate an error.
14+
The minimum configuration required for Pipelines to function depends on the specific context. In most scenarios, Pipelines must determine how to authenticate with a cloud provider to execute Terragrunt commands. Unless running Pipelines on a host machine that is already authenticated with a cloud provider (e.g. a self-hosted runner), it is generally required to configure some form of authentication within the `authentication` block.
1615

1716
Below is an example of a minimal configuration for a single Terragrunt unit, demonstrating how to enable Pipelines to authenticate with AWS using OIDC:
1817

@@ -31,6 +30,17 @@ unit {
3130

3231
Placing this configuration in a `gruntwork.hcl` file within the same directory as a `terragrunt.hcl` file directs Pipelines to assume the `role-to-assume-for-plans` role in the AWS account with the ID `an-aws-account-id` when executing Terragrunt plan commands. The authentication process leverages [OIDC](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) to securely connect to AWS and assume the specified role.
3332

33+
:::tip
34+
35+
If you are running Pipelines on a host machine that is already authenticated with a cloud provider, you can explicitly leave the `authentication` block empty to signal that Pipelines should not attempt to perform any authentication itself.
36+
37+
```hcl
38+
unit {
39+
authentication {}
40+
}
41+
```
42+
43+
:::
3444

3545
It is common for multiple Terragrunt units within a repository to assume the same AWS role. For instance, all units within a specific directory may provision resources for the same AWS account. Configuring AWS authentication at the environment level is more efficient in these cases. You can do this by defining an `environment` block within one of the `.hcl` files in the `.gruntwork` directory at the repository root and specifying the AWS authentication configuration.
3646

@@ -63,7 +73,6 @@ Details regarding the functionality of each configuration type are outlined belo
6373

6474
Pipelines configurations are structured into a hierarchy to manage specificity. Configurations that are more specific to an individual unit of IaC will take precedence over more general configurations in cases of conflict.
6575

66-
6776
The configuration hierarchy is as follows:
6877

6978
### Repository configurations
@@ -221,6 +230,7 @@ Job consolidation is a process by which Pipelines merges multiple related jobs (
221230
This optimization significantly reduces CI/CD costs by consolidating Terragrunt execution into fewer jobs, spreading the operational expenses more efficiently. Additionally, it enhances accuracy by allowing Terragrunt to leverage a Directed Acyclic Graph (DAG) for proper sequencing of updates.
222231

223232
For example:
233+
224234
- Instead of running the following independent jobs:
225235
A. `ModuleAdded`
226236
B. `ModuleChanged` (which depends on `ModuleAdded`)
@@ -243,6 +253,7 @@ In rare cases, you might disable job consolidation to allocate maximum resources
243253
Configurations must be specified within a single file named gruntwork.hcl, located in the same directory as the terragrunt.hcl file. These configurations are referred to as local configurations and are generally used to define settings specific to a single unit of Infrastructure as Code (IaC) within a repository. .
244254

245255
These configurations can serve two purposes:
256+
246257
1. Define all the settings necessary for Pipelines to operate within the scope of a single unit.
247258
2. Override global configurations defined in the `.gruntwork` directory, tailoring them to the unit's specific needs.
248259

@@ -288,17 +299,16 @@ filter {
288299

289300
All configuration blocks containing a `filter` block will apply only to units that match the specified filter.
290301

291-
292302
### Authentication blocks
293303

294304
[Full Reference for Authentication Blocks](/2.0/reference/pipelines/configurations-as-code/api#authentication-block)
295305

296306
Authentication blocks are configuration components used by [environment](#environment-blocks) and [unit](#unit-blocks) blocks to specify how Pipelines will authenticate with cloud platforms when executing Terragrunt commands.
297307

298308
:::note
299-
Authentication blocks encapsulate more specific authentication configurations tailored to individual cloud platforms. When Pipelines processes an `authentication` block, it attempts to authenticate with all cloud platforms defined within it.
300309

301-
Currently, the only supported block that can be nested within an `authentication` block is `aws_oidc`.
310+
Authentication blocks encapsulate more specific authentication configurations tailored to individual cloud platforms. When Pipelines processes an `authentication` block, it attempts to authenticate with the relevant cloud platform defined within it.
311+
302312
:::
303313

304314
:::tip

0 commit comments

Comments
 (0)