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

Cannot create acm with wildcard domain_name #62

Closed
ollandos opened this issue Oct 16, 2020 · 4 comments
Closed

Cannot create acm with wildcard domain_name #62

ollandos opened this issue Oct 16, 2020 · 4 comments

Comments

@ollandos
Copy link

ollandos commented Oct 16, 2020

When using the module like this:

inputs = {
    zone_id      = "XXXXXXXX"
    domain_name  = "*.example.com"
}

This module fails with:

Error: Error in function call

  on main.tf line 31, in resource "aws_route53_record" "validation":
  31:   name    = element(local.validation_domains, count.index)["resource_record_name"]
    |----------------
    | count.index is 1
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.


Error: Error in function call

  on main.tf line 31, in resource "aws_route53_record" "validation":
  31:   name    = element(local.validation_domains, count.index)["resource_record_name"]
    |----------------
    | count.index is 0
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.


Error: Error in function call

  on main.tf line 32, in resource "aws_route53_record" "validation":
  32:   type    = element(local.validation_domains, count.index)["resource_record_type"]
    |----------------
    | count.index is 1
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.


Error: Error in function call

  on main.tf line 32, in resource "aws_route53_record" "validation":
  32:   type    = element(local.validation_domains, count.index)["resource_record_type"]
    |----------------
    | count.index is 0
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.


Error: Error in function call

  on main.tf line 36, in resource "aws_route53_record" "validation":
  36:     element(local.validation_domains, count.index)["resource_record_value"]
    |----------------
    | count.index is 1
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.


Error: Error in function call

  on main.tf line 36, in resource "aws_route53_record" "validation":
  36:     element(local.validation_domains, count.index)["resource_record_value"]
    |----------------
    | count.index is 0
    | local.validation_domains is empty tuple

Call to function "element" failed: cannot use element function with an empty
list.

Releasing state lock. This may take a few moments...
[terragrunt] 2020/10/16 12:11:49 Hit multiple errors:
exit status 1

This is caused because the domain_name is not cleaned when calculating distinct_domain_names
https://github.com/terraform-aws-modules/terraform-aws-acm/blob/master/main.tf#L3

This is something that is supported by ACM

@Chili-Man
Copy link

Chili-Man commented Oct 20, 2020

I am running into this issue as well when using a wild card:

module "acm_management" {
  source  = "terraform-aws-modules/acm/aws"
  version = "2.11.0"

  domain_name = "*.example.com,"
  zone_id     = aws_route53_zone.example_com.zone_id
}

However, it does seem to work if you add the subject_alternative_name field:

module "acm_management" {
  source  = "terraform-aws-modules/acm/aws"
  version = "2.11.0"

  domain_name = "*.example.com,"
  zone_id     = aws_route53_zone.example_com.zone_id
  subject_alternative_names = [
    "something.example.com"
  ]

}

@Chili-Man
Copy link

Looks like someone has a pr open to fix the issue here #57

@antonbabenko
Copy link
Member

This has been just fixed in #71 and v2.13.0 has been just released.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants