I am looking for help to better understand this.
I have a module that creates about ~500 resources in it. Module works fine, and we call it from different locations by passing in a giant list of vars, so the module is the same for each one of our envs - prod/stg/deploy.
However I managed to screw something up and needed to do a state rm and then an import. state rm worked fine, as expected.
However when i try the import I get this:
8: validation_domains = var.create_certificate ? [for k, v in aws_acm_certificate.this[0].domain_validation_options : tomap(v) if contains(local.distinct_domain_names, replace(v.domain_name, “*.”, “”))] :
|----------------
| aws_acm_certificate.this is empty tupleThe given key does not identify an element in this collection value.
So the acm in question has "create_certificate = var.enable_external_mc. This is default set to true in the module, so we generally dont push that var from the environmental folders calling the module.
So i reckon the import doesnt pick up the default=true from the lower level module, so it see’s the details as empty.
I really have no clue about how to work around this, other than delete and recreate the resource , which is a drastic measure.