Skip to content

Commit b903aa9

Browse files
authored
Datadog Upstreams and Account Settings (cloudposse/terraform-aws-components#533)
1 parent 64691cf commit b903aa9

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
This component is responsible for provisioning Datadog AWS integrations.
44

5-
It's required that the DataDog API and APP secret keys are available in the `var.datadog_secrets_source_store_account` account
6-
in AWS SSM Parameter Store at the `/datadog/%v/datadog_app_key` paths (where `%v` are the corresponding account names).
7-
85
See Datadog's [documentation about provisioning keys](https://docs.datadoghq.com/account_management/api-app-keys) for more information.
96

107
## Usage
@@ -44,6 +41,7 @@ No providers.
4441
| <a name="module_datadog_configuration"></a> [datadog\_configuration](#module\_datadog\_configuration) | ../datadog-configuration/modules/datadog_keys | n/a |
4542
| <a name="module_datadog_integration"></a> [datadog\_integration](#module\_datadog\_integration) | cloudposse/datadog-integration/aws | 1.0.0 |
4643
| <a name="module_iam_roles"></a> [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a |
44+
| <a name="module_store_write"></a> [store\_write](#module\_store\_write) | cloudposse/ssm-parameter-store/aws | 0.9.1 |
4745
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
4846
4947
## Resources

src/main.tf

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,33 @@ locals {
2020
# Get the context tags and skip tags that we don't want applied to every resource.
2121
# i.e. we don't want name since each metric would be called something other than this component's name.
2222
# i.e. we don't want environment since each metric would come from gbl or a region and this component is deployed in gbl.
23-
context_tags = [for k, v in module.this.tags : "${lower(k)}:${v}" if contains(var.context_host_and_filter_tags, lower(k))]
24-
filter_tags = distinct(concat(var.filter_tags, local.context_tags))
25-
host_tags = distinct(concat(var.host_tags, local.context_tags))
23+
context_tags = [
24+
for k, v in module.this.tags : "${lower(k)}:${v}" if contains(var.context_host_and_filter_tags, lower(k))
25+
]
26+
filter_tags = distinct(concat(var.filter_tags, local.context_tags))
27+
host_tags = distinct(concat(var.host_tags, local.context_tags))
28+
}
29+
30+
module "store_write" {
31+
count = local.enabled ? 1 : 0
32+
source = "cloudposse/ssm-parameter-store/aws"
33+
version = "0.9.1"
34+
parameter_write = [
35+
{
36+
name = "/datadog/datadog_external_id"
37+
value = join("", module.datadog_integration[*].datadog_external_id)
38+
type = "String"
39+
overwrite = "true"
40+
description = "External identifier for our dd integration"
41+
},
42+
{
43+
name = "/datadog/aws_role_name"
44+
value = join("", module.datadog_integration[*].aws_role_name)
45+
type = "String"
46+
overwrite = "true"
47+
description = "Name of the AWS IAM role used by our dd integration"
48+
}
49+
]
50+
51+
context = module.this.context
2652
}

src/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ variable "context_host_and_filter_tags" {
4444
description = "Automatically add host and filter tags for these context keys"
4545
default = ["namespace", "tenant", "stage"]
4646
}
47+

0 commit comments

Comments
 (0)