With the current setup it is not possible to conditionally configure an S3 Bucket with replication_configuration.
The true and false result expressions can't have consistent types, because the module code is not designed for that.
If the condition is true (replication_configuration should be defined), then an empty object ({}) as false result is not accepted and raises a Terraform error The true and false result expressions must have consistent types. The 'true' value includes object attribute "role", which is absent in the 'false' value., only null is possible.
If the condition is false (replication_configuration should not be defined), null is not accepted by the module code, resulting in the error Invalid value for "inputMap" parameter: argument must not be null..
Versions
Module version [Required]: 4.1.2
Terraform version: Terraform v1.9.4 on darwin_arm64
Module "s3_replication" has an empty object as false condition and module "s3_no_replication" has null as false condition
Expected behavior
The module should accept null as value for the replication_configuration variable and check if the variable is null on the resource aws_s3_bucket_replication_configuration. Also it should set null as default value for the variable instead of {}.
Actual behavior
The module checks for length(keys(var.replication_configuration)) > 0 on resource aws_s3_bucket_replication_configuration, but giving an empty object as variable input produces "inconsistent types" error
This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days
Description
With the current setup it is not possible to conditionally configure an S3 Bucket with
replication_configuration
. Thetrue
andfalse
result expressions can't have consistent types, because the module code is not designed for that.If the condition is true (replication_configuration should be defined), then an empty object (
{}
) as false result is not accepted and raises a Terraform errorThe true and false result expressions must have consistent types. The 'true' value includes object attribute "role", which is absent in the 'false' value.
, onlynull
is possible.If the condition is false (replication_configuration should not be defined),
null
is not accepted by the module code, resulting in the errorInvalid value for "inputMap" parameter: argument must not be null.
.Versions
Reproduction Code [Required]
Steps to reproduce the behavior:
null
as false conditionExpected behavior
The module should accept
null
as value for thereplication_configuration
variable and check if the variable is null on the resourceaws_s3_bucket_replication_configuration
. Also it should set null as default value for the variable instead of{}
.Actual behavior
The module checks for
length(keys(var.replication_configuration)) > 0
on resourceaws_s3_bucket_replication_configuration
, but giving an empty object as variable input produces "inconsistent types" errorTerminal Output Screenshot(s)