### Quick Install Tip Build at Specific Commit Source: https://docs.terragrunt.com/getting-started/install Install a tip build from a specific commit by providing the commit SHA to the install script. ```bash curl -sSfL --proto '=https' --tlsv1.2 https://terragrunt.com/install | bash -s -- --tip --commit ``` -------------------------------- ### Example package.json dependencies Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/setup This snippet shows a sample of dependencies within a package.json file, including various @smithy packages and tslib. Ensure your project has these or equivalent dependencies installed. ```json { "integrity": "sha512-m80d/iicI7DlBDxyQP6Th7BW/ejDGiF0bgI754+tiwK0lgMkcaIBgvwwVc7OFbY4eUzpGtnig52MhPAEJ7iNYg==", "license": "Apache-2.0", "dependencies": { "@smithy/chunked-blob-reader": "^5.2.0", "@smithy/chunked-blob-reader-native": "^4.2.1", "@smithy/types": "^4.12.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.2.8.tgz", "integrity": "sha512-7ZIlPbmaDGxVoxErDZnuFG18WekhbA/g2/i97wGj+wUBeS6pcUeAym8u4BXh/75RXWhgIJhyC11hBzig6MljwA==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.12.0", "@smithy/util-buffer-from": "^4.2.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/hash-stream-node/-/hash-stream-node-4.2.8.tgz", "integrity": "sha512-v0FLTXgHrTeheYZFGhR+ehX5qUm4IQsjAiL9qehad2cyjMWcN2QG6/4mSwbSgEQzI7jwfoXj7z4fxZUx/Mhj2w==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.12.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.2.8.tgz", "integrity": "sha512-N9iozRybwAQ2dn9Fot9kI6/w9vos2oTXLhtK7ovGqwZjlOcxu6XhPlpLpC+INsxktqHinn5gS2DXDjDF2kG5sQ==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.12.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.2.0.tgz", "integrity": "sha512-DZZZBvC7sjcYh4MazJSGiWMI2L7E0oCiRHREDzIxi/M2LY79/21iXt6aPLHge82wi5LsuRF5A06Ds3+0mlh6CQ==", "license": "Apache-2.0", "dependencies": { "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-4.2.8.tgz", "integrity": "sha512-oGMaLj4tVZzLi3itBa9TCswgMBr7k9b+qKYowQ6x1rTyTuO1IU2YHdHUa+891OsOH+wCsH7aTPRsTJO3RMQmjQ==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.12.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.2.8.tgz", "integrity": "sha512-RO0jeoaYAB1qBRhfVyq0pMgBoUK34YEJxVxyjOWYZiOKOq2yMZ4MnVXMZCUDenpozHue207+9P5ilTV1zeda0A==", "license": "Apache-2.0", "dependencies": { "@smithy/protocol-http": "^5.3.8", "@smithy/types": "^4.12.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.4.16", "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.4.16.tgz", "integrity": "sha512-L5GICFCSsNhbJ5JSKeWFGFy16Q2OhoBizb3X2DrxaJwXSEujVvjG9Jt386dpQn2t7jINglQl0b4K/Su69BdbMA==", "license": "Apache-2.0", "dependencies": { "@smithy/core": "^3.23.2", "@smithy/middleware-serde": "^4.2.9", "@smithy/node-config-provider": "^4.3.8", "@smithy/shared-ini-file-loader": "^4.4.3", "@smithy/types": "^4.12.0", "@smithy/url-parser": "^4.2.8", "@smithy/util-middleware": "^4.2.8", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } } ``` ```json { "version": "4.4.33", "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.4.33.tgz", "integrity": "sha512-jLqZOdJhtIL4lnA9hXnAG6GgnJlo1sD3FqsTxm9wSfjviqgWesY/TMBVnT84yr4O0Vfe0jWoXlfFbzsBVph3WA==", "license": "Apache-2.0", "dependencies": { "@smithy/node-config-provider": "^4.3.8", "@smithy/protocol-http": "^5.3.8", "@smithy/service-error-classification": "^4.2.8", ``` -------------------------------- ### Quick Install Test Build at Specific Commit Source: https://docs.terragrunt.com/getting-started/install Install a test build from a specific commit by providing the commit SHA and the --test flag to the install script. ```bash curl -sSfL --proto '=https' --tlsv1.2 https://terragrunt.com/install | bash -s -- --test --commit ``` -------------------------------- ### Manual Install Latest Tip Build Source: https://docs.terragrunt.com/getting-started/install Manually install the latest tip build by downloading the archive, verifying checksums, and extracting the binary. ```bash set -euo pipefail # Set your platform (linux, darwin, windows) and architecture (amd64, arm64, 386) OS="linux" ARCH="amd64" ARCHIVE="terragrunt_${OS}_${ARCH}.tar.gz" # Download the archive and checksums curl -sL -o "$ARCHIVE" \ "https://builds.terragrunt.com/api/v1/tip/latest/download?os=${OS}&arch=${ARCH}" curl -sL -o SHA256SUMS \ "https://builds.terragrunt.com/api/v1/tip/latest/download?filename=SHA256SUMS" # Verify checksum EXPECTED=$(awk -v f="$ARCHIVE" '$2 == f {print $1; exit}' SHA256SUMS) ACTUAL=$(sha256sum "$ARCHIVE" | awk '{print $1}') # macOS: use "shasum -a 256" if [ "$EXPECTED" != "$ACTUAL" ]; then echo "Checksum verification failed!" exit 1 fi echo "Checksum verified!" # Extract and install tar -xzf "$ARCHIVE" chmod +x "terragrunt_${OS}_${ARCH}" sudo mv "terragrunt_${OS}_${ARCH}" /usr/local/bin/terragrunt ``` -------------------------------- ### Quick Install Latest Tip Build Source: https://docs.terragrunt.com/getting-started/install Use the install script with the --tip flag to quickly install the latest tip build of Terragrunt. ```bash curl -sSfL --proto '=https' --tlsv1.2 https://terragrunt.com/install | bash -s -- --tip ``` -------------------------------- ### Full Migration Workflow Example Source: https://docs.terragrunt.com/reference/cli/commands/backend/migrate This example demonstrates the complete process of renaming a unit and migrating its backend state, including copying, migrating, and then removing the old unit. ```bash cp -R old-unit-name new-unit-name terragrunt backend migrate old-unit-name new-unit-name rm -rf old-unit-name ``` -------------------------------- ### Manual Install Tip Build at Specific Commit Source: https://docs.terragrunt.com/getting-started/install Manually install a tip build from a specific commit by downloading the archive, verifying checksums, and extracting the binary. ```bash set -euo pipefail # Set the commit SHA, platform, and architecture COMMIT="abc123def456" OS="linux" ARCH="amd64" ARCHIVE="terragrunt_${OS}_${ARCH}.tar.gz" # Download the archive and checksums curl -sL -o "$ARCHIVE" \ "https://builds.terragrunt.com/api/v1/tip/${COMMIT}/download?os=${OS}&arch=${ARCH}" curl -sL -o SHA256SUMS \ "https://builds.terragrunt.com/api/v1/tip/${COMMIT}/download?filename=SHA256SUMS" # Verify checksum EXPECTED=$(awk -v f="$ARCHIVE" '$2 == f {print $1; exit}' SHA256SUMS) ACTUAL=$(sha256sum "$ARCHIVE" | awk '{print $1}') # macOS: use "shasum -a 256" if [ "$EXPECTED" != "$ACTUAL" ]; then echo "Checksum verification failed!" exit 1 fi echo "Checksum verified!" # Extract and install tar -xzf "$ARCHIVE" chmod +x "terragrunt_${OS}_${ARCH}" sudo mv "terragrunt_${OS}_${ARCH}" /usr/local/bin/terragrunt ``` -------------------------------- ### Quick Install Terragrunt Source: https://docs.terragrunt.com/getting-started/install Use this command for the fastest installation on Linux or macOS. It downloads and executes the installation script directly. ```bash curl -sSfL --proto '=https' --tlsv1.2 https://terragrunt.com/install | bash ``` -------------------------------- ### Install Terragrunt on FreeBSD with Pkg Source: https://docs.terragrunt.com/getting-started/install Use Pkg to install Terragrunt on FreeBSD. ```bash pkg install terragrunt ``` -------------------------------- ### View Terragrunt Install Script Options Source: https://docs.terragrunt.com/getting-started/install To see all available options for the installation script or to review the script's content before execution, use this command. ```bash curl -sSfL --proto '=https' --tlsv1.2 https://terragrunt.com/install | bash -s -- --help ``` -------------------------------- ### Manual Install Test Build at Specific Commit Source: https://docs.terragrunt.com/getting-started/install Manually install a test build from a specific commit by downloading the archive, verifying checksums, and extracting the binary. ```bash set -euo pipefail # Set the commit SHA, platform, and architecture COMMIT="abc123def456" OS="linux" ARCH="amd64" ARCHIVE="terragrunt_${OS}_${ARCH}.tar.gz" BASE_URL="https://builds.terragrunt.com/test/${COMMIT}" # Download the archive and checksums curl -sL -o "$ARCHIVE" "${BASE_URL}/${ARCHIVE}" curl -sL -o SHA256SUMS "${BASE_URL}/SHA256SUMS" # Verify checksum EXPECTED=$(awk -v f="$ARCHIVE" '$2 == f {print $1; exit}' SHA256SUMS) ACTUAL=$(sha256sum "$ARCHIVE" | awk '{print $1}') # macOS: use "shasum -a 256" if [ "$EXPECTED" != "$ACTUAL" ]; then echo "Checksum verification failed!" exit 1 fi echo "Checksum verified!" # Extract and install tar -xzf "$ARCHIVE" chmod +x "terragrunt_${OS}_${ARCH}" sudo mv "terragrunt_${OS}_${ARCH}" /usr/local/bin/terragrunt ``` -------------------------------- ### Install Terragrunt on Gentoo with Emerge Source: https://docs.terragrunt.com/getting-started/install Use emerge to install Terragrunt on Gentoo Linux. ```bash emerge -a app-admin/terragrunt-bin ``` -------------------------------- ### Build Terragrunt from Source Source: https://docs.terragrunt.com/getting-started/install Clone the Terragrunt repository and use Go to build and install the executable. ```shell git clone https://github.com/gruntwork-io/terragrunt.git cd terragrunt # Feel free to checkout a particular tag, etc if you want here. go install ``` -------------------------------- ### Download and Inspect Terragrunt Install Script Source: https://docs.terragrunt.com/getting-started/install Download the installation script to your local filesystem for review before execution. This is a safer alternative to piping directly to bash. ```bash curl -sSfL --proto '=https' --tlsv1.2 -o install.sh https://terragrunt.com/install less install.sh bash install.sh ``` -------------------------------- ### Terraform Configuration Example Source: https://docs.terragrunt.com/reference/hcl/blocks A sample Terragrunt configuration file demonstrating the use of hooks. ```hcl terragrunt.hcl ``` -------------------------------- ### Example package.json dependencies Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/setup This snippet shows example dependencies in a package.json file, including versions for various AWS SDK packages and related utilities. It's relevant for understanding the project's dependencies when working with AWS SDKs in a Node.js environment. ```json "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "node_modules/@aws-sdk/util-user-agent-node": { "version": "3.972.9", "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.972.9.tgz", "integrity": "sha512-JNswdsLdQemxqaSIBL2HRhsHPUBBziAgoi5RQv6/9avmE5g5RSdt1hWr3mHJ7OxqRYf+KeB11ExWbiqfrnoeaA==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/middleware-user-agent": "^3.972.11", "@aws-sdk/types": "^3.973.1", "@smithy/node-config-provider": "^4.3.8", "@smithy/types": "^4.12.0", "tslib": "^2.6.2" }, "engines": { "node": ">=20.0.0" }, "peerDependencies": { "aws-crt": ">=1.0.0" }, "peerDependenciesMeta": { "aws-crt": { "optional": true } } }, "node_modules/@aws-sdk/xml-builder": { "version": "3.972.19", "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.972.19.tgz", "integrity": "sha512-Cw8IOMdBUEIl8ZlhRC3Dc/E64D5B5/8JhV6vhPLiPfJwcRC84S6F8aBOIi/N4vR9ZyA4I5Cc0Ateb/9EHaJXeQ==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.14.1", "fast-xml-parser": "5.7.1", "tslib": "^2.6.2" }, "engines": { "node": ">=20.0.0" } }, "node_modules/@aws/lambda-invoke-store": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@aws/lambda-invoke-store/-/lambda-invoke-store-0.2.3.tgz", "integrity": "sha512-oLvsaPMTBejkkmHhjf09xTgk71mOqyr/409NKhRIL08If7AhVfUsJhVsx386uJaqNd42v9kWamQ9lFbkoC2dYw==", "license": "Apache-2.0", "engines": { "node": ">=18.0.0" } }, "node_modules/@nodable/entities": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz", "integrity": "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/nodable" } ], "license": "MIT" }, "node_modules/@smithy/abort-controller": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-4.2.8.tgz", "integrity": "sha512-peuVfkYHAmS5ybKxWcfraK7WBBP0J+rkfUcbHJJKQ4ir3UAUNQI+Y4Vt/PqSzGqgloJ5O1dk7+WzNL8wcCSXbw==", "license": "Apache-2.0", "dependencies": { "@smithy/types": "^4.12.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@smithy/chunked-blob-reader": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader/-/chunked-blob-reader-5.2.0.tgz", "integrity": "sha512-WmU0TnhEAJLWvfSeMxBNe5xtbselEO8+4wG0NtZeL8oR21WgH1xiO37El+/Y+H/Ie4SCwBy3MxYWmOYaGgZueA==", "license": "Apache-2.0", "dependencies": { "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@smithy/chunked-blob-reader-native": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-4.2.1.tgz", "integrity": "sha512-lX9Ay+6LisTfpLid2zZtIhSEjHMZoAR5hHCR4H7tBz/Zkfr5ea8RcQ7Tk4mi0P76p4cN+Btz16Ffno7YHpKXnQ==", "license": "Apache-2.0", "dependencies": { "@smithy/util-base64": "^4.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@smithy/config-resolver": { "version": "4.4.6", "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.4.6.tgz", "integrity": "sha512-qJpzYC64kaj3S0fueiu3kXm8xPrR3PcXDPEgnaNMRn0EjNSZFoFjvbUp0YUDsRhN1CB90EnHJtbxWKevnH99UQ==", "license": "Apache-2.0", "dependencies": { "@smithy/node-config-provider": "^4.3.8", "@smithy/types": "^4.12.0", "@smithy/util-config-provider": "^4.2.0", "@smithy/util-endpoints": "^3.2.8", "@smithy/util-middleware": "^4.2.8", "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@smithy/core": { "version": "3.23.2", "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.23.2.tgz", "integrity": "sha512-HaaH4VbGie4t0+9nY3tNBRSxVTr96wzIqexUa6C2qx3MPePAuz7lIxPxYtt1Wc//SPfJLNoZJzfdt0B6ksj2jA==", "license": "Apache-2.0", "dependencies": { "@smithy/middleware-serde": "^4.2.9", ``` -------------------------------- ### Example Output of Hook Execution Source: https://docs.terragrunt.com/features/units/hooks Illustrates the expected output when the 'test_hook' is executed during a 'tofu apply' or 'terraform apply' command. ```bash TF_PATH=tofu COMMAND=apply HOOK_NAME=test_hook ``` -------------------------------- ### Example CSV run report content Source: https://docs.terragrunt.com/features/stacks/run-report This is an example of the data structure for a Terragrunt run report in CSV format. It includes details like Name, Started, Ended, Result, Reason, and Cause for each unit. ```csv Name,Started,Ended,Result,Reason,Cause first-exclude,2025-06-05T16:28:41-04:00,2025-06-05T16:28:41-04:00,excluded,exclude block, second-exclude,2025-06-05T16:28:41-04:00,2025-06-05T16:28:41-04:00,excluded,exclude block, first-failure,2025-06-05T16:28:41-04:00,2025-06-05T16:28:42-04:00,failed,run error, first-success,2025-06-05T16:28:41-04:00,2025-06-05T16:28:41-04:00,succeeded,, second-failure,2025-06-05T16:28:41-04:00,2025-06-05T16:28:42-04:00,failed,run error, second-success,2025-06-05T16:28:41-04:00,2025-06-05T16:28:41-04:00,succeeded,, second-early-exit,2025-06-05T16:28:42-04:00,2025-06-05T16:28:42-04:00,early exit,run error, first-early-exit,2025-06-05T16:28:42-04:00,2025-06-05T16:28:42-04:00,early exit,run error, ``` -------------------------------- ### Example Filters File Content Source: https://docs.terragrunt.com/features/filter/filters-file Define include and exclude patterns for Terragrunt units. Lines starting with '#' and empty lines are ignored. ```text ./subtree/** !./subtree/dependency/** ``` -------------------------------- ### Create Application Directory Structure Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/setup Set up the necessary directories for the application, including nested folders. ```bash mkdir -p app/best-cat cd app/best-cat ``` -------------------------------- ### Initialize and Apply Terralith Infrastructure Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-1-starting-the-terralith Navigate to the 'live' directory and run tofu init followed by tofu apply to deploy your infrastructure. You will be prompted to confirm the apply. ```bash cd live tofu init tofu apply ``` -------------------------------- ### Run Jaeger for OpenTelemetry Tracing Source: https://docs.terragrunt.com/troubleshooting/debugging This command starts a local Jaeger instance, a distributed tracing system, to visualize Terragrunt's operations. Ensure Docker is installed and running. ```bash docker run --rm --name jaeger -e COLLECTOR_OTLP_ENABLED=true -p 16686:16686 -p 4317:4317 -p 4318:4318 jaegertracing/all-in-one:1.54.0 ``` -------------------------------- ### Specify Terraform/OpenTofu Binary Path Source: https://docs.terragrunt.com/reference/cli/commands/run Example of using the --tf-path flag to specify a custom path to the Terraform or OpenTofu binary. This is useful for managing multiple versions or non-standard installations. ```bash terragrunt run plan --tf-path=/usr/local/bin/tofu ``` -------------------------------- ### Filters File Content Example Source: https://docs.terragrunt.com/reference/cli/commands/hcl/validate A filters file can contain multiple filter queries, one per line. Empty lines and lines starting with '#' are ignored. Use '!' to negate a filter. ```text # Production environment filters type=unit ./prod/** # Exclude test units !name=test-* ``` -------------------------------- ### Include Units Matching a Glob Pattern Source: https://docs.terragrunt.com/features/stacks/run-queue Use the --filter flag with a glob pattern to include only specific units. This example includes all units within directories starting with 'subtree'. ```bash terragrunt run --all --filter './subtree/**' -- plan ``` -------------------------------- ### Create Terragrunt Configuration for Tutorial Project Source: https://docs.terragrunt.com/getting-started/quick-start Create an empty Terragrunt configuration file within the 'foo' directory to integrate the existing OpenTofu project with Terragrunt. ```bash touch foo/terragrunt.hcl ``` -------------------------------- ### Exclude Units Matching a Glob Pattern Source: https://docs.terragrunt.com/features/stacks/run-queue Use the --filter flag with a negative glob pattern (prefixed with '!') to exclude specific units. This example excludes all units within directories starting with 'subtree'. ```bash terragrunt run --all --filter '!./subtree/**' -- plan ``` -------------------------------- ### Create Live Directory Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-1-starting-the-terralith Creates the 'live' directory to house infrastructure provisioning code, a recommended practice for separating infrastructure patterns. ```bash mkdir live ``` -------------------------------- ### Render all configurations and write to JSON files Source: https://docs.terragrunt.com/reference/cli/commands/render This example demonstrates rendering all Terragrunt configurations in the current working directory and writing them to `terragrunt.rendered.json` files. It uses the `--all`, `--json`, and `--write` flags. ```bash terragrunt render --all --json ``` -------------------------------- ### Download latest tip build by platform Source: https://docs.terragrunt.com/process/releases Downloads the `.tar.gz` archive for the latest tip build, specifying the operating system and architecture. The response redirects to the actual archive file. ```plaintext GET /api/v1/tip/latest/download?os=&arch= ``` ```bash curl -L -o terragrunt.tar.gz \ "https://builds.terragrunt.com/api/v1/tip/latest/download?os=linux&arch=amd64" ``` -------------------------------- ### Initialize and Apply Terralith/Terragrunt Configuration Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-3-adding-dev Run these commands in the 'live' directory to initialize the Terraform backend and apply the new environment configuration after adding a module. ```bash tofu init tofu apply ``` -------------------------------- ### Apply Terragrunt configuration Source: https://docs.terragrunt.com This command navigates into the 'foo' directory and applies the Terragrunt configuration, which in turn executes the OpenTofu configuration. This will initialize the backend, download providers, and create the specified resources, such as the local file. ```bash $ cd foo $ terragrunt apply -auto-approve ``` ```stdout 18:44:26.066 STDOUT tofu: Initializing the backend... 18:44:26.067 STDOUT tofu: Initializing provider plugins... 18:44:26.067 STDOUT tofu: - Finding latest version of hashicorp/local... 18:44:26.717 STDOUT tofu: - Installing hashicorp/local v2.5.2... 18:44:27.033 STDOUT tofu: - Installed hashicorp/local v2.5.2 (signed, key ID 0C0AF313E5FD9F80) 18:44:27.033 STDOUT tofu: Providers are signed by their developers. 18:44:27.033 STDOUT tofu: If you'd like to know more about provider signing, you can read about it here: 18:44:27.033 STDOUT tofu: https://opentofu.org/docs/cli/plugins/signing/ 18:44:27.034 STDOUT tofu: OpenTofu has created a lock file .terraform.lock.hcl to record the provider 18:44:27.034 STDOUT tofu: selections it made above. Include this file in your version control repository 18:44:27.034 STDOUT tofu: so that OpenTofu can guarantee to make the same selections by default when 18:44:27.034 STDOUT tofu: you run "tofu init" in the future. 18:44:27.034 STDOUT tofu: OpenTofu has been successfully initialized! 18:44:27.035 STDOUT tofu: You may now begin working with OpenTofu. Try running "tofu plan" to see 18:44:27.035 STDOUT tofu: any changes that are required for your infrastructure. All OpenTofu commands 18:44:27.035 STDOUT tofu: should now work. 18:44:27.035 STDOUT tofu: If you ever set or change modules or backend configuration for OpenTofu, 18:44:27.035 STDOUT tofu: rerun this command to reinitialize your working directory. If you forget, other 18:44:27.035 STDOUT tofu: commands will detect it and remind you to do so if necessary. 18:44:27.362 STDOUT tofu: OpenTofu used the selected providers to generate the following execution 18:44:27.362 STDOUT tofu: plan. Resource actions are indicated with the following symbols: 18:44:27.362 STDOUT tofu: + create 18:44:27.362 STDOUT tofu: OpenTofu will perform the following actions: 18:44:27.362 STDOUT tofu: # local_file.file will be created 18:44:27.362 STDOUT tofu: + resource "local_file" "file" { 18:44:27.362 STDOUT tofu: + content = "Hello, World!" 18:44:27.362 STDOUT tofu: + content_base64sha256 = (known after apply) 18:44:27.362 STDOUT tofu: + content_base64sha512 = (known after apply) 18:44:27.362 STDOUT tofu: + content_md5 = (known after apply) 18:44:27.362 STDOUT tofu: + content_sha1 = (known after apply) 18:44:27.362 STDOUT tofu: + content_sha256 = (known after apply) 18:44:27.362 STDOUT tofu: + content_sha512 = (known after apply) 18:44:27.362 STDOUT tofu: + directory_permission = "0777" 18:44:27.362 STDOUT tofu: + file_permission = "0777" ``` -------------------------------- ### Install Terragrunt on macOS with Homebrew Source: https://docs.terragrunt.com/getting-started/install Use Homebrew to install Terragrunt on macOS. ```bash brew install terragrunt ``` -------------------------------- ### Create and Initialize Git Repository Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/setup Use these bash commands to create a new directory for your project and initialize it as a Git repository. ```bash mkdir terralith-to-terragrunt cd terralith-to-terragrunt git init ``` -------------------------------- ### Install Terragrunt on Windows with Chocolatey Source: https://docs.terragrunt.com/getting-started/install Use Chocolatey to install Terragrunt on Windows systems. ```bash choco install terragrunt ``` -------------------------------- ### Create prod directory Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-4-breaking-the-terralith Create a top-level directory for the 'prod' environment within the 'live' directory. ```bash mkdir prod ``` -------------------------------- ### Terragrunt Bare Include Example Source: https://docs.terragrunt.com/migrate/bare-include This is an example of a bare include in a Terragrunt configuration file. ```hcl include { path = find_in_parent_folders("root.hcl") } ``` -------------------------------- ### Install Terragrunt on Arch Linux with Pacman Source: https://docs.terragrunt.com/getting-started/install Use pacman to install Terragrunt on Arch Linux. ```bash pacman -S terragrunt ``` -------------------------------- ### Initialize and Plan Changes Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-2-refactoring Runs `tofu init` to re-initialize the project after introducing modules, followed by `tofu plan` to preview changes. This step is crucial for detecting unintended infrastructure modifications. ```bash $ tofu init $ tofu plan ... Plan: 11 to add, 0 to change, 11 to destroy. ... ``` -------------------------------- ### Install Terragrunt Autocomplete Source: https://docs.terragrunt.com/getting-started/install Install the autocomplete package for Terragrunt commands. This requires restarting your shell afterward. ```bash terragrunt --install-autocomplete ``` -------------------------------- ### Terragrunt Named Include Example Source: https://docs.terragrunt.com/migrate/bare-include This is an example of a named include, the recommended alternative to bare includes in Terragrunt. ```hcl include "root" { path = find_in_parent_folders("root.hcl") } ``` -------------------------------- ### Example Environment Configuration Source: https://docs.terragrunt.com/features/units/includes This is an example of a Terragrunt configuration for a specific environment (qa/app) before refactoring for DRY principles. ```hcl include "root" { path = find_in_parent_folders("root.hcl") } terraform { source = "github.com//modules.git//app?ref=v0.1.0" } dependency "vpc" { config_path = "../vpc" } dependency "mysql" { config_path = "../mysql" } inputs = { env = "qa" basename = "example-app" vpc_id = dependency.vpc.outputs.vpc_id subnet_ids = dependency.vpc.outputs.subnet_ids mysql_endpoint = dependency.mysql.outputs.endpoint } ``` -------------------------------- ### Initialize Terraform with State Migration Source: https://docs.terragrunt.com/guides/terralith-to-terragrunt/step-4-breaking-the-terralith Use `tofu init -migrate-state` to initialize the backend and migrate existing state to the new configuration. ```bash tofu init -migrate-state Initializing the backend... Backend configuration changed! OpenTofu has detected that the configuration specified for the backend has changed. OpenTofu will now check for existing state in the backends. Do you want to copy existing state to the new backend? Pre-existing state was found while migrating the previous "s3" backend to the newly configured "s3" backend. No existing state was found in the newly configured "s3" backend. Do you want to copy this state to the new "s3" backend? Enter "yes" to copy and "no" to start with an empty state. Enter a value: yes Successfully configured the backend "s3"! OpenTofu will automatically use this backend unless the backend configuration changes. ``` -------------------------------- ### Example .terragrunt-catalog-ignore file Source: https://docs.terragrunt.com/features/catalog/tui This example demonstrates how to use patterns in a .terragrunt-catalog-ignore file to exclude directories and specific subpaths from catalog discovery. It shows common use cases like ignoring an entire 'examples' directory and selectively keeping certain paths within a 'test' directory. ```plaintext # Keep examples out of the catalog. examples examples/** # Skip everything under test/ except test/keep. test/** !test/keep ``` -------------------------------- ### Progressive Rollout with --working-dir Source: https://docs.terragrunt.com/features/units/includes Implement a promotion workflow by using --working-dir to scope updates to specific environments sequentially. This allows for controlled rollouts and validation at each stage. ```bash # Roll out the change to the qa environment first terragrunt run --all plan --queue-include-units-reading _env/app.hcl --working-dir qa terragrunt run --all apply --queue-include-units-reading _env/app.hcl --working-dir qa # If the apply succeeds to qa, move on to the stage environment terragrunt run --all plan --queue-include-units-reading _env/app.hcl --working-dir stage terragrunt run --all apply --queue-include-units-reading _env/app.hcl --working-dir stage # And finally, prod. terragrunt run --all plan --queue-include-units-reading _env/app.hcl --working-dir prod terragrunt run --all apply --queue-include-units-reading _env/app.hcl --working-dir prod ``` -------------------------------- ### Download Latest Tip Build by Platform Source: https://docs.terragrunt.com/process/releases Downloads the `.tar.gz` archive for the latest tip build, tailored for a specific operating system and architecture. ```APIDOC ## GET /api/v1/tip/latest/download?os=&arch= ### Description Redirects to the `.tar.gz` archive for the given OS and architecture for the latest tip build. ### Method GET ### Endpoint /api/v1/tip/latest/download ### Query Parameters - **os** (string) - Required - The operating system (e.g., linux, darwin, windows). - **arch** (string) - Required - The architecture (e.g., amd64, arm64). ### Request Example ```bash curl -L -o terragrunt.tar.gz \ "https://builds.terragrunt.com/api/v1/tip/latest/download?os=linux&arch=amd64" ``` ``` -------------------------------- ### Install a specific Terragrunt version with asdf Source: https://docs.terragrunt.com/getting-started/install Use asdf to install and manage specific versions of Terragrunt. This is useful for pinning versions in projects. ```bash asdf plugin add terragrunt asdf install terragrunt v0.99.0 ``` -------------------------------- ### Install a specific Terragrunt version with mise Source: https://docs.terragrunt.com/getting-started/install Use mise to install and manage specific versions of Terragrunt. This is useful for pinning versions in projects. ```bash mise install terragrunt v0.99.0 ``` -------------------------------- ### Download Tip Build by Commit SHA and Platform Source: https://docs.terragrunt.com/process/releases Downloads the `.tar.gz` archive for a specific tip build (identified by commit SHA), tailored for a given operating system and architecture. ```APIDOC ## GET /api/v1/tip/{ref}/download?os=&arch= ### Description Redirects to the `.tar.gz` archive for the given OS and architecture for a specific tip build. ### Method GET ### Endpoint /api/v1/tip/{ref}/download ### Path Parameters - **ref** (string) - Required - The commit SHA of the tip build. ### Query Parameters - **os** (string) - Required - The operating system (e.g., linux, darwin, windows). - **arch** (string) - Required - The architecture (e.g., amd64, arm64). ### Request Example ```bash curl -L -o terragrunt.tar.gz \ "https://builds.terragrunt.com/api/v1/tip/abc123def456/download?os=darwin&arch=arm64" ``` ```