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

R53 Delegation Set: Member must have length less than or equal to 32 #12238

Closed
ghost opened this issue Mar 3, 2020 · 5 comments · Fixed by #12340
Closed

R53 Delegation Set: Member must have length less than or equal to 32 #12238

ghost opened this issue Mar 3, 2020 · 5 comments · Fixed by #12340
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/route53 Issues and PRs that pertain to the route53 service.
Milestone

Comments

@ghost
Copy link

ghost commented Mar 3, 2020

This issue was originally opened by @david-peters-aitch2o as hashicorp/terraform#24250. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.21
+ provider.aws v2.44.0
...

Terraform Configuration Files

resource "aws_route53_zone" "main" {
  name = "${terraform.workspace}.fubarfubar.com"
 delegation_set_id = "aws_route53_delegation_set.main.id"
  tags = {
    Environment = "${terraform.workspace}.terraform"
  }
}
...

Debug Output

Crash Output

Expected Behavior

If ${terraform.workspace} is dev and domain is fubarfubar.com there should be no issues

Actual Behavior

Terraform fails with Error: error creating Route53 Hosted Zone: InvalidInput: 1 validation error detected: Value 'aws_route53_delegation_set.main.id' at 'resourceId' failed to satisfy constraint: Member must have length less than or equal to 32 status code: 400, request id: 0f396743-1af5-417c-91e3-3d4a1ae23672

Steps to Reproduce

Additional Context

Changing the domain fubarfubar.com to a.com or something shorter works, it seems Terraform is taking ${terraform.workspace} as part of the domain when it calculates the domain name length.

This only happens when delegation_set_id is part of the aws_route53_zone resource

References

@ghost ghost added the service/route53 Issues and PRs that pertain to the route53 service. label Mar 3, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 3, 2020
@tomelliff
Copy link
Contributor

tomelliff commented Mar 5, 2020

You're using a string literal "aws_route53_delegation_set.main.id" so that's 34 characters.

If you're using Terraform 0.12 then this should just be:

resource "aws_route53_zone" "main" {
  name              = "${terraform.workspace}.fubarfubar.com"
  delegation_set_id = aws_route53_delegation_set.main.id

  tags = {
    Environment = "${terraform.workspace}.terraform"
  }
}

but if you're using Terraform 0.11 or lower then you need to use the interpolation syntax:

resource "aws_route53_zone" "main" {
  name              = "${terraform.workspace}.fubarfubar.com"
  delegation_set_id = "${aws_route53_delegation_set.main.id}"

  tags = {
    Environment = "${terraform.workspace}.terraform"
  }
}

@tomelliff
Copy link
Contributor

There should probably be a ValidateFunc on this as well to check this is no more than 32 characters at plan/validate time.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 6, 2021
@bflad bflad added this to the v3.23.0 milestone Jan 6, 2021
@bflad
Copy link
Contributor

bflad commented Jan 6, 2021

Length validation for this argument has been merged and will release with version 3.23.0 of the Terraform AWS Provider, likely tomorrow. Thank you to @FrancisLfg for the implementation. 👍

@ghost
Copy link
Author

ghost commented Jan 8, 2021

This has been released in version 3.23.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link
Author

ghost commented Feb 6, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/route53 Issues and PRs that pertain to the route53 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants