Skip to content

Commit 467a5c7

Browse files
authored
ADD Tags to resources (#12)
1 parent 6b96545 commit 467a5c7

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

examples/cloudwatch-metrics-stream-single-account/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,10 @@ variable "exclude_filters" {
8080
metric_names = list(string)
8181
}))
8282
default = []
83+
}
84+
85+
variable "tags" {
86+
description = "Map of tags to apply to resources"
87+
type = map(string)
88+
default = {}
8389
}

modules/cloud-watch-metrics-stream/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ No modules.
5555
|<a name="access_key_id"></a> [access\_key\_id](#input\_access\_key\_id) | The ID for the access key that has the permissions into the Cloud Account. It must be provided along secret_key when this auth mode is used | `string` | n/a | no |
5656
|<a name="include_filters"></a> [include\_filters](#input\_include\_filters) | List of inclusive metric filters. If you specify this parameter, the stream sends only the conditional metric names from the metric namespaces that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is included. Conflicts with `exclude_filter` | `Object` | n/a | no |
5757
|<a name="exclude_filters"></a> [exclude\_filters](#input\_exclude\_filters) | List of exclusive metric filters. If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces and the conditional metric names that you specify here. If you don't specify metric names or provide empty metric names whole metric namespace is excluded. Conflicts with `include_filter` | `Object` | n/a | no |
58+
|<a name="tags"></a> [tags](#input\_tags) | Map of tags to apply to resources | `map string` | n/a | no |
5859

5960
## Outputs
6061

modules/cloud-watch-metrics-stream/iam.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ resource "aws_iam_role" "service_role" {
66
name = "sysdig_stream_s3_policy"
77
policy = data.aws_iam_policy_document.iam_role_task_policy_service_role.json
88
}
9+
tags = var.tags
910
}
1011

1112
resource "aws_iam_role" "sysdig_cloudwatch_metric_stream_role" {
@@ -17,6 +18,7 @@ resource "aws_iam_role" "sysdig_cloudwatch_metric_stream_role" {
1718
name = "sysdig_stream_firehose_policy"
1819
policy = data.aws_iam_policy_document.iam_role_task_policy_sysdig_cloudwatch_metric_stream_role.json
1920
}
21+
tags = var.tags
2022
}
2123

2224
resource "aws_iam_role" "sysdig_cloudwatch_integration_monitoring_role" {
@@ -25,6 +27,7 @@ resource "aws_iam_role" "sysdig_cloudwatch_integration_monitoring_role" {
2527
path = "/"
2628
description = "A role to check status of stack creation and metric stream itself"
2729
assume_role_policy = data.aws_iam_policy_document.sysdig_cloudwatch_integration_monitoring_role_assume_role.json
30+
tags = var.tags
2831
}
2932

3033
resource "aws_iam_role_policy" "cloud_monitoring_policy" {

modules/cloud-watch-metrics-stream/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
resource "aws_cloudwatch_log_group" "sysdig_stream_logs" {
22
name = "sysdig-cloudwatch-metric-stream-${data.aws_region.current.name}-${data.aws_caller_identity.me.account_id}"
33
retention_in_days = 14
4+
tags = var.tags
45
}
56

67
resource "aws_cloudwatch_log_stream" "http_log_stream" {
@@ -15,7 +16,7 @@ resource "aws_cloudwatch_log_stream" "s3_backup" {
1516

1617
resource "aws_s3_bucket" "sysdig_stream_backup_bucket" {
1718
bucket = "sysdig-backup-bucket-${data.aws_region.current.name}-${data.aws_caller_identity.me.account_id}"
18-
## add tags?
19+
tags = var.tags
1920
}
2021

2122
resource "aws_kinesis_firehose_delivery_stream" "sysdig_metric_kinesis_firehose" {
@@ -48,6 +49,8 @@ resource "aws_kinesis_firehose_delivery_stream" "sysdig_metric_kinesis_firehose"
4849
compression_format = "GZIP"
4950
}
5051
}
52+
53+
tags = var.tags
5154
}
5255

5356
resource "aws_cloudwatch_metric_stream" "sysdig_metris_stream_all_namespaces" {
@@ -72,6 +75,8 @@ resource "aws_cloudwatch_metric_stream" "sysdig_metris_stream_all_namespaces" {
7275
metric_names = length(exclude_filter.value.metric_names) > 0 ? exclude_filter.value.metric_names : null
7376
}
7477
}
78+
79+
tags = var.tags
7580
}
7681

7782
resource "time_sleep" "wait_60_seconds" {

modules/cloud-watch-metrics-stream/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,10 @@ variable "exclude_filters" {
8080
metric_names = list(string)
8181
}))
8282
default = []
83+
}
84+
85+
variable "tags" {
86+
description = "Map of tags to apply to resources"
87+
type = map(string)
88+
default = {}
8389
}

0 commit comments

Comments
 (0)