Closed lmpardey closed 3 years ago
Love this ! I would use the main stack if this PR is accepted ! I will have a clearer terraform code with that !
@lmpardey thanks for your contribution, again! Really sorry for the delay, we need to improve tracking of PRs.
What does this PR do?
This PR adds an output to the CloudFormation template for the Datadog integration. The output contains the ARN of the SecretsManager secret (if created) which holds the Datadog API key and the ARN of the forwarder Lambda function. Both of these resources are created by the nested Forwarder stack, therefore this PR depends on the release of https://github.com/DataDog/datadog-serverless-functions/pull/427.
Motivation
The SecretsManager and Lambda resources created by CloudFormation have randomized suffixes in their names. These random characters make it hard to integrate with other automation tools which require the exact ARN of the resources.
Exporting the ARN allows integrations with other tools, such as Terraform, which require the secret ARN but only have access to the outputs of a stack. The nested stacks export the ARNs of these outputs, so this PR is required to propagate those outputs to the parent stack. The nested stacks have randomized names themselves therefore it is not sufficient to take the outputs from there using other tools.
Testing Guidelines
Note: testing was carried out inside the
aws
directory.Update Existing Stack
Locate the name of the existing Datadog integration stack
Update the main stack using the new template file and keeping the original values of the required variables. This action depends on the deployment of https://github.com/DataDog/datadog-serverless-functions/pull/427 since the Forwarder stack must export certain outputs.
When the stack is updated, validate that the outputs contain the Lambda function ARN and the Api Secret ARN. Validate that the outputs
Create New Stack
Create a new stack with the new (rendered) template, using appropriate values for the required variables and capabilities:
When the stack is created, validate that the outputs contain the Lambda function ARN and the Api Secret ARN.
Additional Notes
Depends on https://github.com/DataDog/datadog-serverless-functions/pull/427