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

fix: refreshing ldap group_type #434

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Edu-DevOps
Copy link

@Edu-DevOps Edu-DevOps commented Mar 20, 2024

This PR aims to read the ldap group_type from Nexus API since it is available in latest Nexus versions.
Issue: #392

I am trying to force the uppercase usage since the Nexus API returns the value in upper case.

Error sample if the group_type is set in lowercase

edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply
╷
│ Error: expected group_type to be one of ["DYNAMIC" "STATIC"], got dynamic
│ 
│   with nexus_security_ldap.server1,
│   on main.tf line 34, in resource "nexus_security_ldap" "server1":
│   34:   group_type                     = "dynamic"
│ 
╵

Successful sample if group_type is set in uppercase

edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource
actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # nexus_security_ldap.server1 will be created
  + resource "nexus_security_ldap" "server1" {
      + auth_password                  = (sensitive value)
      + auth_schema                    = "SIMPLE"
      + auth_username                  = "[email protected]"
      + connection_retry_delay_seconds = 300
      + connection_timeout_seconds     = 30
      + group_subtree                  = false
      + group_type                     = "DYNAMIC"
      + host                           = "169.254.169.254"
      + id                             = (known after apply)
      + ldap_groups_as_roles           = true
      + max_incident_count             = 3
      + name                           = "server1"
      + port                           = 389
      + protocol                       = "LDAP"
      + search_base                    = "dc=contoso,DC=com"
      + user_base_dn                   = "ou=DomainUsers"
      + user_email_address_attribute   = "userPrincipalName"
      + user_id_attribute              = "sAMAccountName"
      + user_member_of_attribute       = "memberOf"
      + user_object_class              = "user"
      + user_real_name_attribute       = "cn"
      + user_subtree                   = true
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

nexus_security_ldap.server1: Creating...
nexus_security_ldap.server1: Creation complete after 0s [id=server1]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply
nexus_security_ldap.server1: Refreshing state... [id=server1]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no
differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

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.

1 participant