'error when creating rds event subscription
Below tf code is to create AWS RDS event subscriptions. Getting below error while running this piece of tf code. If source_ids are not passed then it seems to be using 'all' as the default value - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_event_subscription
My requirement is not to not set it to 'all' in case event_subscription_source_type is not db-parameter-group. Is there any way to do that?
variable "event_subscription_source_type" {
type = map
description = "Map of the event subscription and event source type"
default = {
"rds-events" = "db-instance"
"db-param-group-chng" = "db-parameter-group"
}
}
#creating rds event subscriptions
resource "aws_db_event_subscription" "event_subscriptions" {
for_each = toset(var.event_subscription_names)
name = each.value
sns_topic = var.sns_topic
source_type = var.event_subscription_source_type[each.value]
source_ids = var.event_subscription_source_type[each.value] != "db-parameter-group" ? null : "all"
...
Error
Error: Incorrect attribute value type
│ on base.tf line 58, in resource "aws_db_event_subscription" "event_subscriptions":
│ 58: source_ids = var.event_subscription_source_type[each.value] != "db-parameter-group" ? null : "all"
│ │ each.value will be known only after apply
│ │ var.event_subscription_source_type is a map of dynamic, known only after apply
│ Inappropriate value for attribute "source_ids": set of string required.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
