Skip to content

Commit

Permalink
enable template_file.role only for when ldap enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 2, 2021
1 parent 5737bbc commit 639a5cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ resource "aws_iam_role_policy_attachment" "role" {
}

data "template_file" "role" {
count = local.enable_ldap ? 1 : 0
template = file("${path.module}/templates/iam-role-ldif.${local.account_environment}.tpl")
vars = {
role_name = aws_iam_role.role.name
Expand All @@ -124,7 +125,7 @@ resource "null_resource" "role_ldif" {
command = "test -d ${path.root}/setup || mkdir ${path.root}/setup"
}
provisioner "local-exec" {
command = "echo '${data.template_file.role.rendered}' > ${path.root}/setup/${aws_iam_role.role.name}.ldif"
command = "echo '${data.template_file.role[0].rendered}' > ${path.root}/setup/${aws_iam_role.role.name}.ldif"
}
provisioner "local-exec" {
command = "echo 'Once complete, execute tf-apply again to create LDAP group'"
Expand Down

0 comments on commit 639a5cd

Please sign in to comment.