l-with / terraform-provider-ldap

7 stars 4 forks source link

Terraform import is not working #87

Closed sajildeh closed 20 hours ago

sajildeh commented 3 weeks ago

I'm trying to use this module on a pre existing ldap, and when I do import (sing terrafomr import module) it fail, it's working with me for version 0.7.0 but after that all the version fails to do the import. Can you please assist here?

cah-chethan-hn commented 2 weeks ago

I'm trying to use this module on a pre existing ldap, and when I do import (sing terrafomr import module) it fail, it's working with me for version 0.7.0 but after that all the version fails to do the import. Can you please assist here?

Can you please let me know how did you make it work for terraform import on 0.7.0 because when ever i tried terraform import am also getting error "Error: unexpected end of JSON input". If you could help me on import command which it worked for you earlier then it would be great. Command what i am trying is -terraform import 'module.create_ldapuser["testuser@example.com"].ldap_entry.user_example' 'uid=testuser'

sajildeh commented 2 weeks ago

I'm using the import module like this

import {
  to = ldap_entry.ldap_user["USER_CN"]
  id = "ENTRY_DN"
}
resource "ldap_entry" "ldap_user" {
  dn       = DN
  data_json = jsonencode({
    ....
  })
}

You can use the command by passing the cn and the entryDN

cah-chethan-hn commented 2 weeks ago

Actually, am using terraform version 1.1.17 so this import module feature is not supported . I tried upgrading my terraform version to 1.5+ but even after import module was not able to generate configuration file out when i execute below command .Not sure what is wrong with my config. terraform init terraform plan -generate-config-out=generated_resources.tf

sajildeh commented 2 days ago

This is the command you need to use to import: terraform import 'ldap_entry.ldap_user["USER_CN"]' ENTRY_DN

sajildeh commented 2 days ago

@pablo-ruth @barbaluc @barryib Any update on the import issue? Also I faced some other issues with my current module 0.7.0, when I imported and run apply the field for Multi OTP in DS was removed while it was under ignore. Can you please assist further

Regards, Saji

l-with commented 19 hours ago

should be fixed with version 0.10.0

l-with commented 5 hours ago

@pablo-ruth @barbaluc @barryib Any update on the import issue? Also I faced some other issues with my current module 0.7.0, when I imported and run apply the field for Multi OTP in DS was removed while it was under ignore. Can you please assist further

Regards, Saji

This should placed in another issue with a concrete example.