Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Created May 29, 2024 18:48
Show Gist options
  • Save ebuildy/70ef56c94b50f027c9a58e6a01fee0f6 to your computer and use it in GitHub Desktop.
Save ebuildy/70ef56c94b50f027c9a58e6a01fee0f6 to your computer and use it in GitHub Desktop.

Revisions

  1. ebuildy created this gist May 29, 2024.
    21 changes: 21 additions & 0 deletions main.tf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    locals {
    gitlab_groups_files = fileset(path.module, "../../../config/gitlab/*.yaml")
    gitlab_groups_flatten = [for f in local.gitlab_groups_files : yamldecode(file(f)).groups]
    gitlab_groups = ({
    for group in flatten(local.gitlab_groups_flatten) :
    group.path => {
    name : group.name,
    path : group.path,
    description : try(group.description, ""),
    projects : [for p in try(group.projects, []) : merge(p, group.project_defaults)]
    }
    })
    }

    module "gitlab_group" {
    for_each = local.gitlab_groups
    source = "../../modules/gitlab-group"

    group = each.value
    projects = try(each.value.projects, [])
    }