You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Serverless Framework Plugin support for AWS SSM API Key (#653)
* Add Serverless Framework Plugin support for AWS SSM API Key
* update checkForMultipleApiKeys
* update log
* update tests
* Update index.ts to list check
Co-authored-by: Ava Silver <ava.silver@datadoghq.com>
* lint format
---------
Co-authored-by: Ava Silver <ava.silver@datadoghq.com>
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,8 @@ To further configure your plugin, use the following custom parameters in your `s
30
30
|`site`| Set which Datadog site to send data to, such as `datadoghq.com` (default), `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, or `ddog-gov.com`. This parameter is required when collecting telemetry using the Datadog Lambda Extension. |
31
31
|`apiKey`|[Datadog API key][7]. This parameter is required when collecting telemetry using the Datadog Lambda Extension. Alternatively, you can also set the `DATADOG_API_KEY` environment variable in your deployment environment. |
32
32
|`appKey`| Datadog app key. Only needed when the `monitors` field is defined. Alternatively, you can also set the `DATADOG_APP_KEY` environment variable in your deployment environment. |
33
-
|`apiKeySecretArn`| An alternative to using the `apiKey` field. The ARN of the secret that is storing the Datadog API key in AWS Secrets Manager. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
33
+
|`apiKeySecretArn`| An alternative to using the `apiKey` field. The ARN of the secret that is storing the Datadog API key in AWS Secrets Manager. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
34
+
|`apiKeySsmArn`| An alternative to using the `apiKey` field. The ARN of the parameter that is storing the Datadog API key in AWS Systems Manager Parameter Store. Remember to add the `ssm:GetParameter` and `kms:Decrypt` (for encrypted SecureString parameters) permission to the Lambda execution role. |
34
35
|`apiKMSKey`| An alternative to using the `apiKey` field. Datadog API key encrypted using KMS. Remember to add the `kms:Decrypt` permission to the Lambda execution role. |
35
36
|`env`| When set along with `addExtension`, a `DD_ENV` environment variable is added to all Lambda functions with the provided value. Otherwise, an `env` tag is added to all Lambda functions with the provided value. Defaults to the `stage` value of the serverless deployment. |
36
37
| `service` | When set along with `addExtension`, a `DD_SERVICE` environment variable is added to all Lambda functions with the provided value. Otherwise, a `service` tag is added to all Lambda functions with the provided value. Defaults to the `service` value of the serverless project.
@@ -77,7 +78,7 @@ To use any of these parameters, add a `custom` > `datadog` section to your `serv
77
78
```yaml
78
79
custom:
79
80
datadog:
80
-
apiKeySecretArn: "{Datadog_API_Key_Secret_ARN}"
81
+
apiKeySecretArn: "{Datadog_API_Key_Secret_ARN}"# or use apiKeySsmArn for AWS Systems Manager Parameter Store
"apiKeySecretArn` is not supported for Node runtimes when using Synchronous Metrics. Set DATADOG_API_KEY in your environment, or use `apiKmsKey` in the configuration.",
1276
1281
);
1277
1282
});
1283
+
1284
+
it("successfully sets DD_API_KEY_SSM_ARN for Node runtime with sync metrics",()=>{
"The environment variable `DATADOG_API_KEY` or configuration variable `apiKMSKey` or `apiKeySecretArn` must be set because `addExtension` is set to true as default.",
889
+
"The environment variable `DATADOG_API_KEY` or configuration variable `apiKMSKey` or `apiKeySecretArn` or `apiKeySsmArn` must be set because `addExtension` is set to true as default.",
Copy file name to clipboardExpand all lines: src/index.ts
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -634,10 +634,11 @@ function validateConfiguration(config: Configuration): void {
634
634
config.apiKey===undefined&&
635
635
process.env.DATADOG_API_KEY===undefined&&
636
636
config.apiKMSKey===undefined&&
637
-
config.apiKeySecretArn===undefined
637
+
config.apiKeySecretArn===undefined&&
638
+
config.apiKeySsmArn===undefined
638
639
){
639
640
thrownewError(
640
-
"The environment variable `DATADOG_API_KEY` or configuration variable `apiKMSKey` or `apiKeySecretArn` must be set because `addExtension` is set to true as default.",
641
+
"The environment variable `DATADOG_API_KEY` or configuration variable `apiKMSKey` or `apiKeySecretArn` or `apiKeySsmArn` must be set because `addExtension` is set to true as default.",
641
642
);
642
643
}
643
644
}
@@ -656,18 +657,19 @@ function validateConfiguration(config: Configuration): void {
0 commit comments