Skip to content

Commit 389b911

Browse files
authored
feat(docs): update Terraform docs for deploying the AWS forwarder to use new module (#1003)
Signed-off-by: Katie McKew <katie.mckew@datadoghq.com>
1 parent f55466b commit 389b911

File tree

1 file changed

+33
-46
lines changed

1 file changed

+33
-46
lines changed

aws/logs_monitoring/README.md

Lines changed: 33 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,60 +53,30 @@ If you had previously enabled your AWS Integration using the [following CloudFor
5353

5454
### Terraform
5555

56-
Install the Forwarder using the Terraform resource [`aws_cloudformation_stack`][101] as a wrapper on top of the provided CloudFormation template.
57-
58-
Datadog recommends creating separate Terraform configurations:
59-
60-
- Use the first one to store the [Datadog API key][102] in the AWS Secrets Manager, and note down the secrets ARN from the output of apply.
61-
- Then, create a configuration for the forwarder and supply the secrets ARN through the `DdApiKeySecretArn` parameter.
62-
- Finally, create a configuration to [set up triggers on the Forwarder][103].
63-
64-
By separating the configurations of the API key and the forwarder, you do not have to provide the Datadog API key when updating the forwarder. To update or upgrade the forwarder in the future, apply the forwarder configuration again.
56+
Install the Forwarder using the public Datadog Terraform module available at [https://registry.terraform.io/modules/DataDog/log-lambda-forwarder-datadog/aws/latest][201]. Once the Lambda function is deployed, [set up triggers on the Forwarder][202].
6557

6658
#### Sample configuration
6759

6860
```tf
69-
# Store Datadog API key in AWS Secrets Manager
70-
variable "dd_api_key" {
71-
type = string
72-
description = "Datadog API key"
73-
}
74-
75-
resource "aws_secretsmanager_secret" "dd_api_key" {
76-
name = "datadog_api_key"
77-
description = "Encrypted Datadog API Key"
78-
}
61+
module "datadog_forwarder" {
62+
source = "DataDog/log-lambda-forwarder-datadog/aws"
63+
version = "~> 1.0"
7964
80-
resource "aws_secretsmanager_secret_version" "dd_api_key" {
81-
secret_id = aws_secretsmanager_secret.dd_api_key.id
82-
secret_string = var.dd_api_key
83-
}
84-
85-
output "dd_api_key" {
86-
value = aws_secretsmanager_secret.dd_api_key.arn
65+
dd_api_key = var.dd_api_key
66+
dd_site = var.dd_site
8767
}
8868
```
8969

90-
```tf
91-
# Use the Datadog Forwarder to ship logs from S3 and CloudWatch, as well as observability data from Lambda functions to Datadog. For more information, see https://github.com/DataDog/datadog-serverless-functions/tree/master/aws/logs_monitoring
92-
resource "aws_cloudformation_stack" "datadog_forwarder" {
93-
name = "datadog-forwarder"
94-
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
95-
parameters = {
96-
DdApiKeySecretArn = "REPLACE WITH DATADOG SECRETS ARN",
97-
DdSite = "REPLACE WITH DATADOG SITE",
98-
FunctionName = "datadog-forwarder"
99-
}
100-
template_url = "https://datadog-cloudformation-template.s3.amazonaws.com/aws/forwarder/latest.yaml"
101-
}
102-
```
70+
**Note**: Ensure that the `dd_site` parameter matches your [Datadog site][203]. Select your site on the right side of this page. Your Datadog site is {{< region-param key="dd_site" code="true" >}}.
71+
Your [Datadog API key][204] to use for `dd_api_key` can be found under **Organization Settings** > **API Keys**.
10372

104-
**Note**: Ensure that the `DdSite` parameter matches your [Datadog site][104]. Select your site on the right side of this page. Replace `<SITE>` in the above sample configuration with {{< region-param key="dd_site" code="true" >}}.
73+
For all configuration options and details, including [Multi-Region deployment][205], see the [module documentation][201].
10574

106-
[101]: https://www.terraform.io/docs/providers/aws/r/cloudformation_stack
107-
[102]: https://app.datadoghq.com/organization-settings/api-keys
108-
[103]: https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#set-up-triggers
109-
[104]: https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site
75+
[201]: https://registry.terraform.io/modules/DataDog/log-lambda-forwarder-datadog/aws/latest
76+
[202]: https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#set-up-triggers
77+
[203]: https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site
78+
[204]: https://app.datadoghq.com/organization-settings/api-keys
79+
[205]: https://registry.terraform.io/modules/DataDog/log-lambda-forwarder-datadog/aws/latest#multi-region-deployments
11080

11181
{{% /tab %}}
11282
{{% tab "Manual" %}}
@@ -129,7 +99,7 @@ aws lambda invoke --function-name <function-name> --payload '{"retry":"true"}' o
12999
```
130100

131101
<div class="alert alert-warning">
132-
The <a href="#cloudformation-parameters">environment variables provided on this page</a> are formatted for CloudFormation and Terraform. If you are installing the Forwarder manually, convert these parameter names from Pascal case to screaming snake case. For example, <code>DdApiKey</code> becomes <code>DD_API_KEY</code>, and <code>ExcludeAtMatch</code> becomes <code>EXCLUDE_AT_MATCH</code>.
102+
The <a href="#cloudformation-parameters">environment variables provided on this page</a> are formatted for CloudFormation. If you are installing the Forwarder manually, convert these parameter names from Pascal case to screaming snake case. For example, <code>DdApiKey</code> becomes <code>DD_API_KEY</code>, and <code>ExcludeAtMatch</code> becomes <code>EXCLUDE_AT_MATCH</code>.
133103
</div>
134104

135105
[101]: https://github.com/DataDog/datadog-serverless-functions/releases
@@ -347,7 +317,7 @@ The Datadog Forwarder is signed by Datadog. To verify the integrity of the Forwa
347317
## Parameters
348318

349319
{{< tabs >}}
350-
{{% tab "CloudFormation and Terraform" %}}
320+
{{% tab "CloudFormation" %}}
351321

352322
### Required
353323

@@ -498,6 +468,23 @@ To test different patterns against your logs, turn on [debug logs](#troubleshoot
498468
[21]: https://docs.datadoghq.com/logs/processing/pipelines/
499469
[2]: https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/
500470
{{% /tab %}}
471+
{{% tab "Terraform" %}}
472+
473+
### Required
474+
475+
`dd_api_key`
476+
: Your [Datadog API key][204], which can be found under **Organization Settings** > **API Keys**. The API Key is stored in AWS Secrets Manager. If you already have a Datadog API Key stored in Secrets Manager, use `dd_api_key_secret_arn` instead.
477+
478+
`dd_site`
479+
: The [Datadog site][203] that your metrics and logs will be sent to. Your Datadog site is {{< region-param key="dd_site" code="true" >}}.
480+
481+
For all configuration options and details, including [Multi-Region deployment][205], see the [module documentation][201].
482+
483+
[201]: https://registry.terraform.io/modules/DataDog/log-lambda-forwarder-datadog/aws/latest
484+
[203]: https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site
485+
[204]: https://app.datadoghq.com/organization-settings/api-keys
486+
[205]: https://registry.terraform.io/modules/DataDog/log-lambda-forwarder-datadog/aws/latest#multi-region-deployments
487+
{{% /tab %}}
501488
{{% tab "Manual" %}}
502489

503490
If you are installing the Forwarder manually, convert the parameter names from Pascal case to screaming snake case.

0 commit comments

Comments
 (0)