Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Feb 24, 2021
1 parent 29236ae commit 729698d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
12 changes: 5 additions & 7 deletions iam-saml/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ locals {
account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id
account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew"

saml_ew_url = "https://signin.aws.amazon.com/saml"
saml_gov_url = "https://signin.amazonaws-us-gov.com/saml"
saml_url = local.account_environment == "gov" ? local.saml_gov_url : local.saml_ew_url
saml_metadata_file = "${path.root}/setup/metadata.xml"
saml_metadata_file_exists = fileexists(local.saml_metadata_file)
saml_ew_url = "https://signin.aws.amazon.com/saml"
saml_gov_url = "https://signin.amazonaws-us-gov.com/saml"
saml_url = local.account_environment == "gov" ? local.saml_gov_url : local.saml_ew_url
saml_metadata_file = "${path.root}/setup/metadata.xml"

base_tags = {
"boc:tf_module_version" = local._module_version
Expand All @@ -63,9 +62,8 @@ resource "null_resource" "saml_metadata" {
}

resource "aws_iam_saml_provider" "saml" {
count = local.saml_metadata_file_exists ? 1 : 0
name = var.saml_provider_name
saml_metadata_document = local.saml_metadata_file_exists ? file(local.saml_metadata_file) : ""
saml_metadata_document = fileexists(local.saml_metadata_file_exists) ? file(local.saml_metadata_file) : ""
depends_on = [null_resource.saml_metadata]

# when the provider supports tags, enable this section
Expand Down
3 changes: 1 addition & 2 deletions iam-saml/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

output "saml_provider" {
description = "SAML Provider ARN"
value = aws_iam_saml_provider.saml[0].arn
value = aws_iam_saml_provider.saml.arn
}

output "saml_assume_policy" {
Expand Down
2 changes: 1 addition & 1 deletion iam-saml/policy_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data "aws_iam_policy_document" "saml_assume" {

principals {
type = "Federated"
identifiers = [aws_iam_saml_provider.saml[0].arn]
identifiers = [aws_iam_saml_provider.saml.arn]
}

condition {
Expand Down

0 comments on commit 729698d

Please sign in to comment.