Dependency fetch output from state gcs docs#5503
Dependency fetch output from state gcs docs#5503joshmyers wants to merge 3 commits intogruntwork-io:mainfrom
Conversation
|
@joshmyers is attempting to deploy a commit to the Gruntwork Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughAdds Google Cloud Storage (GCS) backend support for fetching dependency outputs from remote state, updates docs and feature flag to reflect GCS support, extends pkg/config remote-state logic for GCS, and adds GCS test fixtures and integration tests. Changes
Sequence DiagramsequenceDiagram
participant TG as Terragrunt (pkg/config/dependency.go)
participant CFG as Backend Config Parser
participant GCPH as GCP Helper (gcphelper)
participant GCS as Google Cloud Storage
participant JSON as JSON Parser
TG->>CFG: Parse remote-state backend config (backend="gcs", bucket, key/path)
CFG->>TG: Return GCS config (bucket, key, optional path)
TG->>GCPH: Create GCS client (project/creds)
GCPH->>GCS: Initialize authenticated client
GCS->>GCPH: Return client
TG->>GCS: Read object bytes (bucket, key)
GCS->>TG: Return bytes or not-found error
TG->>JSON: Parse state JSON into outputs
JSON->>TG: Return outputs map
TG->>TG: Provide outputs to dependent modules / fallback as needed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs-starlight/src/content/docs/06-troubleshooting/03-performance.mdx (1)
49-54:⚠️ Potential issue | 🟡 MinorAlign the S3-only wording with the new GCS support.
Line 53 still says the state file is fetched from S3 only, which now contradicts the updated S3+GCS support described below.
✏️ Suggested wording tweak
-You can significantly improve the performance of dependency blocks by using the [`dependency-fetch-output-from-state`](https://terragrunt.gruntwork.io/docs/reference/experiments/#dependency-fetch-output-from-state) experiment. When the experiment is active, Terragrunt will resolve outputs by directly fetching the backend state file from S3 and parse it directly, avoiding any overhead incurred by calling the `output -json` command of OpenTofu/Terraform. +You can significantly improve the performance of dependency blocks by using the [`dependency-fetch-output-from-state`](https://terragrunt.gruntwork.io/docs/reference/experiments/#dependency-fetch-output-from-state) experiment. When the experiment is active, Terragrunt will resolve outputs by directly fetching the backend state file from S3 or GCS and parse it directly, avoiding any overhead incurred by calling the `output -json` command of OpenTofu/Terraform.As per coding guidelines: “Review the documentation for clarity, grammar, and spelling… Make sure that the docs-starlight documentation is accurate and up-to-date with the docs documentation.”
🤖 Fix all issues with AI agents
In `@pkg/config/dependency.go`:
- Around line 1231-1299: getTerragruntOutputJSONFromRemoteStateGCS currently
treats a missing GCS object as a hard error; detect the GCS "object not found"
case (check for storage.ErrObjectNotExist and/or googleapi 404 when calling
obj.NewReader) and return a sentinel/recognizable error so the caller can fall
back to mock outputs like S3 does (mirror isAwsS3NoSuchKey behavior). Update
getTerragruntOutputJSONFromRemoteStateGCS (around the obj.NewReader error
handling) to map the GCS-not-found condition to the same fallback-triggering
signal used for S3 (or add an isGcsObjectNotFound helper and use it in
getTerragruntOutput) so mock-output fallback is preserved.
fc867a5 to
d5161d9
Compare
d5161d9 to
7989616
Compare
7989616 to
a29d650
Compare
Description
Docs linked to #5499
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Docs linked to #5499
Summary by CodeRabbit
New Features
Documentation
Tests