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

feat: Add boundary_group data source #503

Merged
merged 3 commits into from
Nov 2, 2023
Merged

Conversation

moduli
Copy link
Contributor

@moduli moduli commented Oct 26, 2023

This PR adds a boundary_group data source

data "boundary_group" "global_group" {
  name = "admin"
}

data "boundary_group" "org_group" {
  name     = "username"
  scope_id = data.boundary_scope.org.id
}
Test
resource "boundary_user" "user1" {
  name     = "user1"
  scope_id = "global"
}

resource "boundary_user" "user2" {
  name     = "user2"
  scope_id = "global"
}

resource "boundary_group" "group" {
  name       = "group"
  scope_id   = "global"
  member_ids = [boundary_user.user1.id, boundary_user.user2.id]
}

data "boundary_group" "group" {
  depends_on = [boundary_group.group]
  name       = "group"
}

output "group" {
  value = data.boundary_group.group
}


Outputs:

group = {
  "description" = ""
  "id" = "g_WlBSAYpsn3"
  "member_ids" = toset([
    "u_oPPhtdmDSu",
    "u_qDLvPFPCWS",
  ])
  "name" = "group"
  "scope" = tolist([
    {
      "description" = "Global Scope"
      "id" = "global"
      "name" = "global"
      "parent_scope_id" = ""
      "type" = "global"
    },
  ])
  "scope_id" = "global"
}

@moduli moduli force-pushed the moduli-datasource-group branch from c329ed1 to b3429cb Compare October 26, 2023 21:55
@moduli moduli marked this pull request as ready for review October 26, 2023 22:28
@moduli moduli requested review from elimt and louisruch October 26, 2023 22:28
@grantorchard
Copy link
Contributor

Excited for this one! Just had a need for a group datasource and decided to quickly check if someone had started work on it already 👍

Copy link
Contributor

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

A couple of minor comments but otherwise this LGTM

examples/data-sources/boundary_group/data-source.tf Outdated Show resolved Hide resolved
examples/data-sources/boundary_group/data-source.tf Outdated Show resolved Hide resolved
internal/provider/const.go Show resolved Hide resolved
@moduli moduli merged commit dc3adfa into main Nov 2, 2023
5 checks passed
@moduli moduli deleted the moduli-datasource-group branch November 2, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants