Skip to content

Commit

Permalink
CCL-1465: Change secret to variable and sensitive
Browse files Browse the repository at this point in the history
Signed-off-by: Babatunde Kassim <babatunde.kassim1@digital.homeoffice.gov.uk>
  • Loading branch information
babatundekassim-ho committed Dec 12, 2024
1 parent d31f535 commit 42db802
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
15 changes: 1 addition & 14 deletions alerts/webhook_alert_integration/alerts_profile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ resource "dynatrace_alerting" "cosmos-integration-alerting-profile" {
}
}

data "aws_caller_identity" "current" {}

data "aws_secretsmanager_secret" "snow_secret" {
arn = "arn:aws:secretsmanager:eu-west-2:${data.aws_caller_identity.current.account_id}:secret:test/snowIntegration-kP3kJ7"
}

data "aws_secretsmanager_secret_version" "current_secret" {
secret_id = data.aws_secretsmanager_secret.snow_secret.id
}

locals {
snow_client_secret = jsondecode(data.aws_secretsmanager_secret_version.current_secret.secret_string)
}
resource "dynatrace_webhook_notification" "snow_webhook_integration" {
active = var.active
name = var.integration_notification_name
Expand All @@ -60,6 +47,6 @@ resource "dynatrace_webhook_notification" "snow_webhook_integration" {
oauth_2_credentials {
access_token_url = var.access_token_url
client_id = var.client_id
client_secret = local.snow_client_secret["snow_client_secret"]
client_secret = var.client_secret
}
}
6 changes: 6 additions & 0 deletions alerts/webhook_alert_integration/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,10 @@ variable "client_id" {
variable "payload" {
type = string
description = "The content of the notification message"
}

variable "client_secret" {
type = string
description = "Client secret"
sensitive = true
}

0 comments on commit 42db802

Please sign in to comment.