Repository navigation
feat(terragrunt): run hooks, saved plans, and state under native adaptation #3576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Erik Osterman (Cloud Posse) (osterman)
wants to merge
67
commits into
feat/component-plugin-contracts
from
feat/terragrunt-native-compatibility
+15,528
−642
Open
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
eac7507
docs(plugin): define package identity and repository naming
osterman f4b527a
feat(terragrunt): run hooks, saved plans, and state under native adap…
osterman 791f67a
test(list): refresh list instances snapshots for the Type and Engine …
osterman db714c9
fix(terragrunt): repair CI for the compatibility layer
osterman 4ba7d3a
fix(casts): reach the terragrunt-native cast validator from the cast …
osterman 35c2d43
test(terraform): make the hook and toolchain process tests pass on Wi…
osterman 84ed25a
fix(list): match OpenTofu engine detection to execution
osterman e932f16
fix(terraform): check required var files before init and drop --var o…
osterman 7cf2fa6
fix(terragrunt): accept project-root and aliased imports, reject glob…
osterman 5a15479
fix(plugin): keep the publisher-qualified default alias for earlier e…
osterman 8f14ce2
docs(terragrunt): document the coordinates of an imported unit
osterman e833877
fix(terragrunt): keep discovery and output reads working with data fi…
osterman b8db866
fix(terraform): keep plan hooks, engine checks, and plan digests cons…
osterman 40d7bd2
fix(affected): validate watch_excludes and reuse the filtered watch i…
osterman c73d7f9
fix(plugin): preserve binary request in plan fingerprint
osterman d0408c3
fix(terragrunt): initialize empty local backend configuration
osterman eda517c
fix(affected): reuse filtered indexes per change set
osterman 1b1bbe8
test(terragrunt): verify installed unit identities
osterman 08fc1c9
fix(output): anchor default local state paths
osterman 65a62af
fix(terraform): bind downloaded modules to saved plans
osterman 91a0a31
test(terraform): verify reviewed plan reaches apply
osterman 707401c
refactor(configuration): own provider import and watch policy
osterman 21b6991
fix(terraform): bind effective plan output arguments
osterman 2f81e29
fix(terraform): reject plan output flags from TF_CLI_ARGS
osterman ff18c58
fix(terraform): select policy plan artifacts from effective arguments
osterman 427a071
fix(terraform): stream error hook output from temporary files
osterman ce62ac3
Merge origin/feat/component-plugin-contracts into feat/terragrunt-nat…
osterman cfdb818
fix: address L5 configuration review findings
osterman 114daa7
fix(terragrunt): label incomplete dry-run previews
osterman 9568d8e
fix(terragrunt): address L5 saved-plan and execution review findings
osterman 8921b1b
test(execution): drive lifecycle tests through a generated Runner mock
osterman d061c17
test(terraform): use generated mocks for the reviewed-plan runtime
osterman 4f695f6
test(output): resolve configuration state through a generated runtime…
osterman 78de52d
test(terraform): restore the unchanged configuration runtime mock header
osterman f3b275d
test(configuration): generate the provider mock with its identity cap…
osterman d79bbcb
Merge published L4 head 23be87e025 into feat/terragrunt-native-compat…
osterman 9fb30e2
docs(plugin): clarify L5 component service status
osterman 22fc3a6
ci(plugin): authenticate official package checks to GHCR
osterman dcff908
test(terraform): fold PATH regression into toolchain suite
osterman a7f639c
fix(terragrunt): preserve effective plan and preparation inputs
osterman e7bb17f
Merge updated component plugin contracts into Terragrunt compatibility
osterman 68de053
Merge remote-tracking branch 'origin/feat/component-plugin-contracts'…
osterman 41e3c83
Merge remote-tracking branch 'origin/feat/component-plugin-contracts'…
osterman 05b95b4
Merge remote-tracking branch 'origin/feat/component-plugin-contracts'…
osterman 47decc5
fix(terragrunt): evaluate apply-time execution with the request's dow…
osterman d85769c
fix(terraform): harden plan preflight and toolchain PATH selection
osterman f738b5c
fix(terraform): tokenize TF_CLI_ARGS with the engine's rules when gua…
osterman ebe0057
refactor(terragrunt): split unit resolution out of resolve
osterman 4bc6f03
fix(terraform): bind the saved plan to the configuration Terraform read
osterman e237006
Merge branch 'feat/component-plugin-contracts' into feat/terragrunt-n…
osterman a755afd
Merge branch 'feat/component-plugin-contracts' into feat/terragrunt-n…
osterman d786620
Merge branch 'feat/component-plugin-contracts' into feat/terragrunt-n…
osterman 70f57c9
fix(terraform): keep hook failures, init file flags and plan bytes ho…
osterman 8249097
Merge branch 'feat/component-plugin-contracts' into feat/terragrunt-n…
osterman 83b3418
fix(terraform): bind the engine that ran Terraform, not the one prese…
osterman 9d62a30
Merge remote-tracking branch 'origin/feat/component-plugin-contracts'…
osterman 84b9194
test(terraform): give the engine copy an executable extension on Windows
osterman 2bd897b
Merge remote-tracking branch 'origin/feat/component-plugin-contracts'…
osterman a81adae
fix(terraform): honor explicit -detailed-exitcode values in plan stat…
osterman f8eba99
fix(terraform): resolve workdir digest paths before excluding the pla…
osterman c129827
fix(terragrunt): decide prevent_destroy from syntax when the guard pa…
osterman a170c89
fix(terragrunt): enforce destroy protection for environment arguments
osterman 833fff1
refactor(terragrunt): simplify provider discovery and preparation ass…
osterman 0792a6c
Merge L4 plugin-contract checkpoint into L5 native Terragrunt
osterman 51c8aae
Merge L4 projection consolidation and group destroy guard tests
osterman 0e80d24
fix(terraform): finish plugin output init policy and shell mocks
osterman 9bcf0a3
fix(terragrunt): integrate predecessor repairs and finish L5 lint
osterman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
demo/casts/atmos.d/demo/fixtures/terragrunt-native/all.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| commands: | ||
| - name: casts generate demo fixtures terragrunt-native | ||
| description: Regenerate casts sourced from demo/casts/fixtures/terragrunt-native | ||
| env: !include cast-defaults.yaml .env.command | ||
| steps: | ||
| - type: shell | ||
| name: casts-fixtures-terragrunt-native-plan | ||
| command: atmos casts generate demo fixtures terragrunt-native plan | ||
| - name: casts validate demo fixtures terragrunt-native | ||
| description: Validate casts sourced from demo/casts/fixtures/terragrunt-native | ||
| env: !include cast-defaults.yaml .env.command | ||
| steps: | ||
| - type: shell | ||
| name: casts-fixtures-terragrunt-native-plan | ||
| command: atmos casts validate demo fixtures terragrunt-native plan |
89 changes: 89 additions & 0 deletions
89
demo/casts/atmos.d/demo/fixtures/terragrunt-native/plan.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| commands: | ||
| - name: casts generate demo fixtures terragrunt-native plan | ||
| description: Record native Terragrunt discovery and an OpenTofu plan | ||
| env: | ||
| PATH: '{{ env "PWD" }}/../../build:{{ env "PATH" }}' | ||
| ATMOS_TELEMETRY_ENABLED: 'false' | ||
| steps: | ||
| # Build the host and package together so their protocol stays in sync. | ||
| - type: shell | ||
| name: build-host | ||
| working_directory: ../.. | ||
| command: go build -o build/atmos . | ||
| output: none | ||
| - type: shell | ||
| name: build-plugin | ||
| working_directory: ../.. | ||
| command: build/atmos plugin build plugins/terragrunt | ||
| output: none | ||
| - type: workdir | ||
| name: fixture | ||
| source: fixtures/terragrunt-native | ||
| path: ../../.context/cast-fixtures/terragrunt-native | ||
| reset: true | ||
| # Resolve the development package outside the recording; no machine paths | ||
| # belong in the published demo. The blog explains this prerequisite. | ||
| - type: shell | ||
| name: package | ||
| working_directory: ../../.context/cast-fixtures/terragrunt-native | ||
| command: atmos config set plugins.packages.terragrunt.path "../../../plugins/terragrunt" | ||
| output: none | ||
| - type: cast | ||
| name: plan | ||
| working_directory: ../../.context/cast-fixtures/terragrunt-native | ||
| title: Native Terragrunt discovery and planning | ||
| mode: steps | ||
| defaults: | ||
| cast: !include cast-defaults.yaml .cast | ||
| simulate: !include cast-defaults.yaml .simulate | ||
| show: | ||
| labels: false | ||
| output: | ||
| mode: raw | ||
| cast: ../../website/static/casts/demo/fixtures/terragrunt-native/plan.cast | ||
| env: !include cast-defaults.yaml .env.recording | ||
| steps: | ||
| - type: simulate | ||
| text: '# The native plugin is built; enable it for the existing live/ tree.' | ||
| - type: simulate | ||
| text: &enable atmos config set components.terraform.terragrunt.enabled true | ||
| - type: shell | ||
| command: *enable | ||
| - type: simulate | ||
| text: &mode atmos config set components.terraform.terragrunt.mode native | ||
| - type: shell | ||
| command: *mode | ||
| - type: simulate | ||
| text: &scope atmos config set --type=yaml components.terraform.terragrunt.discovery.included_paths '["live/**"]' | ||
| - type: shell | ||
| command: *scope | ||
| - type: simulate | ||
| text: &discover atmos config set components.terraform.terragrunt.discovery.enabled true | ||
| - type: shell | ||
| command: *discover | ||
| - type: simulate | ||
| text: &stacks atmos list stacks | ||
| - type: shell | ||
| command: *stacks | ||
| - type: simulate | ||
| text: &instances atmos list instances | ||
| - type: shell | ||
| command: *instances | ||
| - type: simulate | ||
| text: '# HCL evaluates the greeting; Atmos runs OpenTofu. No cloud credentials needed.' | ||
| - type: simulate | ||
| text: &plan atmos terraform plan demo -s live | ||
| - type: shell | ||
| command: *plan | ||
| interval: 2s | ||
| - type: script | ||
| name: validate | ||
| interpreter: starlark | ||
| script: !include scripts/validate-terragrunt-native.star | ||
| - name: casts validate demo fixtures terragrunt-native plan | ||
| description: Validate native Terragrunt discovery and plan evidence | ||
| steps: | ||
| - type: script | ||
| name: validate | ||
| interpreter: starlark | ||
| script: !include scripts/validate-terragrunt-native.star |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| base_path: . | ||
|
|
||
| components: | ||
| terraform: | ||
| base_path: components/terraform | ||
| command: tofu | ||
| terragrunt: | ||
| enabled: false | ||
| mode: native | ||
| discovery: | ||
| enabled: false | ||
| included_paths: [live/**] | ||
|
|
||
| logs: | ||
| level: Warning | ||
|
|
||
| # Keep the local-development warning, but redact the recorder's checkout path wherever the | ||
| # checkout lives (a home directory, a CI runner workspace, or a Windows drive). | ||
| settings: | ||
| metrics: | ||
| enabled: false | ||
| terminal: | ||
| mask: | ||
| enabled: true | ||
| replacement: '[LOCAL_PLUGIN]' | ||
| patterns: | ||
| - '(/|[A-Za-z]:[\\/])[^[:space:]]*[\\/]plugins[\\/]terragrunt' | ||
19 changes: 19 additions & 0 deletions
19
demo/casts/fixtures/terragrunt-native/live/demo/terragrunt.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Keep the existing Terragrunt layout and evaluate its inputs natively. | ||
| terraform { | ||
| source = "../../modules/demo" | ||
| } | ||
|
|
||
| remote_state { | ||
| backend = "local" | ||
| config = { | ||
| path = "${get_terragrunt_dir()}/terraform.tfstate" | ||
| } | ||
| generate = { | ||
| path = "backend.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| } | ||
| } | ||
|
|
||
| inputs = { | ||
| greeting = upper("hello from terragrunt") | ||
| } |
11 changes: 11 additions & 0 deletions
11
demo/casts/fixtures/terragrunt-native/modules/demo/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| variable "greeting" { | ||
| type = string | ||
| } | ||
|
|
||
| resource "terraform_data" "demo" { | ||
| input = var.greeting | ||
| } | ||
|
|
||
| output "greeting" { | ||
| value = terraform_data.demo.output | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| """Check actual CLI output in the native Terragrunt recording.""" | ||
|
|
||
| load("../cast_checks.star", "load_text", "strip_ansi", "assert_no_error_output", "assert_no_local_paths", "assert_colored") | ||
|
|
||
|
|
||
| def validate(): | ||
| text = load_text("../../website/static/casts/demo/fixtures/terragrunt-native/plan.cast") | ||
| plain = strip_ansi(text) | ||
| assert_no_error_output(text) | ||
| assert_no_local_paths(text) | ||
| assert_colored(text, "Plan:") | ||
| # Commands alone are not proof: require the inventory and real engine plan. | ||
| for needle in [ | ||
| "components.terraform.terragrunt.discovery.enabled true", | ||
| "atmos list stacks", | ||
| "atmos list instances", | ||
| "Component", "Stack", "Type", "Engine", "opentofu", | ||
| "atmos terraform plan demo -s live", | ||
| "terraform_data.demo", | ||
| "HELLO FROM TERRAGRUNT", | ||
| "Plan: 1 to add, 0 to change, 0 to destroy.", | ||
| ]: | ||
| if needle not in plain: | ||
| fail("native Terragrunt cast missing {!r}".format(needle)) | ||
| for marker in ["Error:", "unknown flag", "rpc error", "exit status 1"]: | ||
| if marker in plain: | ||
| fail("native Terragrunt cast contains {!r}".format(marker)) | ||
| ui.success("Native Terragrunt discovery and plan cast validated") | ||
|
|
||
|
|
||
| validate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.