Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting a route53 route in https://github.com/terraform-aws-modules/terraform-aws-acm fails due to invalid argument to element #202

Open
brandonpollack23 opened this issue Oct 9, 2024 · 2 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@brandonpollack23
Copy link
Contributor

resource "validation" "aws:route53/record:Record" {
  options {
    dependsOn = [this]
    range     = (myCreateCertificate || myCreateRoute53RecordsOnly) && validationMethod == "DNS" && createRoute53Records && (validateCertificate || myCreateRoute53RecordsOnly) ? length(myDistinctDomainNames) : 0

  }
  zoneId         = notImplemented("lookup(var.zones,element(local.validation_domains,count.index)[\"domain_name\"],var.zone_id)")
  name           = element(validationDomains, range.value)["resource_record_name"]
  type           = element(validationDomains, range.value)["resource_record_type"]
  ttl            = dnsTtl
  records        = [element(validationDomains, range.value)["resource_record_value"]]
  allowOverwrite = validationAllowOverwriteRecords
}

is generated by

resource "aws_route53_record" "validation" {
  count = (local.create_certificate || local.create_route53_records_only) && var.validation_method == "DNS" && var.create_route53_records && (var.validate_certificate || local.create_route53_records_only) ? length(local.distinct_domain_names) : 0

  zone_id = lookup(var.zones, element(local.validation_domains, count.index)["domain_name"], var.zone_id)
  name    = element(local.validation_domains, count.index)["resource_record_name"]
  type    = element(local.validation_domains, count.index)["resource_record_type"]
  ttl     = var.dns_ttl

  records = [
    element(local.validation_domains, count.index)["resource_record_value"]
  ]

  allow_overwrite = var.validation_allow_overwrite_records

  depends_on = [aws_acm_certificate.this]
}

and zone id appears invalid in the generated code with the error:

  error: main.pp:36,28-45: the first argument to 'element' must be a list or tuple;
                error: main.pp:37,28-45: the first argument to 'element' must be a list or tuple;
                error: main.pp:39,29-46: the first argument to 'element' must be a list or tuple;
@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Oct 9, 2024
@brandonpollack23
Copy link
Contributor Author

I think this is because the function that creates said list is notImplemented:

notImplemented("distinct(\n[fork,vintry(aws_acm_certificate.this[0].domain_validation_options,var.acm_certificate_domain_validation_options):merge(\ntomap(v),{domain_name=replace(v.domain_name,\"*.\",\"\")}\n)]\n)")

@justinvp justinvp added kind/bug Some behavior is incorrect or out of spec and removed needs-triage Needs attention from the triage team labels Oct 11, 2024
@brandonpollack23
Copy link
Contributor Author

brandonpollack23 commented Oct 17, 2024

it seems this issue is actually another symptom of #186 (converting with terraform deps), once that is implemented this seems to resolve (it does not seem to be affected when the prototype binary is used)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants