Skip to content

Commit 3c44ef6

Browse files
authored
[SVLS-7704] add support for SSM Parameter API key (#924)
## Overview * Add support for customers storing Datadog API Key in SSM Parameter Store. ## Testing * Deployed changes and confirmed this work with Parameter Store String and SecureString.
1 parent 2f2c69c commit 3c44ef6

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

env.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ pub struct EnvConfig {
357357
/// The AWS KMS API key to use for the Datadog Agent.
358358
#[serde(deserialize_with = "deserialize_optional_string")]
359359
pub kms_api_key: Option<String>,
360+
/// @env `DD_API_KEY_SSM_ARN`
361+
///
362+
/// The AWS Systems Manager Parameter Store parameter ARN containing the Datadog API key.
363+
#[serde(deserialize_with = "deserialize_optional_string")]
364+
pub api_key_ssm_arn: Option<String>,
360365
/// @env `DD_SERVERLESS_LOGS_ENABLED`
361366
///
362367
/// Enable logs for AWS Lambda. Default is `true`.
@@ -609,6 +614,7 @@ fn merge_config(config: &mut Config, env_config: &EnvConfig) {
609614
// AWS Lambda
610615
merge_string!(config, env_config, api_key_secret_arn);
611616
merge_string!(config, env_config, kms_api_key);
617+
merge_string!(config, env_config, api_key_ssm_arn);
612618
merge_option_to_value!(config, env_config, serverless_logs_enabled);
613619
merge_option_to_value!(config, env_config, serverless_flush_strategy);
614620
merge_option_to_value!(config, env_config, enhanced_metrics);
@@ -952,6 +958,7 @@ mod tests {
952958
api_key_secret_arn: "arn:aws:secretsmanager:region:account:secret:datadog-api-key"
953959
.to_string(),
954960
kms_api_key: "test-kms-key".to_string(),
961+
api_key_ssm_arn: String::default(),
955962
serverless_logs_enabled: false,
956963
serverless_flush_strategy: FlushStrategy::Periodically(PeriodicStrategy {
957964
interval: 60000,

mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ pub struct Config {
337337
// AWS Lambda
338338
pub api_key_secret_arn: String,
339339
pub kms_api_key: String,
340+
pub api_key_ssm_arn: String,
340341
pub serverless_logs_enabled: bool,
341342
pub serverless_flush_strategy: FlushStrategy,
342343
pub enhanced_metrics: bool,
@@ -440,6 +441,7 @@ impl Default for Config {
440441
// AWS Lambda
441442
api_key_secret_arn: String::default(),
442443
kms_api_key: String::default(),
444+
api_key_ssm_arn: String::default(),
443445
serverless_logs_enabled: true,
444446
serverless_flush_strategy: FlushStrategy::Default,
445447
enhanced_metrics: true,

yaml.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ api_security_sample_delay: 60 # Seconds
972972
api_key_secret_arn: "arn:aws:secretsmanager:region:account:secret:datadog-api-key"
973973
.to_string(),
974974
kms_api_key: "test-kms-key".to_string(),
975+
api_key_ssm_arn: String::default(),
975976
serverless_logs_enabled: false,
976977
serverless_flush_strategy: FlushStrategy::Periodically(PeriodicStrategy {
977978
interval: 60000,

0 commit comments

Comments
 (0)