-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # aws-inf-setup :: ldap-get-attribute | ||
|
|
||
| This allows for a simple LDAP search filter against, by default eDirectory ldap.tco.census.gov. | ||
| It returns an object with count, status, the attribute, the dn(s) and the attribute value(s). | ||
| DN and values are returned in a list. This is intended to search for only a single attribute, | ||
| which may be multi-value. It also returns the DN and CN. | ||
|
|
||
| For a query that returns multiple entries, where those entries do all not possess the same | ||
| attribute, the DN to attibute value will not match. That is, it returns only a list of | ||
| the attributes for the objects which have them in no particular order. | ||
|
|
||
| # Usage | ||
| Here is a simple example to get the email address of use `badra001`. | ||
|
|
||
| ```hcl | ||
| module "user_badra001" { | ||
| source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//ldap-get-attribute" | ||
| filter = "cn=badra001" | ||
| attribute = "mail" | ||
| # optional | ||
| # ldap_uri = "ldaps://ldap.tco.census.gov" | ||
| # ldap_base_dn = "o=U.S. Census Bureau,c=US" | ||
| # TBD | ||
| # ldap_user = | ||
| # ldap_pass = | ||
| } | ||
| ``` | ||
|
|
||
| # Sample Output | ||
| ```hcl | ||
| search_results = { | ||
| "attribute" = "mail" | ||
| "attribute_value" = [ | ||
| "donald.e.badrak.ii@census.gov", | ||
| ] | ||
| "count" = "1" | ||
| "dn" = [ | ||
| "cn=badra001,ou=People,o=U.S. Census Bureau,c=US", | ||
| ] | ||
| "cn" = [ | ||
| "badra001" | ||
| ] | ||
| "status" = "0" | ||
| } | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
||
| No requirements. | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_external"></a> [external](#provider\_external) | n/a | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [external_external.search](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/external) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_attribute"></a> [attribute](#input\_attribute) | LDAP attibute to return | `string` | `"dn"` | no | | ||
| | <a name="input_filter"></a> [filter](#input\_filter) | LDAP search filter | `string` | n/a | yes | | ||
| | <a name="input_ldap_base_dn"></a> [ldap\_base\_dn](#input\_ldap\_base\_dn) | LDAP base DN for search | `string` | `"o=U.S. Census Bureau,c=US"` | no | | ||
| | <a name="input_ldap_uri"></a> [ldap\_uri](#input\_ldap\_uri) | LDAP URI {scheme}://{hostname}:{port} | `string` | `"ldaps://ldap.tco.census.gov"` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_search_result"></a> [search\_result](#output\_search\_result) | n/a | |