-
-
Couldn't load subscription status.
- Fork 230
Closed
Description
Description
Unable to specify a defined type for the variable records, only works with any
Not sure how much it is a bug but if we want to define a better type it won't work.
- ✋ I have searched the open/closed issues and my issue is not listed.
Versions
-
Module version [Required]: 2.10.2
-
Terraform version:
- Provider version(s):
Reproduction Code [Required]
Steps to reproduce the behavior:
No YesUsing a type of any like here works well
But when trying to define records like that:
records = list(object({
name = string
type = string
ttl = optional(number, null)
records = optional(list(string), null)
alias = optional(object({
name = string
zone_id = string
evaluate_target_health = optional(bool, null)
}), null)
fails due to the lookup being done with this code
Expected behavior
Terraform run should work when alias object is set to null, (meaning for this entry im using records)
Actual behavior
Fails with following error:
│ Error: Invalid function argument
│
│ on .terraform/modules/route53_records/modules/records/main.tf line 33, in resource "aws_route53_record" "this":
│ 33: for_each = length(keys(lookup(each.value, "alias", {}))) == 0 ? [] : [true]
│ ├────────────────
│ │ while calling keys(inputMap)
│ │ each.value is object with 5 attributes
│
│ Invalid value for "inputMap" parameter: argument must not be null.
╵
Additional context
Must add of course than using any for the variable type solve this but its always nicer to have your type specifically defined
schammah
Metadata
Metadata
Assignees
Labels
No labels