Skip to content

Commit 0016d69

Browse files
Merge pull request #63 from scribd/datadog-module-support-tags
feat:added additional variables for tags
2 parents b54ac8a + 1e13e7d commit 0016d69

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

logs_monitoring.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ resource "aws_cloudformation_stack" "datadog-forwarder" {
1010
FunctionName = "${local.stack_prefix}datadog-forwarder"
1111
}
1212
template_url = "https://datadog-cloudformation-template.s3.amazonaws.com/aws/forwarder/${var.dd_forwarder_template_version}.yaml"
13+
tags = merge(local.default_tags, var.tags)
1314

1415
lifecycle {
1516
ignore_changes = [
@@ -21,7 +22,7 @@ resource "aws_cloudformation_stack" "datadog-forwarder" {
2122
resource "aws_secretsmanager_secret" "datadog_api_key" {
2223
name_prefix = "${local.stack_prefix}datadog-api-key"
2324
description = "Datadog API Key"
24-
tags = local.default_tags
25+
tags = merge(local.default_tags, var.tags)
2526
}
2627

2728
resource "aws_secretsmanager_secret_version" "datadog_api_key" {

logs_monitoring_elb.tf

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ data "aws_iam_policy_document" "elb_logs" {
4444
resource "aws_s3_bucket" "elb_logs" {
4545
count = var.create_elb_logs_bucket ? 1 : 0
4646
bucket = local.elb_logs_s3_bucket
47+
tags = merge(local.default_tags, var.tags)
48+
4749
}
4850

4951
resource "aws_s3_bucket_policy" "elb_logs" {

main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ EOF
4141

4242
tags = merge(local.default_tags, {
4343
description = "This role allows the datadog AWS account to access this account for metrics collection"
44-
})
44+
}, var.tags)
4545
}
4646

4747
resource "aws_iam_policy" "datadog-core" {
4848
count = var.enable_datadog_aws_integration ? 1 : 0
4949
name = "datadog-core-integration"
5050
path = "/"
5151
description = "This IAM policy allows for core datadog integration permissions"
52-
53-
policy = <<EOF
52+
tags = merge(local.default_tags, var.tags)
53+
policy = <<EOF
5454
{
5555
"Version": "2012-10-17",
5656
"Statement": [

vars.tf

+6
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@ variable "extra_policy_arns" {
9797
type = list(string)
9898
default = []
9999
}
100+
101+
variable "tags" {
102+
description = "A map of tags to assign to resources."
103+
type = map(string)
104+
default = {}
105+
}

0 commit comments

Comments
 (0)