Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 1, 2021
1 parent 8227376 commit c2c96ba
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions iam-saml/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ locals {
}
}

# this creates the directory if it doesn't exist

resource "null_resource" "saml_metadata" {
provisioner "local-exec" {
command = "test -d ${path.root}/setup || mkdir ${path.root}/setup"
Expand All @@ -62,6 +64,10 @@ resource "null_resource" "saml_metadata" {
## }
## }

# had to move this to an external resource. We need the contents of the metadata file, from a script
# to be availalbe to the provider *after* it runs. Could not seem to find some other way to read
# a non-existent file and do it at run-time.

data "external" "saml_metadata" {
program = ["bash", "${path.module}/bin/external_get-saml-metadata.sh"]
# output {object}.results.{output_file,status,value}
Expand All @@ -70,15 +76,11 @@ data "external" "saml_metadata" {
"output_file" = local.saml_metadata_file
# "url_prefix" = ""
}
# depends_on = [null_resource.saml_metadata]
}

resource "aws_iam_saml_provider" "saml" {
# count = fileexists(local.saml_metadata_file) ? 1 : 0
name = var.saml_provider_name
# saml_metadata_document = fileexists(local.saml_metadata_file) ? file(local.saml_metadata_file) : file("${path.module}/empty_metadata.xml")
name = var.saml_provider_name
saml_metadata_document = data.external.saml_metadata.result.value
# depends_on = [null_resource.saml_metadata]

# when the provider supports tags, enable this section
# tags = merge(
Expand Down

0 comments on commit c2c96ba

Please sign in to comment.