Skip to content

Commit

Permalink
add attruibutes
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jun 1, 2022
1 parent c2558e3 commit 1c7dcdf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,6 @@
- iam-saml
- add tags

* 2.0.4 -- 2022-06-01
- ldap-ou-create
- add attributes
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "2.0.3"
_module_version = "2.0.4"
}
11 changes: 9 additions & 2 deletions ldap-ou-create/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ locals {
account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id
region = data.aws_region.current.name
account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew"
account_alias = var.account_alias != "" && var.account_alias != null ? var.account_alias : "none"

ldif_file = format("%v/setup/ou.%v.ldif", path.root, local.account_id)
ldap_exists = fileexists(local.ldif_file)
Expand All @@ -49,8 +50,11 @@ locals {
data "template_file" "ou" {
template = file("${path.module}/templates/ou-ldif.tpl")
vars = {
account_id = local.account_id
aws_environment = local.account_environment
account_id = local.account_id
aws_environment = local.account_environment
account_alias = local.account_alias
tf_module_name = "aws-vpc-setup/ldap-ou-create"
tf_module_version = local._module_version
}
}

Expand Down Expand Up @@ -81,6 +85,9 @@ resource "ldap_object" "ou" {
attributes = [
{ description = format("account=%s type=%s", local.account_id, local.account_environment) },
{ ou = local.account_id },
{ bocApplicationData = format("gov.census.csvd:account_alias=%v", local.account_alias) },
{ bocApplicationData = format("gov.census.csvd:tf_module_name=%v", "aws-inf-setup/ldap-ou-create") },
{ bocApplicationData = format("gov.census.csvd:tf_module_version=%v", local._module_version) },
]

lifecycle {
Expand Down
5 changes: 4 additions & 1 deletion ldap-ou-create/templates/ou-ldif.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# ${account_id}, AWS, Cloud, Application, U.S. Census Bureau, US
dn: ou=${account_id},ou=AWS,ou=Cloud,ou=Application,o=U.S. Census Bureau,c=US
ou: ${account_id}
description: account=${account_id} type=${aws_environment}
description: account=${account_id} type=${aws_environment} alias=${account_alias}
bocApplicationData: gov.census.csvd:account_alias=${account_alias}
bocApplicationData: gov.census.csvd:tf_module_name=${tf_module_name}
bocApplicationData: gov.census.csvd:tf_module_version=${tf_module_version}
objectClass: organizationalUnit
objectClass: ndsLoginProperties
objectClass: ndsContainerLoginProperties
Expand Down

0 comments on commit 1c7dcdf

Please sign in to comment.