terraform-community-modules/tf_aws_elasticache_redis

Error: map "data.aws_vpc.vpc.tags" does not have homogenous types. found TypeString and then TypeMap

acceleratxr opened this issue · 2 comments

Anytime I make a change to terraform configuration and/or attempt to apply changes multiple times after an initial application of the configuration I get errors.

Steps to Reproduce:

  1. Define a module in terraform such as:
    module "redis" { source = "github.com/terraform-community-modules/tf_aws_elasticache_redis?ref=v1.3.1" env = "${var.environment}" name = "${var.cluster_name}-${var.environment}-redis" redis_clusters = "2" redis_failover = "true" redis_version = "4.0.10" subnets = "${module.vpc.database_subnets}" vpc_id = "${module.vpc.vpc_id}" }
  2. Apply the module with terraform apply
  3. Apply the module again with terraform apply

Expected Results:
No changes are made in step 3 and a success is returned.

Actual Results:
The following failure occurs.
`Error: Error refreshing state: 3 error(s) occurred:

  • module.redis.aws_security_group.redis_security_group: 1 error(s) occurred:

  • module.redis.aws_security_group.redis_security_group: At column 76, line 1: map "data.aws_vpc.vpc.tags" does not have homogenous types. found TypeString and then TypeMap in:

${format("%.255s", "tf-sg-ec-${var.name}-${var.env}-${data.aws_vpc.vpc.tags["Name"]}")}

  • module.redis.aws_elasticache_subnet_group.redis_subnet_group: 1 error(s) occurred:

  • module.redis.aws_elasticache_subnet_group.redis_subnet_group: At column 98, line 1: map "data.aws_vpc.vpc.tags" does not have homogenous types. found TypeMap and then TypeString in:

${replace(format("%.255s", lower(replace("tf-redis-${var.name}-${var.env}-${data.aws_vpc.vpc.tags["Name"]}", "_", "-"))), "/\s/", "-")}

  • module.redis.aws_elasticache_parameter_group.redis_parameter_group: 1 error(s) occurred:

  • module.redis.aws_elasticache_parameter_group.redis_parameter_group: At column 98, line 1: map "data.aws_vpc.vpc.tags" does not have homogenous types. found TypeMap and then TypeString in:

${replace(format("%.255s", lower(replace("tf-redis-${var.name}-${var.env}-${data.aws_vpc.vpc.tags["Name"]}", "_", "-"))), "/\s/", "-")}`

@acceleratxr Try removing the tag kubernetes.io/cluster/=shared from your VPC. This fixed my issue.
kubernetes/kops#4265.

fixed and can be closed