terraform-aws-dms
terraform-aws-dms copied to clipboard
Invalid function argument error when using merge method
Description
To conditionally create an endpoint, we plan to use a merge method combined with a ternary expression. However, this approach may lead to an 'Invalid function argument' error because the lookup function might return a null value, which differs from the expected default type [].
- [x] β I have searched the open/closed issues and my issue is not listed.
Versions
- Terraform version: 1.5.7
- Provider version(s): hashicorp/aws v5.48.0
Reproduction Code [Required]
locals {
is_additional_task_needed = true
}
module "dms_aurora_postgresql_aurora_mysql" {
# Endpoints
endpoints = merge({
postgresql-destination = {
...
},local.is_additional_task_needed ? {
mysql-source = {
database_name = "foo"
...
} } : {}
)
Expected behavior
Endpoints should be created successfully
Actual behavior
Invalid function argument errors were raised when trying to lookup settings of each value
Terminal Output Screenshot(s)
Additional context
I've created a PR and added the conditional endpoints in example