terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
33 stars 31 forks source link

Foreman Usergroup with External Usergroup and Linked another Usergroup #96

Closed endersonmenezes closed 2 months ago

endersonmenezes commented 1 year ago

Hey guys!

First, thank you very much for reviving the project publicly, I am a Python developer and as we were in need of it in the company 2 months ago I started studying GO to try to develop a Foreman provider and now I just found your project.

I would like to know if the following use case makes sense to you, it is a use case that we use here at the company and I ended up developing the prototype to perform it with a provider, if it makes sense I can start a contribution to your project = ]

resource "foreman_group" "group_terraform_base" {

  name = "Test-From-Terraform-Base"
  admin = false

  users = [
    "internal_user_test_2",
    "internal_user_test_1"
  ]

  roles = [
    "Role1",
    "Role2"
  ]

  external_usergroups {
    name = "another-group-from-ad"
    auth_source_name = "npad_company_com_br"
  }

}

resource "foreman_group" "group_terraform_create" {

  name = "Test-From-Terraform-Using-Base"
  admin = false

  users = [
    "internal_user_test_1",
    "internal_user_test_2"
  ]

  roles = [
    "Role3"
  ]

  usergroups = [
    "Test-From-Terraform-Create-Base"
  ]

  external_usergroups {
    name = "group-from-ad-services"
    auth_source_name = "npad_company_com_br"
  }

}
lhw commented 1 year ago

Sorry for the slow response. My new company also uses GH and it just drowns out my personal issue trackers.


That maps to the usergroup api correct? https://apidocs.theforeman.org/foreman/latest/apidoc/v2/usergroups.html Yeah sure. If you want to contribute something like that I'm more than happy to review and merge that. I'm not that deep into the foreman ecosystem so I dont know if that usergroups field is self-referential which would make it interesting in terraform. But from what it looks like it would be a good first issue to work on.

endersonmenezes commented 1 year ago

It is an addon of usergroups, currently maps that part: https://apidocs.theforeman.org/foreman/latest/apidoc/v2/external_usergroups.html It is an extension of the usergroups API.

If you think it's cool I'll take advantage of Hacktoberfest and try to help with that too, following the development patterns that are here in the repository.