Skip to content

Commit

Permalink
Merge pull request #134 from ExpediaGroup/feature/ecs_fix
Browse files Browse the repository at this point in the history
Feature/ecs fix
  • Loading branch information
githubjianli authored Jan 5, 2024
2 parents f1cfed4 + dbde6f7 commit 7cba3e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.2.2] - 2024-01-05
### Fixed
- Conditional reading of Secrets from SecretManager fix.

## [4.2.1] - 2024-01-05
### Added
- Added ECR permission to ECS tasks IAM role to support using ECR images.
Expand Down
15 changes: 9 additions & 6 deletions common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ data "aws_iam_policy_document" "waggle_dance_glue_policy" {
}
}


data "aws_secretsmanager_secret" "datadog_key" {
count = length(var.datadog_key_secret_name) == 0 ? 0 : 1
name = var.datadog_key_secret_name
}

data "aws_secretsmanager_secret_version" "datadog_key" {
count = length(var.datadog_key_secret_name) == 0 ? 0 : 1
secret_id = data.aws_secretsmanager_secret.datadog_key[0].id
count = length(data.aws_secretsmanager_secret.datadog_key) > 0 ? 1 : 0
secret_id = data.aws_secretsmanager_secret.datadog_key.id
}

provider "datadog" {
api_key = length(data.aws_secretsmanager_secret_version.datadog_key) > 0 ? jsondecode(data.aws_secretsmanager_secret_version.datadog_key[0].secret_string).api_key : ""
app_key = length(data.aws_secretsmanager_secret_version.datadog_key) > 0 ? jsondecode(data.aws_secretsmanager_secret_version.datadog_key[0].secret_string).app_key : ""
locals {
datadog_keys = jsondecode(data.aws_secretsmanager_secret_version.datadog_key[0].secret_string)
}

provider "datadog" {
api_key = local.datadog_keys.api_key != null ? local.datadog_keys.api_key : ""
app_key = local.datadog_keys.app_key != null ? local.datadog_keys.app_key : ""
}

0 comments on commit 7cba3e9

Please sign in to comment.