Skip to content
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

Add support for atmos terraform providers commands #866

Merged
merged 6 commits into from
Dec 27, 2024
Merged

Add support for atmos terraform providers commands #866

merged 6 commits into from
Dec 27, 2024

Conversation

Listener430
Copy link
Collaborator

@Listener430 Listener430 commented Dec 18, 2024

what

  • Add support for atmos terraform providers commands
  • Fix panic executing atmos terraform providers lock <component> --stack <stack> command when a non existing component or stack were specified
  • Update atmos validate component <component> --stack <stack> command

why

  • Support the following commands:
    • atmos terraform providers lock <component> --stack<stack>
    • atmos terraform providers schema <component> --stack<stack> -- -json
    • atmos terraform providers mirror <component> --stack<stack> -- <directory>

atmos terraform providers lock vpc-flow-logs-bucket -s plat-ue2-staging

image


atmos terraform providers mirror vpc-flow-logs-bucket -s plat-ue2-staging -- ./tmp

image


  • Do not show help when executing atmos validate component <component> --stack <stack> command
atmos validate component vpc-flow-logs-bucket -s plat-ue2-stagin

image


references

Summary by CodeRabbit

  • New Features

    • Enhanced help messages for "terraform" and "helmfile" component types, providing detailed command descriptions and options.
    • Improved error handling and feedback for missing components and duplicates in stack manifests.
  • Bug Fixes

    • Resilience improvements against nil pointer dereferences in component configurations.
  • Chores

    • Updated various dependencies to their latest versions for improved compatibility and functionality.

@Listener430 Listener430 added the bugfix Change that restores intended behavior label Dec 18, 2024
@Listener430 Listener430 requested a review from aknysh December 18, 2024 15:02
@Listener430 Listener430 self-assigned this Dec 18, 2024
@Listener430 Listener430 requested a review from a team as a code owner December 18, 2024 15:02
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

📝 Walkthrough

Walkthrough

The changes in internal/exec/utils.go enhance the ProcessStacks function by introducing a safeguard against nil pointer dereferences. A new initialization for ComponentSection ensures it is an empty map if nil, preventing crashes. Error handling has been improved with clearer messages for missing components and duplicates. The processCommandLineArgs function has been updated for better readability and expanded to support new Terraform provider commands. The go.mod file reflects multiple dependency version updates for maintenance.

Changes

File Change Summary
internal/exec/utils.go - Added nil check for ComponentSection
- Improved error handling and messaging
- Updated processCommandLineArgs for new commands
go.mod - Updated multiple dependency versions, including AWS SDK, OpenTelemetry, and gRPC
internal/exec/help.go - Expanded help messages for "terraform" and included "helmfile" in help output

Assessment against linked issues

Objective Addressed Explanation
Resolve panic on atmos terraform providers lock [#794, DEV-2767]
Prevent nil map assignment

Possibly related PRs

Suggested reviewers

  • osterman
  • Gowiem

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f92bc7 and 3c03b05.

📒 Files selected for processing (2)
  • internal/exec/help.go (1 hunks)
  • internal/exec/utils.go (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/exec/utils.go
🔇 Additional comments (1)
internal/exec/help.go (1)

118-118: Looks good and nicely consolidates help logic.

By merging both component types into the same conditional branch, you reduce duplication of help statements. This is clear and consistent with the rest of the code.


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
internal/exec/utils.go (1)

322-322: Consider providing extra context in returned errors.

Returning the error as-is is perfectly fine for now, but adding more context can help with debugging in complex scenarios.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1defdce and 3771676.

📒 Files selected for processing (1)
  • internal/exec/utils.go (2 hunks)
🔇 Additional comments (1)
internal/exec/utils.go (1)

438-441: Great job preventing nil pointer issues here!

Initializing the map when it’s nil effectively prevents potential runtime panics and clarifies the intent of your error handling.

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 18, 2024
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

📝 Walkthrough

Walkthrough

The pull request addresses a critical issue in the internal/exec/utils.go file, specifically focusing on resolving a nil map assignment panic during stack processing. The changes enhance error handling and data integrity by ensuring that the ComponentSection is initialized when it's nil and modifying the ProcessStacks function to return an error. The modifications aim to prevent runtime panics and improve the robustness of stack and component metadata processing.

Changes

File Change Summary
internal/exec/utils.go - Updated ProcessStacks function signature to return (schema.ConfigAndStacksInfo, error)
- Added nil check and initialization for ComponentSection
- Improved error handling for component and stack processing

Assessment against linked issues

Objective Addressed Explanation
Resolve panic on atmos terraform providers lock [DEV-2767]

Possibly related issues

Suggested labels

patch

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
internal/exec/utils.go (1)

322-322: Consider error wrapping for better traceability
Although returning the error here is correct, consider adding more context to make debugging easier. Silently propagating the error can make it tougher to trace where it originated.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1defdce and 3771676.

📒 Files selected for processing (1)
  • internal/exec/utils.go (2 hunks)
🔇 Additional comments (1)
internal/exec/utils.go (1)

438-441: Great safeguard to avoid nil map panic
Initializing the component section ensures that subsequent operations are safe from nil pointer dereferences. This effectively prevents panics in corner cases.

@osterman osterman added the patch A minor, backward compatible change label Dec 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (16)
pkg/store/aws_ssm_param_store.go (2)

32-50: Recommended check for AWS session reuse.

The code properly loads AWS configuration and sets up an SSM client. Consider reusing or caching the session if performance across multiple calls becomes a concern.


53-75: Validate parameter value is not empty.

While it is correct to only handle string inputs, a quick check for blank or overly large values may help catch invalid usage.

pkg/store/store.go (1)

9-10: Clear extension point for store creation.

StoreFactory provides a flexible mechanism for injecting different store backends. Infuse helpful logging or metrics if needed.

pkg/store/config.go (1)

12-14: Surface mapstructure errors gracefully.

It might be helpful to wrap the error with more context about which config field is causing issues.

pkg/hooks/hooks.go (1)

18-28: Consider adding validation for hook events

The Hook structure looks solid, but consider adding validation to ensure that only valid event types from HookType constants are used in the Events slice.

 type Hook struct {
 	Events  []string `yaml:"events"`
 	Command string   `yaml:"command"`
 
 	// Dynamic command-specific properties
 
 	// store command
 	Name   string                 `yaml:"name,omitempty"`   // for store command
 	Values map[string]interface{} `yaml:"values,omitempty"` // for store command
+
+	// Consider adding:
+	// ValidateEvents() error
 }
pkg/store/registry.go (1)

7-36: Consider enhancing store type validation and error handling

The store registry implementation is solid, but could benefit from a few improvements:

  1. Consider using constants for store types instead of string literals
  2. Add validation for required fields in store configurations before processing
  3. Consider implementing a cleanup method for proper resource management
+// Store types
+const (
+    StoreTypeSSM      = "aws-ssm-parameter-store"
+    StoreTypeInMemory = "in-memory"
+)

 func NewStoreRegistry(config *StoresConfig) (StoreRegistry, error) {
     registry := make(StoreRegistry)
+    if config == nil {
+        return nil, fmt.Errorf("store config cannot be nil")
+    }
     for key, storeConfig := range *config {
+        if err := validateStoreConfig(storeConfig); err != nil {
+            return nil, fmt.Errorf("invalid store config for %s: %w", key, err)
+        }
         switch storeConfig.Type {
-        case "aws-ssm-parameter-store":
+        case StoreTypeSSM:
             // ... rest of the code
-        case "in-memory":
+        case StoreTypeInMemory:
             // ... rest of the code
pkg/store/in_memory_store.go (1)

22-28: Consider adding nil value validation in Set method

The Set method should validate the input parameters to prevent potential panics. This aligns with the PR's goal of panic prevention.

 func (m *InMemoryStore) Set(key string, value interface{}) error {
+	if key == "" {
+		return fmt.Errorf("key cannot be empty")
+	}
 	m.mu.Lock()
 	defer m.mu.Unlock()
 	m.data[key] = value
 	return nil
 }
internal/exec/yaml_func_store.go (1)

12-41: Strengthen error handling and remove unused parameter

The implementation looks solid, but there are a few improvements to consider:

  1. The currentStack parameter is unused
  2. Consider adding more context to error messages
-func processTagStore(cliConfig schema.CliConfiguration, input string, currentStack string) any {
+func processTagStore(cliConfig schema.CliConfiguration, input string) any {
 	log.Debug("Executing Atmos YAML function store", "input", input)

 	str, err := getStringAfterTag(input, u.AtmosYamlFuncStore)
 	if err != nil {
-		u.LogErrorAndExit(cliConfig, err)
+		u.LogErrorAndExit(cliConfig, fmt.Errorf("failed to process store tag: %w", err))
 	}
pkg/utils/yaml_utils.go (1)

11-17: Well structured constants, warrior! Consider adding documentation.

The constants are well-organized and improve maintainability. A brief comment for each constant explaining its purpose would make it even better.

Consider adding specific documentation for each constant:

 const (
 	// Atmos YAML functions
-	AtmosYamlFuncExec            = "!exec"
-	AtmosYamlFuncStore           = "!store"
-	AtmosYamlFuncTemplate        = "!template"
-	AtmosYamlFuncTerraformOutput = "!terraform.output"
+	// AtmosYamlFuncExec executes shell commands
+	AtmosYamlFuncExec            = "!exec"
+	// AtmosYamlFuncStore manages store operations
+	AtmosYamlFuncStore           = "!store"
+	// AtmosYamlFuncTemplate processes template strings
+	AtmosYamlFuncTemplate        = "!template"
+	// AtmosYamlFuncTerraformOutput retrieves terraform outputs
+	AtmosYamlFuncTerraformOutput = "!terraform.output"
 )
pkg/store/in_memory_store_test.go (3)

8-16: Strong test for store creation, warrior!

The test effectively verifies store initialization. Consider adding a test case for configuration validation.

Consider adding a test case with invalid configuration:

func TestNewMemoryStoreWithInvalidConfig(t *testing.T) {
    invalidConfig := map[string]interface{}{
        "invalid": "config",
    }
    store, err := NewInMemoryStore(invalidConfig)
    if err == nil {
        t.Error("NewMemoryStore() expected error with invalid config")
    }
}

18-64: Well-structured test cases for Set operations!

The table-driven tests cover various data types effectively. Consider adding error cases and concurrent access tests.

Consider adding:

  1. Test case for nil value
  2. Concurrent access test to verify thread safety
func TestMemoryStoreConcurrentAccess(t *testing.T) {
    store := &InMemoryStore{
        data: make(map[string]interface{}),
    }
    const goroutines = 10
    var wg sync.WaitGroup
    wg.Add(goroutines)
    
    for i := 0; i < goroutines; i++ {
        go func(id int) {
            defer wg.Done()
            key := fmt.Sprintf("key-%d", id)
            err := store.Set(key, id)
            if err != nil {
                t.Errorf("Concurrent Set() error = %v", err)
            }
        }(i)
    }
    wg.Wait()
}

66-108: Solid test coverage for Get operations!

The tests handle both existing and non-existing keys well. Consider adding type assertion tests.

Consider adding test cases for type assertions:

{
    name:      "type assertion",
    key:       "number-key",
    value:     42,
    want:      42,
    wantError: false,
},
internal/exec/yaml_func_terraform_output.go (1)

Line range hint 52-63: Effective caching mechanism!

The cache implementation using sync.Map is thread-safe and prevents redundant terraform output calls.

Consider implementing a cache expiration mechanism for long-running processes to prevent stale data.

pkg/store/aws_ssm_param_store_test.go (2)

36-93: Consider adding more edge cases to strengthen test coverage.

The current test cases cover the basic scenarios well. Consider adding tests for:

  • Empty key/value
  • Very long parameter values (AWS SSM has size limits)
  • Special characters in parameter names

95-148: Add test cases for common SSM parameter retrieval scenarios.

Consider adding test cases for:

  • Parameter not found
  • Parameter with different types (String, StringList, SecureString)
  • Decryption failures for SecureString parameters
pkg/config/utils.go (1)

491-502: Clean implementation of store configuration processing!

The function is well-structured and handles errors appropriately. Consider enhancing the error context for better debugging.

Consider wrapping the error with additional context:

 func processStoreConfig(cliConfig *schema.CliConfiguration) error {
     log.Debug("processStoreConfig", "cliConfig.StoresConfig", fmt.Sprintf("%v", cliConfig.StoresConfig))
 
     storeRegistry, err := store.NewStoreRegistry(&cliConfig.StoresConfig)
     if err != nil {
-        return err
+        return fmt.Errorf("failed to create store registry: %w", err)
     }
     cliConfig.Stores = storeRegistry
 
     return nil
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c78ab33 and b75be94.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (18)
  • go.mod (4 hunks)
  • internal/exec/yaml_func_exec.go (1 hunks)
  • internal/exec/yaml_func_store.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 (2 hunks)
  • pkg/config/config.go (1 hunks)
  • pkg/config/utils.go (2 hunks)
  • pkg/hooks/hooks.go (1 hunks)
  • pkg/schema/schema.go (3 hunks)
  • pkg/store/aws_ssm_param_store.go (1 hunks)
  • pkg/store/aws_ssm_param_store_test.go (1 hunks)
  • pkg/store/config.go (1 hunks)
  • pkg/store/in_memory_store.go (1 hunks)
  • pkg/store/in_memory_store_test.go (1 hunks)
  • pkg/store/registry.go (1 hunks)
  • pkg/store/store.go (1 hunks)
  • pkg/utils/yaml_utils.go (1 hunks)
🧰 Additional context used
📓 Learnings (1)
internal/exec/yaml_func_terraform_output.go (1)
Learnt from: aknysh
PR: cloudposse/atmos#863
File: internal/exec/yaml_func_terraform_output.go:34-38
Timestamp: 2024-12-17T07:08:41.288Z
Learning: In the `processTagTerraformOutput` function within `internal/exec/yaml_func_terraform_output.go`, parameters are separated by spaces and do not contain spaces. Therefore, using `strings.Fields()` for parsing is acceptable, and there's no need to handle parameters with spaces.
🪛 golangci-lint (1.62.2)
pkg/store/aws_ssm_param_store.go

1-1: : # github.com/cloudposse/atmos/pkg/store [github.com/cloudposse/atmos/pkg/store.test]
pkg/store/aws_ssm_param_store_test.go:53:17: cannot use true (untyped bool constant) as *bool value in struct literal
pkg/store/aws_ssm_param_store_test.go:109:22: cannot use true (untyped bool constant) as *bool value in struct literal

(typecheck)

🔇 Additional comments (16)
pkg/store/store.go (1)

3-8: Interface design looks solid.

The Store interface is succinct, matching general usage patterns. Encourage thorough validation or type checks within implementations.

pkg/store/config.go (1)

5-8: All good here.

The StoreConfig structure is straightforward and can handle typical store config.

internal/exec/yaml_func_template.go (1)

19-19: Validate input content.

Ensure the string retrieved by getStringAfterTag is not empty or malformed before unmarshalling. It prevents potential decoding of incomplete JSON.

internal/exec/yaml_func_exec.go (1)

19-19: Verify the impact of removing cliConfig parameter

The removal of cliConfig from getStringAfterTag call appears to be part of a broader refactoring. While this change simplifies the API, we should ensure it doesn't affect error handling or logging capabilities.

pkg/hooks/hooks.go (1)

30-32: LGTM! Clean and straightforward hooks registry

The Hooks structure provides a clean way to manage multiple hooks. The map implementation allows for efficient lookup by name.

pkg/store/in_memory_store.go (1)

8-12: LGTM! Thread-safe implementation with RWMutex

The InMemoryStore implementation properly uses sync.RWMutex for concurrent access protection. This is a solid foundation for preventing race conditions.

internal/exec/yaml_func_store.go (1)

29-38: Consider adding store type validation

The store retrieval and key lookup are properly implemented, but we might want to add type validation for the returned value to prevent potential panics in the calling code.

internal/exec/yaml_func_utils.go (1)

63-75: LGTM! Clean switch statement implementation

The switch statement improves readability and maintainability. The default case properly handles unsupported YAML types, preventing potential panics.

pkg/utils/yaml_utils.go (1)

21-24: Strong move using constants in AtmosYamlTags!

The update to use constants instead of string literals enhances maintainability and reduces potential typos.

internal/exec/yaml_func_terraform_output.go (2)

24-27: Robust error handling for tag processing!

The error handling ensures proper validation of the tag format, preventing panics.


Line range hint 35-44: Strong parameter validation and stack handling!

The code properly handles both 2 and 3 parameter cases, with clear logging when using the current stack.

Let's verify the parameter handling:

✅ Verification successful

Let me verify the parameter handling further by checking how the code processes these parameters.


Parameter validation is robust and well-implemented!

The code demonstrates strong parameter validation with proper error handling:

  • Validates both 2 and 3 parameter cases correctly
  • Provides clear error messages for invalid parameter counts
  • Implements thread-safe caching using sync.Map
  • Handles both static remote state and terraform output scenarios
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potential parameter parsing edge cases
rg -l "!terraform\.output\s+\S+\s+\S+\s+\S+" | while read -r file; do
    echo "Checking $file for terraform.output usage:"
    rg "!terraform\.output\s+\S+\s+\S+\s+\S+" "$file"
done

Length of output: 3675


Script:

#!/bin/bash
# Check the implementation of terraform.output function
ast-grep --pattern 'func terraformOutput($$$) $$$'

# Check for error handling and validation
rg "terraformOutput" -A 10 -B 10

Length of output: 9314

pkg/store/aws_ssm_param_store_test.go (1)

15-34: Well-structured mock implementation!

The mock implementation follows best practices:

  • Proper error handling for nil returns
  • Consistent method signatures matching the AWS SDK
  • Clean use of testify/mock for assertions
pkg/config/config.go (1)

249-253: LGTM! Verify store configuration error handling.

The addition of store configuration processing is clean and follows existing patterns. Let's verify the error handling in processStoreConfig.

✅ Verification successful

Error handling in processStoreConfig looks solid!

The function properly handles errors from store.NewStoreRegistry and returns them to the caller. The implementation follows a clean pattern:

  • Initializes store registry with config
  • Returns any initialization errors
  • Sets the registry in config when successful
  • Returns nil on success
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for error handling patterns in processStoreConfig
ast-grep --pattern 'func processStoreConfig($config) $_ {
  $$$
  if err != nil {
    $$$
  }
  $$$
}'

Length of output: 104


Script:

#!/bin/bash
# Let's try a different approach to find processStoreConfig implementation
rg -U "func processStoreConfig" -A 10

Length of output: 583

pkg/schema/schema.go (3)

3-3: Well-structured store configuration implementation!

The separation between StoresConfig for configuration and Stores for the registry instance is clean and well-documented. The YAML/JSON tags are properly configured, and the documentation clearly explains the purpose of the Stores field.

Also applies to: 20-20, 34-37


204-204: LGTM: ComponentHooksSection follows established patterns

The addition of ComponentHooksSection maintains consistency with other component sections in the struct.


488-488: LGTM: BaseComponentHooks maintains structural consistency

The addition of BaseComponentHooks aligns with the existing base component configuration pattern.

pkg/store/aws_ssm_param_store.go Outdated Show resolved Hide resolved
internal/exec/yaml_func_utils.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@osterman
Copy link
Member

@Listener430 looks like a bad merge. Can no longer see you contributions to this PR.

@osterman osterman added the conflict This PR has conflicts label Dec 18, 2024
Copy link

mergify bot commented Dec 18, 2024

💥 This pull request now has conflicts. Could you fix it @Listener430? 🙏

@mergify mergify bot removed the conflict This PR has conflicts label Dec 19, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 19, 2024
@Listener430
Copy link
Collaborator Author

@Listener430 looks like a bad merge. Can no longer see you contributions to this PR.

@osterman thanks, my bad, fixed the bad mergre is that ok now?

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 27, 2024
@aknysh aknysh added minor New features that do not break anything and removed patch A minor, backward compatible change bugfix Change that restores intended behavior labels Dec 27, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 27, 2024
@aknysh aknysh changed the title Fix panic on atmos terraform providers lock Support atmos terraform providers commands Dec 27, 2024
@aknysh aknysh changed the title Support atmos terraform providers commands Add support atmos terraform providers commands Dec 27, 2024
@aknysh aknysh merged commit 1aa75c6 into main Dec 27, 2024
44 checks passed
@aknysh aknysh deleted the DEV-2767 branch December 27, 2024 04:39
@aknysh aknysh changed the title Add support atmos terraform providers commands Add support for atmos terraform providers commands Dec 27, 2024
Copy link

These changes were released in v1.132.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants