Null resource condition in terraform

I m using disney module “kinesis_firehose_splunk” and using terraform resource “aws_cloudwatch_log_group:”. to create log groups .

Before the log group are created the the module tried to pass the cloudwatch_log_group_names_to_ship value which results in error

.terraform/modules/kinesis_firehose_splunk/main.tf line 435, in resource “aws_cloudwatch_log_subscription_filter” “cloudwatch_log_filters”:
│ 435: for_each = var.cloudwatch_log_group_names_to_ship != null ? toset(var.cloudwatch_log_group_names_to_ship) : toset()
│ ├────────────────
│ │ var.cloudwatch_log_group_names_to_ship is list of string with 1 element

my code

module “kinesis_firehose_splunk” {
count = var.enable_splunk ? 1 : 0
source = “disney/kinesis-firehose-splunk/aws”
version = “9.0.5”
region = data.aws_region.current.name
nodejs_runtime = “nodejs20.x”
cloudwatch_log_group_names_to_ship = concat(
[aws_cloudwatch_log_group.apigw_log_group.name]
)
]

resource “aws_cloudwatch_log_group” “apigw_log_group” {
name = “API-Gateway-Execution-Logs_${var.env}-stage”

tags = merge(
var.default_tags,
{
Name = “APIy-Execution-Logs_/iaw-mbp-${var.env}–stage”
Description = “test”
}
)
lifecycle {
ignore_changes = [tags]
}
}

Hi @alpanakabra,

It would help if you formatted the config and output to make it easier to read, and correct if one were to copy+paste it from your post. In addition, the complete error output has more information, we only have the reference from the configuration here, and even better if you can create a minimal reproducible example.

1 Like