Skip to content

Conversation

@Stevesibilia
Copy link
Contributor

@Stevesibilia Stevesibilia commented Oct 3, 2025

User description

… source logic for project creation and auto-detection


PR Type

Bug fix


Description

  • Fix parent group data source logic for project creation

  • Update condition from auto-detect only to broader scope

  • Ensure parent group data available when not at root level

  • Improve comment clarity for data source usage


Changes walkthrough 📝

Relevant files
Bug fix
main.tf
Fix parent group data source condition logic                         

main.tf

  • Updated condition for gitlab_group.parent_group data source from
    auto-detect only to include all non-root operations
  • Changed condition from local.auto_detect_parent to
    !var.operate_at_root_group_level && local.parent_group_path != ""
  • Improved comment to clarify data source is used for both project
    creation and auto-detect mode
  • +2/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • … source logic for project creation and auto-detection
    @sparkfabrik-ai-bot
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Logic Change

    The condition for creating the parent_group data source has changed from auto-detect mode only to a broader scope. This could potentially create the data source in scenarios where it wasn't needed before, which may impact performance or cause errors if the parent group path is invalid.

    count     = !var.operate_at_root_group_level && local.parent_group_path != "" ? 1 : 0
    Missing Validation

    The new condition checks if parent_group_path is not empty, but there's no validation that the path is actually valid or that the group exists. This could lead to runtime errors during terraform plan/apply.

    count     = !var.operate_at_root_group_level && local.parent_group_path != "" ? 1 : 0
    full_path = local.parent_group_path

    @sparkfabrik-ai-bot
    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Add path format validation

    The condition checks if parent_group_path is not empty, but doesn't validate if it's
    a valid path format. Consider adding validation to ensure the path doesn't contain
    invalid characters or formatting that could cause the GitLab API call to fail.

    main.tf [70]

    -count     = !var.operate_at_root_group_level && local.parent_group_path != "" ? 1 : 0
    +count     = !var.operate_at_root_group_level && local.parent_group_path != "" && can(regex("^[a-zA-Z0-9_.-]+(/[a-zA-Z0-9_.-]+)*$", local.parent_group_path)) ? 1 : 0
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion adds path validation which could improve robustness, but the regex pattern may be too restrictive for GitLab group paths and the validation logic makes the condition complex and harder to read.

    Low

    @Monska85 Monska85 changed the title refs sparkfabrik-innovation-team/board#3833: Update parent group data… refs platform/#3833: Update parent group data… Oct 3, 2025
    @Monska85 Monska85 merged commit 9b167b2 into main Oct 3, 2025
    1 check passed
    @Monska85 Monska85 deleted the platform/3833_fix_parent_group branch October 3, 2025 09:29
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants