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_auth_method data source #505

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

moduli
Copy link
Contributor

@moduli moduli commented Oct 27, 2023

This PR adds a boundary_auth_method data source

data "boundary_auth_method" "auth_method" {
  name = "password_auth_method"
}

data "boundary_auth_method" "auth_method" {
  name     = "password_auth_method"
  scope_id = data.boundary_scope.org.id
}
Test
resource "boundary_auth_method_password" "ampw_org" {
  depends_on = [boundary_scope.org]
  name       = "test"
  type       = "password"
  scope_id   = boundary_scope.org.id
}

data "boundary_auth_method" "ampw_org" {
  depends_on = [boundary_auth_method_password.ampw_org]
  name       = "test"
  scope_id   = boundary_scope.org.id
}

output "test" {
  value = data.boundary_auth_method.ampw_org
}

Outputs:

authmethodpw = {
  "description" = ""
  "id" = "ampw_NMMfq7mf6B"
  "name" = "test"
  "scope" = tolist([
    {
      "description" = ""
      "id" = "o_59SPGMyVfV"
      "name" = "org"
      "parent_scope_id" = "global"
      "type" = "org"
    },
  ])
  "scope_id" = "o_59SPGMyVfV"
  "type" = "password"
}

@moduli moduli marked this pull request as ready for review October 27, 2023 17:45
@moduli moduli force-pushed the moduli-datasource-authmethod branch from 9cae503 to cb642c0 Compare November 2, 2023 19:42
@moduli moduli requested a review from louisruch November 3, 2023 15:26
@moduli moduli requested review from elimt and ddebko November 16, 2023 17:09
return nil
}

func setFromAuthMethodRead(d *schema.ResourceData, authMethod authmethods.AuthMethod) error {
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about reading the attributes field? Could be useful for LDAP & OIDC auth methods which shows the URLs, states, etc. The fields are different for each auth method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can take a look at it.

Copy link
Member

Choose a reason for hiding this comment

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

We can also do it in later enhancements

@psekar psekar added this to the 0.14.x milestone Nov 21, 2023
@psekar psekar modified the milestone: 0.14.x Dec 12, 2023
@psekar psekar merged commit 61c0ac9 into main Dec 12, 2023
@psekar psekar deleted the moduli-datasource-authmethod branch December 12, 2023 21:36
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.

4 participants