-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Introduce Atmos YAML functions #810
base: main
Are you sure you want to change the base?
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
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request primarily updates the Changes
Possibly related PRs
Suggested reviewers
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
🧹 Outside diff range and nitpick comments (22)
internal/exec/yaml_func_template.go (1)
21-21
: Simplify error creation withfmt.Errorf
Use
fmt.Errorf
instead oferrors.New(fmt.Sprintf(...))
.Apply this diff:
- err := errors.New(fmt.Sprintf("invalid Atmos YAML function: %s", input)) + err := fmt.Errorf("invalid Atmos YAML function: %s", input)🧰 Tools
🪛 golangci-lint (1.62.2)
21-21: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
internal/exec/yaml_func_exec.go (1)
21-21
: Simplify error creation withfmt.Errorf
Use
fmt.Errorf
instead oferrors.New(fmt.Sprintf(...))
.Apply this diff:
- err := errors.New(fmt.Sprintf("invalid Atmos YAML function: %s", input)) + err := fmt.Errorf("invalid Atmos YAML function: %s", input)🧰 Tools
🪛 golangci-lint (1.62.2)
21-21: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
internal/exec/yaml_func_utils.go (1)
10-12
: Consider implementing error handling in ProcessCustomYamlTagsCurrently,
ProcessCustomYamlTags
returns a nil error. Capturing and returning errors during processing could enhance robustness.examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml (5)
16-17
: Duplicate Assignments fortest_1
andtest_2
Both
test_1
andtest_2
are assigned the same value. Consider removing one if duplicate variables are unnecessary.
18-20
: Redundant Assignments fortest_3
andtest_5
test_3
andtest_5
have identical assignments. To maintain clarity, consider eliminating the redundancy.
21-24
: Inconsistent Usage of Quotes with Custom YAML TagsThere's inconsistency in how custom YAML tags like
!terraform.output
are used—with and without quotes. Standardizing the usage enhances readability and prevents parsing issues.
25-27
: Standardize Quoting for!template
TagsSimilar to the previous point, ensure consistent quoting for
!template
tags to improve consistency.
28-32
: Consistent Use of Quotes with!exec
TagsThe
!exec
tags are used both with and without quotes. Aligning the quoting style enhances clarity.website/docs/core-concepts/stacks/yaml-functions/exec.mdx (2)
42-42
: Adjust grammatical number for correctnessThe phrase "
!exec atmos terraform output
is just as examples" should be revised for proper grammar. Consider changing it to "!exec atmos terraform output
is just an example" or "!exec atmos terraform output
serves as an example".🧰 Tools
🪛 LanguageTool
[uncategorized] ~42-~42: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...exec atmos terraform output` is just as examples to show that you can get the outputs of...(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
54-54
: Include a serial comma for clarityIn the phrase "a complex type (list, map or object)," consider adding a comma after "map" for improved readability: "list, map, or object."
🧰 Tools
🪛 LanguageTool
[style] ~54-~54: The serial comma (Oxford comma, Harvard comma) is missing.
Context: ... If the result is a complex type (list, map or object), the script must return it as a...(SERIAL_COMMA_ON)
website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx (3)
23-23
: Improve symbol formatting for clarityConsider using backticks for the exclamation point symbol to enhance readability: "Explicit tags are denoted by the exclamation point (
!
) symbol."🧰 Tools
🪛 LanguageTool
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...are denoted by the exclamation point ("!") symbol. Atmos detects the tags in ...(EN_QUOTES)
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...e denoted by the exclamation point ("!") symbol. Atmos detects the tags in th...(EN_QUOTES)
28-28
: Add 'and' before the last item in the listFor better readability, consider adding 'and' before the last item: "(e.g., floats, ints, strings, lists, and maps)."
🧰 Tools
🪛 LanguageTool
[style] ~28-~28: A comma is missing here.
Context: ...e ones expected to exist in any parser (e.g. floats, ints, strings, lists, maps). Ma...(EG_NO_COMMA)
39-39
: Add punctuation at the end of the sentencePlease add a period at the end of the sentence to complete it properly.
🧰 Tools
🪛 LanguageTool
[style] ~39-~39: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ing-maps-or-lists) returned from theatmos.Component
template function - The [!exec
...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~39-~39: Please add a punctuation mark at the end of paragraph.
Context: ...tes/functions/atmos.Component) template function - The [!exec
](/core-concepts/st...(PUNCTUATION_PARAGRAPH_END)
website/docs/core-concepts/stacks/yaml-functions/template.mdx (2)
66-66
: Consider varying the phrase 'in many cases'The phrase 'in many cases' is used frequently. You might replace it with an alternative to enhance the writing.
136-136
: Limit the use of exclamation marksUsing many exclamation marks might seem excessive. Consider reducing them for a more formal tone.
🧰 Tools
🪛 LanguageTool
[style] ~136-~136: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2804 characters long)
Context: ...nctionsatmos.Component
,toJson
and!template
, use the [!terraform.output
](/core-concepts/stacks...(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (2)
129-129
: Correct the typographic opening quoteConsider using the correct typographic opening quote here for consistency.
🧰 Tools
🪛 LanguageTool
[typographical] ~129-~129: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using theprintf "%s-%s-%s"
function, you are constructin...(EN_QUOTES)
160-160
: Limit the use of exclamation marksUsing many exclamation marks might seem excessive. Consider reducing them for a more formal tone.
🧰 Tools
🪛 LanguageTool
[style] ~160-~160: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2496 characters long)
Context: ... from the same stack. The YAML function!terraform.output
is executed three time...(EN_EXCESSIVE_EXCLAMATION)
internal/exec/yaml_func_terraform_output.go (1)
60-60
: Remove unnecessary initialization ofoutputProcessed
The variable
outputProcessed
is initially assigned but immediately overwritten later without being used. Removing the initial assignment cleans up the code.Suggested change:
- outputProcessed := map[string]any{}
🧰 Tools
🪛 golangci-lint (1.62.2)
60-60: ineffectual assignment to outputProcessed
(ineffassign)
website/docs/core-concepts/components/terraform/remote-state.mdx (2)
52-57
: Consider rephrasing to enhance readabilityThe sentences starting with "The" can be varied to avoid repetition and improve flow.
🧰 Tools
🪛 LanguageTool
[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...onatmos.Component
function, refer toatmos.Component
. The!terraform.output
Atmos YAML f...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
361-361
: Add missing punctuationPlease add a period at the end of the paragraph for proper grammar.
🧰 Tools
🪛 LanguageTool
[grammar] ~361-~361: Please add a punctuation mark at the end of paragraph.
Context: ...n how to use 'atmos.Component' template function <PrimaryCTA to="/core-con...(PUNCTUATION_PARAGRAPH_END)
internal/exec/describe_stacks.go (1)
365-370
: Refactor to eliminate code duplicationThe code processing custom YAML tags is duplicated for Terraform and Helmfile components. Consolidating it into a shared function would enhance maintainability.
Also applies to: 550-555
internal/exec/utils.go (1)
647-653
: Consider refactoring to eliminate duplicate logicThe check for single command-line arguments in
processArgsAndFlags
appears duplicated. Consolidating this logic would enhance maintainability.Apply this change to remove the duplicate code:
- // For commands like `atmos terraform clean` and `atmos terraform plan`, show the command help - if len(inputArgsAndFlags) == 1 { - info.SubCommand = inputArgsAndFlags[0] - info.NeedHelp = true - return info, nil - }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (2)
go.sum
is excluded by!**/*.sum
website/package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (28)
atmos.yaml
(1 hunks)examples/quick-start-advanced/Dockerfile
(1 hunks)examples/tests/stacks/catalog/terraform/template-functions-test/defaults.yaml
(1 hunks)examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml
(1 hunks)go.mod
(3 hunks)internal/exec/describe_stacks.go
(2 hunks)internal/exec/terraform_generate_backends.go
(1 hunks)internal/exec/terraform_generate_varfiles.go
(1 hunks)internal/exec/utils.go
(2 hunks)internal/exec/validate_component.go
(1 hunks)internal/exec/validate_stacks.go
(1 hunks)internal/exec/yaml_func_exec.go
(1 hunks)internal/exec/yaml_func_template.go
(1 hunks)internal/exec/yaml_func_terraform_output.go
(1 hunks)internal/exec/yaml_func_utils.go
(1 hunks)pkg/config/const.go
(1 hunks)pkg/utils/map_utils.go
(1 hunks)pkg/utils/yaml_utils.go
(2 hunks)pkg/validate/validate_stacks_test.go
(1 hunks)website/docs/core-concepts/components/terraform/remote-state.mdx
(2 hunks)website/docs/core-concepts/stacks/templates/functions/atmos.Component.mdx
(3 hunks)website/docs/core-concepts/stacks/templates/templates.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/exec.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/template.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx
(1 hunks)website/docs/integrations/atlantis.mdx
(1 hunks)website/package.json
(3 hunks)
✅ Files skipped from review due to trivial changes (3)
- pkg/validate/validate_stacks_test.go
- website/docs/core-concepts/stacks/templates/templates.mdx
- go.mod
🧰 Additional context used
📓 Learnings (2)
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.
internal/exec/validate_stacks.go (1)
Learnt from: haitham911
PR: cloudposse/atmos#731
File: internal/exec/validate_stacks.go:0-0
Timestamp: 2024-11-12T05:52:05.088Z
Learning: In `internal/exec/validate_stacks.go`, when downloading the Atmos JSON Schema file to the temp directory, the temporary file is overwritten each time, so explicit removal is not necessary.
🪛 LanguageTool
website/docs/core-concepts/stacks/yaml-functions/exec.mdx
[style] ~39-~39: A comma is missing here.
Context: ...s, or even Atmos or Terraform commands (e.g. !exec atmos terraform output
). :::wa...
(EG_NO_COMMA)
[uncategorized] ~42-~42: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...exec atmos terraform output` is just as examples to show that you can get the outputs of...
(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
[style] ~54-~54: The serial comma (Oxford comma, Harvard comma) is missing.
Context: ... If the result is a complex type (list, map or object), the script must return it as a...
(SERIAL_COMMA_ON)
[style] ~67-~67: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 1895 characters long)
Context: ... templates first, and then executes the !exec
function, allowing you to provide ...
(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
[typographical] ~129-~129: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using the printf "%s-%s-%s"
function, you are constructin...
(EN_QUOTES)
[style] ~160-~160: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2496 characters long)
Context: ... from the same stack. The YAML function !terraform.output
is executed three time...
(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/template.mdx
[style] ~65-~65: The phrase ‘in many cases’ is used quite frequently. Consider using a less frequent alternative to set your writing apart.
Context: ...ecode) function in your Terraform code. In many cases, this is not an acceptable solution bec...
(IN_MANY_STYLE_CASES)
[style] ~136-~136: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2804 characters long)
Context: ...nctions atmos.Component
, toJson
and !template
, use the [!terraform.output
](/core-concepts/stacks...
(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/components/terraform/remote-state.mdx
[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...on atmos.Component
function, refer to atmos.Component
. The !terraform.output
Atmos YAML f...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~361-~361: Please add a punctuation mark at the end of paragraph.
Context: ...n how to use 'atmos.Component' template function <PrimaryCTA to="/core-con...
(PUNCTUATION_PARAGRAPH_END)
website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...are denoted by the exclamation point ("!") symbol. Atmos detects the tags in ...
(EN_QUOTES)
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...e denoted by the exclamation point ("!") symbol. Atmos detects the tags in th...
(EN_QUOTES)
[style] ~28-~28: A comma is missing here.
Context: ...e ones expected to exist in any parser (e.g. floats, ints, strings, lists, maps). Ma...
(EG_NO_COMMA)
[style] ~39-~39: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ing-maps-or-lists) returned from the atmos.Component
template function - The [!exec
...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~39-~39: Please add a punctuation mark at the end of paragraph.
Context: ...tes/functions/atmos.Component) template function - The [!exec
](/core-concepts/st...
(PUNCTUATION_PARAGRAPH_END)
[style] ~44-~44: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 2141 characters long)
Context: ...ctions in Atmos stack manifests - The [!terraform.output
](/core-concepts/stac...
(EN_EXCESSIVE_EXCLAMATION)
🪛 golangci-lint (1.62.2)
internal/exec/yaml_func_template.go
21-21: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
internal/exec/yaml_func_exec.go
21-21: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
internal/exec/yaml_func_terraform_output.go
60-60: ineffectual assignment to outputProcessed
(ineffassign)
🔇 Additional comments (16)
examples/tests/stacks/catalog/terraform/template-functions-test/defaults.yaml (1)
10-12
: Configuration addition looks good
pkg/utils/map_utils.go (1)
37-46
: Function implementation looks solid
The MapOfInterfacesToMapOfStrings
function correctly converts map keys to strings, handling non-string keys by skipping them.
examples/quick-start-advanced/Dockerfile (2)
9-9
: Updating ATMOS_VERSION to future release is acceptable
Setting ATMOS_VERSION
to a future version aligns with team practices highlighted in previous learnings.
12-12
: Verify compatibility due to Terraform version downgrade
Downgrading Terraform from version 1.9.8
to 1.5.7
may affect module compatibility. Please ensure all configurations are compatible with the older version.
internal/exec/yaml_func_utils.go (1)
49-58
: Custom YAML tag processing is well-implemented
The functions for processing custom YAML tags correctly handle the specified tags.
pkg/utils/yaml_utils.go (1)
61-78
: Verify Recursive Processing of YAML Nodes
Ensure that processCustomTags
correctly handles all node types, including mappings, sequences, and scalars, to prevent unexpected behavior during YAML parsing.
website/package.json (1)
54-55
: Confirm Node.js Version Requirement
The engines
field specifies "node": ">=20.10"
. Verify that requiring Node.js version 20.10 or higher is intentional, as it may affect users on older versions.
pkg/config/const.go (1)
80-82
: Constants declaration looks good
The addition of the new constants for Atmos YAML functions is consistent with the existing naming conventions and enhances clarity in the code.
internal/exec/terraform_generate_varfiles.go (1)
273-277
: Custom YAML tag processing integrated correctly
The addition of ProcessCustomYamlTags
enhances functionality and is implemented appropriately.
internal/exec/terraform_generate_backends.go (1)
257-261
: Custom YAML tag processing added successfully
The incorporation of ProcessCustomYamlTags
improves the handling of custom YAML tags without introducing issues.
website/docs/core-concepts/stacks/templates/functions/atmos.Component.mdx (1)
Line range hint 123-183
: Clear explanation of handling complex outputs
The added sections provide a helpful guide on using complex outputs with atmos.Component
, including the use of toRawJson
, toJson
, and the !template
function.
internal/exec/validate_stacks.go (1)
93-93
: Robust handling of schema file paths
The updated logic correctly checks for the schema file's existence and handles downloads when necessary, enhancing reliability.
atmos.yaml (1)
18-18
: Appropriate update of base_path
Updating the base_path
to "./examples/quick-start-advanced"
aligns with the new directory structure.
website/docs/core-concepts/components/terraform/remote-state.mdx (1)
355-363
: Excellent addition of alternative methods
Introducing atmos.Component
and !terraform.output
functions provides valuable options for users.
🧰 Tools
🪛 LanguageTool
[grammar] ~361-~361: Please add a punctuation mark at the end of paragraph.
Context: ...n how to use 'atmos.Component' template function <PrimaryCTA to="/core-con...
(PUNCTUATION_PARAGRAPH_END)
internal/exec/utils.go (1)
512-515
: Custom YAML tags processing integrated smoothly
The addition of ProcessCustomYamlTags
and its error handling is well-implemented.
Also applies to: 517-518
website/docs/integrations/atlantis.mdx (1)
676-676
: ATMOS_VERSION update is appropriate
The version update to 1.111.0
on line 676 aligns with the latest release.
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
🧹 Outside diff range and nitpick comments (9)
website/docs/core-concepts/stacks/yaml-functions/template.mdx (2)
17-98
: Consider adding error handling examples.The examples effectively demonstrate successful cases. Consider adding examples of error scenarios and how to handle them, such as:
- What happens if the JSON parsing fails?
- How to handle null or undefined values?
🧰 Tools
🪛 LanguageTool
[style] ~65-~65: The phrase ‘in many cases’ is used quite frequently. Consider using a less frequent alternative to set your writing apart.
Context: ...ecode) function in your Terraform code. In many cases, this is not an acceptable solution bec...(IN_MANY_STYLE_CASES)
133-139
: Consider elevating this tip to a callout box.This is a crucial recommendation that could save users time and reduce complexity. Consider making it more prominent, perhaps as a callout box at the beginning of the document.
🧰 Tools
🪛 LanguageTool
[style] ~136-~136: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2804 characters long)
Context: ...nctionsatmos.Component
,toJson
and!template
, use the [!terraform.output
](/core-concepts/stacks...(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (1)
136-164
: Document cache invalidation behavior.While the caching mechanism is well explained, consider adding:
- Cache lifetime details
- Cache invalidation triggers
- Memory usage considerations
🧰 Tools
🪛 LanguageTool
[style] ~160-~160: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2496 characters long)
Context: ... from the same stack. The YAML function!terraform.output
is executed three time...(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/templates/functions/atmos.Component.mdx (2)
Line range hint
123-182
: Add troubleshooting section for common issues.The documentation effectively explains the concepts but would benefit from a troubleshooting section covering:
- Common parsing errors and their solutions
- Debugging tips for template processing
- Best practices for complex data structures
177-196
: Consider adding performance benchmarks.The caching explanation is clear, but would be more compelling with:
- Specific performance metrics
- Memory usage patterns
- Recommendations for optimal usage
examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml (1)
16-20
: Consider adding error handling for component outputsWhile the template function usage is correct, consider adding error handling for cases where outputs might not exist or have unexpected types.
- test_1: '{{ (atmos.Component "template-functions-test" .stack).outputs.test_label_id }}' + test_1: '{{ with $output := (atmos.Component "template-functions-test" .stack).outputs }}{{ if hasKey $output "test_label_id" }}{{ .test_label_id }}{{ else }}null{{ end }}{{ end }}'website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx (3)
26-33
: Enhance YAML type documentation with specific examplesThe explanation of YAML types is good, but would benefit from concrete examples of each type.
Consider adding:
# Core types example string_value: "hello" int_value: 42 list_value: [1, 2, 3] # User-defined type example !custom_type key: value🧰 Tools
🪛 LanguageTool
[style] ~28-~28: A comma is missing here.
Context: ...e ones expected to exist in any parser (e.g. floats, ints, strings, lists, maps). Ma...(EG_NO_COMMA)
47-52
: Add cautionary notes about template processing orderWhile the tip about template processing order is helpful, consider adding warnings about potential pitfalls when combining templates with YAML functions.
Add a warning section:
:::caution When combining templates with YAML functions, be aware that: - Template errors will prevent YAML function execution - Template variables must be properly escaped when used within YAML functions :::
56-91
: Enhance examples with expected outputsThe examples would be more helpful with comments showing expected outputs and potential error cases.
Add output examples:
# Example output: test_1: ["item1", "item2"] # Output from test_list test_2: {"key": "value"} # Output from test_map test_3: "42" # Direct string output
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (6)
atmos.yaml
(1 hunks)examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml
(1 hunks)website/docs/core-concepts/stacks/templates/functions/atmos.Component.mdx
(3 hunks)website/docs/core-concepts/stacks/yaml-functions/template.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
(1 hunks)website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- atmos.yaml
🧰 Additional context used
🪛 LanguageTool
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
[typographical] ~129-~129: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using the printf "%s-%s-%s"
function, you are constructin...
(EN_QUOTES)
[style] ~160-~160: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2496 characters long)
Context: ... from the same stack. The YAML function !terraform.output
is executed three time...
(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/template.mdx
[style] ~65-~65: The phrase ‘in many cases’ is used quite frequently. Consider using a less frequent alternative to set your writing apart.
Context: ...ecode) function in your Terraform code. In many cases, this is not an acceptable solution bec...
(IN_MANY_STYLE_CASES)
[style] ~136-~136: Using many exclamation marks might seem excessive (in this case: 7 exclamation marks for a text that’s 2804 characters long)
Context: ...nctions atmos.Component
, toJson
and !template
, use the [!terraform.output
](/core-concepts/stacks...
(EN_EXCESSIVE_EXCLAMATION)
website/docs/core-concepts/stacks/yaml-functions/yaml-functions.mdx
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...are denoted by the exclamation point ("!") symbol. Atmos detects the tags in ...
(EN_QUOTES)
[typographical] ~23-~23: Consider using a typographic close quote here.
Context: ...e denoted by the exclamation point ("!") symbol. Atmos detects the tags in th...
(EN_QUOTES)
[style] ~28-~28: A comma is missing here.
Context: ...e ones expected to exist in any parser (e.g. floats, ints, strings, lists, maps). Ma...
(EG_NO_COMMA)
[style] ~39-~39: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ing-maps-or-lists) returned from the atmos.Component
template function - The [!exec
...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~39-~39: Please add a punctuation mark at the end of paragraph.
Context: ...tes/functions/atmos.Component) template function - The [!exec
](/core-concepts/st...
(PUNCTUATION_PARAGRAPH_END)
[style] ~44-~44: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 2141 characters long)
Context: ...ctions in Atmos stack manifests - The [!terraform.output
](/core-concepts/stac...
(EN_EXCESSIVE_EXCLAMATION)
🔇 Additional comments (2)
website/docs/core-concepts/stacks/yaml-functions/template.mdx (1)
1-15
: LGTM! Clear and well-structured introduction.
The introduction effectively explains the purpose of the !template
function and its relationship with atmos.Component
.
examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml (1)
9-11
: Verify Spacelift workspace configuration impact
The disabled workspace setting might affect CI/CD pipelines. Please ensure this is the intended configuration for this environment.
✅ Verification successful
Spacelift workspace configuration is consistent with test environment patterns
The disabled workspace setting in this test configuration aligns with the observed patterns in the codebase:
- Most test and example components have
workspace_enabled: false
- Production/actual components typically have
workspace_enabled: true
- This file is in the
examples/tests/
directory, so disabling the workspace is the expected behavior
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other Spacelift workspace configurations to ensure consistency
rg -l 'workspace_enabled:' | xargs rg 'workspace_enabled:'
Length of output: 5858
examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml
Show resolved
Hide resolved
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 (4)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (4)
17-19
: Consider adding output type information to the usage section.The usage section would benefit from explicitly mentioning the supported output types (string, list, map) that can be retrieved using this function. This would help users understand what to expect when using the function.
!terraform.output <component> <stack> <output> + # Supports string, list, and map output types
129-129
: Fix quote formatting in the tip section.The printf example uses straight quotes instead of typographic quotes, which is inconsistent with the documentation style.
- By using the `printf "%s-%s-%s"` function, you are constructing stack names using the stack context variables/identifiers. + By using the `printf "%s-%s-%s"` function, you are constructing stack names using the stack context variables/identifiers.🧰 Tools
🪛 LanguageTool
[typographical] ~129-~129: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using theprintf "%s-%s-%s"
function, you are constructin...(EN_QUOTES)
138-142
: Add information about cache lifecycle.The caching explanation would benefit from clarifying when the cache is invalidated (e.g., between Atmos commands, after certain time periods, etc.). This helps users understand the caching behavior completely.
195-196
: Add a code example for the sensitive attribute.Consider adding a Terraform code example demonstrating how to use the
sensitive = true
attribute:output "sensitive_value" { value = aws_secretsmanager_secret.example.arn sensitive = true }
📜 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
🪛 LanguageTool
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx
[typographical] ~129-~129: Consider using a typographic opening quote here.
Context: ... ``` :::tip Important By using the printf "%s-%s-%s"
function, you are constructin...
(EN_QUOTES)
[style] ~168-~168: Using many exclamation marks might seem excessive (in this case: 8 exclamation marks for a text that’s 5180 characters long)
Context: ... Control Considerations When using the !terraform.output
function (and `terrafo...
(EN_EXCESSIVE_EXCLAMATION)
[grammar] ~176-~176: With the plural noun ‘logs’, the verb inflection ‘commands’ is not correct.
Context: ...**: Maintain detailed logs of Terraform commands executed, including terraform output
,...
(NNS_IN_NNP_VBZ)
🔇 Additional comments (1)
website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx (1)
166-191
: Excellent security considerations coverage!
The security considerations section comprehensively addresses crucial aspects of using the !terraform.output
function securely. The coverage of RBAC, audit logging, encryption, and state file handling provides valuable guidance for users.
🧰 Tools
🪛 LanguageTool
[style] ~168-~168: Using many exclamation marks might seem excessive (in this case: 8 exclamation marks for a text that’s 5180 characters long)
Context: ... Control Considerations When using the !terraform.output
function (and `terrafo...
(EN_EXCESSIVE_EXCLAMATION)
[grammar] ~176-~176: With the plural noun ‘logs’, the verb inflection ‘commands’ is not correct.
Context: ...**: Maintain detailed logs of Terraform commands executed, including terraform output
,...
(NNS_IN_NNP_VBZ)
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
!template
YAML function can be used to handle template outputs containing maps or lists returned from theatmos.Component
template functionThe
!exec
YAML function is used to execute shell scripts and assign the results to the sections in Atmos stack manifestsThe
!terraform.output
YAML 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.output
for enhanced stack manifest capabilities.Documentation Updates
atmos.Component
function and the new YAML functions.Dependency Updates