Skip to content

Commit

Permalink
fix: we have to fallen back to the variable if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
gambol99 committed Apr 27, 2024
1 parent a15c328 commit 712bb31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ locals {
## Indicates if we are looking up the slack secret
enable_slack_secret = local.enable_slack && try(var.slack.secret_name, null) != null ? true : false
## The webhook url for slack
slack_webhook_url = local.enable_slack_secret ? jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["webhook_url"] : try(var.slack.webhook_url, null)
slack_webhook_url = local.enable_slack_secret ? try(jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["webhook_url"], var.slack.webhook_url) : try(var.slack.webhook_url, null)
## The slack channel to post to
slack_channel = local.enable_slack_secret ? jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["channel"] : try(var.slack.channel, null)
slack_channel = local.enable_slack_secret ? try(jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["channel"], var.slack.channel) : try(var.slack.channel, null)
## slack_username to use
slack_username = local.enable_slack_secret ? jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["username"] : try(var.slack.username, null)
slack_username = local.enable_slack_secret ? try(jsondecode(data.aws_secretsmanager_secret_version.slack[0].secret_string)["username"], var.slack.username) : try(var.slack.username, null)
}

0 comments on commit 712bb31

Please sign in to comment.