-
-
Notifications
You must be signed in to change notification settings - Fork 135
Introduce Atmos YAML functions #810
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
Conversation
# Conflicts: # website/docs/integrations/github-actions/setup-atmos.mdx
# Conflicts: # go.mod # go.sum
# Conflicts: # examples/quick-start-advanced/Dockerfile # go.mod # go.sum # internal/exec/help.go # website/docs/integrations/atlantis.mdx
# Conflicts: # examples/quick-start-advanced/Dockerfile # website/docs/integrations/atlantis.mdx
…put.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 0
🧹 Outside diff range and nitpick comments (3)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (3)
23-32: Consider enhancing argument descriptions with example values.While the arguments are well-documented, adding example values would make it even clearer:
<dl> <dt>`component`</dt> - <dd>Atmos component name</dd> + <dd>Atmos component name (e.g., `vpc`, `eks`, `rds`)</dd> <dt>`stack`</dt> - <dd>Atmos stack name</dd> + <dd>Atmos stack name (e.g., `plat-ue2-dev`, `plat-ue2-prod`)</dd> <dt>`output`</dt> - <dd>Terraform output</dd> + <dd>Terraform output (e.g., `vpc_id`, `subnet_ids`, `security_group_id`)</dd> </dl>
43-57: Consider adding example output formats.The examples show different output types but could be more helpful with sample outputs:
components: terraform: my_lambda_component: vars: vpc_config: # Output of type string - security_group_id: !terraform.output security-group/lambda {{ .stack }} id + # Returns: "sg-1234567890abcdef0" + security_group_id: !terraform.output security-group/lambda {{ .stack }} id # Output of type list - subnet_ids: !terraform.output vpc {{ .stack }} private_subnet_ids + # Returns: ["subnet-123...", "subnet-456..."] + subnet_ids: !terraform.output vpc {{ .stack }} private_subnet_ids # Output of type map - config_map: !terraform.output config {{ .stack }} config_map + # Returns: {"key1": "value1", "key2": "value2"} + config_map: !terraform.output config {{ .stack }} config_map
61-63: Consider adding a note about stack name validation.It would be helpful to mention how Atmos validates the stack names and what happens if an invalid or non-existent stack is specified.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx(1 hunks)
🧰 Additional context used
📓 Learnings (1)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (2)
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.
🪛 LanguageTool
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
[typographical] ~133-~133: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using the printf "%s-%s-%s" function, you are constructin...
(EN_QUOTES)
[style] ~178-~178: Using many exclamation marks might seem excessive (in this case: 11 exclamation marks for a text that’s 4082 characters long)
Context: ...e stacks or components. - When using !terraform.output with [`atmos describe ...
(EN_EXCESSIVE_EXCLAMATION)
🔇 Additional comments (4)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (4)
1-13: LGTM! Clear and concise introduction.
The metadata and introduction effectively communicate the purpose of the !terraform.output function.
35-39: LGTM! Clear explanation of template processing order.
The tip effectively explains how template processing interacts with the !terraform.output function.
140-173: LGTM! Comprehensive caching explanation.
The caching behavior is well-documented with clear examples demonstrating the benefits.
174-185: LGTM! Thorough coverage of important considerations.
The considerations section effectively addresses security, performance, and operational aspects that users should be aware of.
🧰 Tools
🪛 LanguageTool
[style] ~178-~178: Using many exclamation marks might seem excessive (in this case: 11 exclamation marks for a text that’s 4082 characters long)
Context: ...e stacks or components. - When using !terraform.output with [`atmos describe ...
(EN_EXCESSIVE_EXCLAMATION)
|
These changes were released in v1.111.0. |
what
why
Atmos YAML Functions are a crucial part of Atmos stack manifests. They allow you to manipulate data and perform operations on the data to customize the stack configurations.
Atmos YAML functions are based on YAML Explicit typing and user-defined Explicit Tags (local data types). Explicit tags are denoted by the exclamation point ("!") symbol. Atmos detects the tags in the stack manifests and executes the corresponding functions.
NOTE: YAML data types can be divided into three categories: core, defined, and user-defined. Core are ones expected to exist in any parser (e.g. floats, ints, strings, lists, maps). Many more advanced data types, such as binary data, are defined in the YAML specification but not supported in all implementations. Finally, YAML defines a way to extend the data type definitions locally to accommodate user-defined classes, structures, primitives, and functions.
Atmos YAML functions
The
!templateYAML function can be used to handle template outputs containing maps or lists returned from theatmos.Componenttemplate functionThe
!execYAML function is used to execute shell scripts and assign the results to the sections in Atmos stack manifestsThe
!terraform.outputYAML function is used to read the outputs (remote state) of components directly in Atmos stack manifestsNOTE; You can use Atmos Stack Manifest Templating and Atmos YAML functions in the same stack configurations at the same time. Atmos processes the templates first, and then executes the YAML functions, allowing you to provide the parameters to the YAML functions dynamically.
Examples
Summary by CodeRabbit
Release Notes
New Features
!exec,!template, and!terraform.outputfor enhanced stack manifest capabilities.Documentation Updates
atmos.Componentfunction and the new YAML functions.Dependency Updates