-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Update !terraform.output
and atmos.Component
functions
#944
Conversation
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
📝 WalkthroughWalkthroughThis pull request encompasses multiple updates across the Atmos project, focusing on version upgrades, dependency management, and documentation improvements. The changes include updating the Atmos tool version, modifying Go dependencies, refactoring Terraform output handling, enhancing documentation for the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
📒 Files selected for processing (7)
examples/quick-start-advanced/Dockerfile
(1 hunks)go.mod
(11 hunks)internal/exec/terraform_outputs.go
(7 hunks)internal/exec/yaml_func_terraform_output.go
(0 hunks)tests/fixtures/scenarios/complete/stacks/catalog/terraform/template-functions-test2/defaults.yaml
(2 hunks)website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
(4 hunks)website/docs/integrations/atlantis.mdx
(1 hunks)
💤 Files with no reviewable changes (1)
- internal/exec/yaml_func_terraform_output.go
✅ Files skipped from review due to trivial changes (1)
- website/docs/integrations/atlantis.mdx
🧰 Additional context used
📓 Learnings (4)
examples/quick-start-advanced/Dockerfile (2)
Learnt from: aknysh
PR: cloudposse/atmos#775
File: examples/quick-start-advanced/Dockerfile:9-9
Timestamp: 2024-11-12T05:52:05.088Z
Learning: It is acceptable to set `ARG ATMOS_VERSION` to a future version like `1.105.0` in `examples/quick-start-advanced/Dockerfile` if that will be the next release.
Learnt from: osterman
PR: cloudposse/atmos#801
File: examples/quick-start-advanced/Dockerfile:9-9
Timestamp: 2024-11-23T00:13:22.004Z
Learning: When updating the `ATMOS_VERSION` in Dockerfiles, the team prefers to pin to the next future version when the PR merges, even if the version is not yet released.
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (3)
Learnt from: aknysh
PR: cloudposse/atmos#810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:0-0
Timestamp: 2024-12-03T04:01:16.446Z
Learning: In the `terraform.output.mdx` documentation file (`website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx`), the cache invalidation and cache scope behavior for the `!terraform.output` function are already described.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:104-110
Timestamp: 2024-12-03T03:49:30.395Z
Learning: In the documentation for `!terraform.output`, warnings about template variable availability are already covered in other sections, so no need to suggest adding them here.
internal/exec/terraform_outputs.go (1)
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.
tests/fixtures/scenarios/complete/stacks/catalog/terraform/template-functions-test2/defaults.yaml (1)
Learnt from: aknysh
PR: cloudposse/atmos#810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
🪛 GitHub Actions: Dependency Review
go.mod
[error] Incompatible license detected: github.com/magiconair/[email protected] uses BSD-2-Clause license which is not allowed
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Acceptance Tests (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (11)
internal/exec/terraform_outputs.go (3)
140-146
: LGTM! Good addition of the-reconfigure
flag support.The implementation correctly respects the
components.terraform.init_run_reconfigure
setting fromatmos.yaml
. This change helps prevent backend configuration errors when retrieving outputs from the same component across multiple stacks.
258-281
: Well-structured refactoring of output variable handling!The refactoring improves the code by:
- Using YQ expressions for complex output types
- Adding proper prefix handling for output paths
- Providing clearer error messages
291-307
: Consistent implementation for static remote state outputs.The changes maintain consistency with the regular output handling, ensuring both paths handle YQ expressions similarly.
examples/quick-start-advanced/Dockerfile (1)
9-9
: LGTM! Version update is aligned with team practices.The update to ATMOS_VERSION=1.149.0 follows the established pattern of pinning to the next future version.
tests/fixtures/scenarios/complete/stacks/catalog/terraform/template-functions-test2/defaults.yaml (1)
47-53
: Excellent test coverage for YQ expressions!The new test cases comprehensively cover various YQ expression patterns:
- Array indexing with and without dot prefix
- Object property access
- Nested property access
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (2)
48-71
: Clear and comprehensive documentation for YQ expressions!The new section effectively:
- Introduces YQ expressions for complex outputs
- Provides practical examples
- Links to additional YQ documentation
87-92
: Well-chosen practical examples!The examples effectively demonstrate both list and map access patterns using YQ expressions.
go.mod (4)
55-55
: OAuth2 package update requires review.The OAuth2 package update to v0.25.0 might affect authentication flows. Ensure all OAuth2-related functionality is tested after this update.
✅ Verification successful
OAuth2 package update is safe ✅
The update to oauth2 v0.25.0 is safe as the codebase only uses stable core functionality (StaticTokenSource, Token, NewClient) for GitHub authentication. No complex OAuth2 flows are implemented that could be affected by this update.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for OAuth2 usage patterns rg "oauth2\." -A 3Length of output: 346
🧰 Tools
🪛 GitHub Actions: Dependency Review
[error] Incompatible license detected: github.com/magiconair/[email protected] uses BSD-2-Clause license which is not allowed
90-104
: AWS SDK indirect dependencies need alignment.Multiple AWS SDK indirect dependencies have been updated. Ensure they align with the main AWS SDK version to prevent compatibility issues.
✅ Verification successful
AWS SDK dependencies are properly aligned
The indirect dependencies are correctly managed by Go modules, and the version differences are expected as AWS services evolve independently. The internal package versions are consistent where required, ensuring compatibility.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check version alignment of AWS SDK indirect dependencies rg "github.com/aws/aws-sdk-go-v2/.*v\d+\.\d+\.\d+" --no-filename | sort | uniqLength of output: 8188
🧰 Tools
🪛 GitHub Actions: Dependency Review
[error] Incompatible license detected: github.com/magiconair/[email protected] uses BSD-2-Clause license which is not allowed
10-11
: Consider pinning AWS SDK dependencies to compatible versions.The AWS SDK dependencies have been updated to newer versions. Ensure all AWS SDK packages are updated together to maintain version compatibility.
✅ Verification successful
AWS SDK dependencies are properly aligned ✅
All AWS SDK dependencies are at compatible versions. The version differences between packages are normal and expected, as different components can have different release cycles while maintaining compatibility.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for version mismatches in AWS SDK dependencies rg "github.com/aws/aws-sdk-go-v2.*v\d+\.\d+\.\d+" -A 1Length of output: 9374
🧰 Tools
🪛 GitHub Actions: Dependency Review
[error] Incompatible license detected: github.com/magiconair/[email protected] uses BSD-2-Clause license which is not allowed
40-40
: Verify YQ version compatibility.The YQ package has been updated to v4.45.1. This is a significant version bump that might introduce breaking changes in YAML processing.
✅ Verification successful
YQ v4.45.1 update appears safe 🛡️
The codebase uses stable YQ v4 APIs for basic YAML processing (evaluation, encoding, decoding) in a single utility function. These core features are unlikely to have breaking changes within the v4.x series.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for YQ usage patterns that might be affected by the version update ast-grep --pattern 'yq.$$$'Length of output: 29
Script:
#!/bin/bash # Search for YQ imports and usage rg -l "github.com/mikefarah/yq" --type go rg -l "exec.Command.*yq" --type go rg -l "yaml\." --type go -A 3Length of output: 309
Script:
#!/bin/bash # Examine YQ usage patterns cat pkg/utils/yq_utils.go rg -p "yq\." --type goLength of output: 1972
🧰 Tools
🪛 GitHub Actions: Dependency Review
[error] Incompatible license detected: github.com/magiconair/[email protected] uses BSD-2-Clause license which is not allowed
@coderabbitai please review |
@aknysh i'll review the changes in the pr. ✅ Actions performedReview triggered.
|
These changes were released in v1.149.0. |
what
!terraform.output
YAML functionatmos.Component
template functionwhy
When executing
!terraform.output
andatmos.Component
functions, honor thecomponents.terraform.init_run_reconfigure
setting inatmos.yaml
. If it's set totrue
, add the-reconfigure
flag to theterraform output
command when executing it to get the component outputs. This prevents an issue when you use the functions to retrieve the outputs of the same component from many different stacks (without using the-reconfigure
flag, Terraform detects that the backend configuration has changed and complains about it)Use YQ expressions to retrieve items from complex output types
To retrieve items from complex output types such as maps and lists, or do any kind of filtering or querying,
you can utilize YQ expressions.
For example:
Examples
references
Summary by CodeRabbit
Summary by CodeRabbit
Dependency Updates
Documentation
!terraform.output
function, including usage examples and caching behavior.Improvements