Skip to content

Commit b41126f

Browse files
committed
move log group data source to call site
1 parent edaa4ce commit b41126f

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

aws/telemetry/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module "prometheus_workspace" {
2323
alert_resolve_timeout = var.alert_resolve_timeout
2424
alert_subject_template = var.alert_subject_template
2525
alertmanager_config_enabled = var.alertmanager_config_enabled
26-
logging_configuration = var.logging_configuration
26+
log_group_arn = var.log_group_arn
2727
name = var.prometheus_workspace_name
2828
tags = var.tags
2929

aws/telemetry/modules/prometheus-workspace/main.tf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ resource "aws_prometheus_workspace" "this" {
33
tags = var.tags
44

55
dynamic logging_configuration {
6-
for_each = var.logging_configuration
6+
for_each = var.log_group_arn
77
content {
8-
log_group_arn = data.aws_cloudwatch_log_group.this[each.value].arn
8+
log_group_arn = setting.value
99
}
1010
}
1111
}
1212

13-
data "aws_cloudwatch_log_group" "this" {
14-
for_each = var.logging_configuration
15-
name = each.value
16-
}
17-
1813
resource "aws_iam_role" "ingestion" {
1914
assume_role_policy = data.aws_iam_policy_document.ingestion_assume_role.json
2015
name = join("-", concat([var.name, "prometheus", "ingestion"]))

aws/telemetry/modules/prometheus-workspace/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ variable "alertmanager_config_enabled" {
2828
default = true
2929
}
3030

31-
variable "logging_configuration" {
32-
description = "Cloudwatch logging configuration for Prometheus workspace"
33-
type = map(string)
34-
default = {}
31+
variable "log_group_arn" {
32+
description = "ARN for the CW log group"
33+
type = list(string)
34+
default = []
3535
}
3636

3737
variable "name" {

aws/telemetry/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ variable "alertmanager_config_enabled" {
4646
default = true
4747
}
4848

49-
variable "logging_configuration" {
50-
description = "Cloudwatch logging configuration for Prometheus workspace"
51-
type = map(string)
52-
default = {}
49+
variable "log_group_arn" {
50+
description = "ARN for the CW log group"
51+
type = list(string)
52+
default = []
5353
}
5454

5555
variable "grafana_role_name" {

0 commit comments

Comments
 (0)