### Creating an LDAP OU Resource with Terraform (HCL) Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/resources/ou.md This HCL snippet demonstrates how to define an `ldap_ou` resource in Terraform. It specifies the `name` of the OU, the parent `ou` where it will be created, and an optional `description`. This resource manages the lifecycle of an LDAP Organizational Unit within a directory. ```HCL resource "ldap_ou" "ou" { name = "MyOU" ou = "OU=MyCompany,DC=domain,DC=tld" description = "My OU description" } ``` -------------------------------- ### Importing an Existing LDAP OU into Terraform (Shell) Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/resources/ou.md This shell command illustrates how to import an existing LDAP Organizational Unit into Terraform state. It uses the `terraform import` command, specifying the target resource address (`ldap_ou.example`) and the full LDAP Distinguished Name (DN) of the OU to be imported. This allows Terraform to manage resources that were created outside of its configuration. ```Shell $ terraform import ldap_ou.example OU=Myou,OU=MyCompany,DC=domain,DC=tld ``` -------------------------------- ### Creating an LDAP Group with Terraform HCL Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/resources/group.md This HCL snippet demonstrates how to define an `ldap_group` resource in Terraform. It configures a new LDAP group named 'MyGroup' within a specified Organizational Unit (OU), assigns a member, and provides a description. This resource requires the `ou` and `name` arguments for creation. ```hcl resource "ldap_group" "group" { ou = "OU=MyOU,DC=domain,DC=tld" name = "MyGroup" members = ["CN=MyUser,OU=MyOU,DC=domain,DC=tld"] description = "My group description" } ``` -------------------------------- ### Retrieving an LDAP OU with Terraform `ldap_ou` Data Source (HCL) Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/data-sources/ou.md This HCL snippet demonstrates how to use the `ldap_ou` data source in Terraform to retrieve an existing LDAP Organizational Unit. It specifies the `ou` (distinguished name of the parent OU), `name` (the name of the OU to search for), and an optional `scope` (search depth) to locate the desired OU. The data source allows referencing the OU's attributes elsewhere in the configuration. ```HCL data "ldap_ou" "ou" { ou = "OU=MyCompany,DC=domain,DC=tld" name = "MyOU" scope = 2 } ``` -------------------------------- ### Importing an Existing LDAP Group with Terraform CLI Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/resources/group.md This command line snippet illustrates how to import an existing LDAP group into Terraform state using the `terraform import` command. The command requires the resource address (e.g., `ldap_group.example`) and the full LDAP Distinguished Name (DN) of the group to be imported, enabling Terraform to manage it. ```shell $ terraform import ldap_group.example CN=MyGroup,OU=MyOU,DC=domain,DC=tld ``` -------------------------------- ### Configuring the LDAP Provider in Terraform Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/index.md This snippet demonstrates how to configure the LDAP provider within a Terraform project. It specifies the provider source and defines connection parameters such as host, port, bind user, and bind password for connecting to an Active Directory server. These parameters are essential for establishing a secure and authenticated LDAP connection. ```HCL # Provider configuration terraform { required_providers { ldap = { source = "Ouest-France/ldap" } } } provider "ldap" { host = "ldap.mycompany.tld" port = 389 bind_user = "ldap_user" bind_password = "ldap_password" } ``` -------------------------------- ### Querying an LDAP Group using Terraform HCL Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/data-sources/group.md This HCL snippet demonstrates how to query an existing LDAP group using the `ldap_group` data source. It requires specifying the Organizational Unit (OU) where the group is located and the exact name of the group. The data source will return attributes like `id`, `description`, and `members` of the found group. ```HCL data "ldap_group" "group" { ou = "OU=MyOU,DC=domain,DC=tld" name = "MyGroup" } ``` -------------------------------- ### Retrieving an LDAP User with Terraform Source: https://github.com/ouest-france/terraform-provider-ldap/blob/master/docs/data-sources/user.md This HCL snippet demonstrates how to use the `ldap_user` data source in Terraform to retrieve an LDAP user. It requires specifying the Organizational Unit (OU) where the user will be searched and the user's name. The retrieved user's attributes can then be referenced elsewhere in the configuration. ```HCL data "ldap_user" "user" { ou = "OU=MyOU,DC=domain,DC=tld" name = "MyUser" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.