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

aws_service_discovery_public_dns_namespace name length limit #5339

Closed
ddriddle opened this issue Jul 25, 2018 · 4 comments · Fixed by #5610
Closed

aws_service_discovery_public_dns_namespace name length limit #5339

ddriddle opened this issue Jul 25, 2018 · 4 comments · Fixed by #5610
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/servicediscovery Issues and PRs that pertain to the servicediscovery service.
Milestone

Comments

@ddriddle
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.7

  • provider.aws v1.28.0

Affected Resource(s)

  • aws_service_discovery_public_dns_namespace

Terraform Configuration Files

provider "aws" {
  region  = "us-east-2"
  version = "1.28.0"
}

resource "aws_service_discovery_public_dns_namespace" "default" {
  name = "very.very.long.domain.name.example.com"
}

Debug Output

https://gist.github.com/ddriddle/5ec7170b26020657fc2a2ee69ca41e54

Expected Behavior

Should have created the resource.

Actual Behavior

* aws_service_discovery_public_dns_namespace.default: 1 error(s) occurred:

* aws_service_discovery_public_dns_namespace.default: InvalidInput: 1 validation error detected: Value 'tf-very.very.long.domain.name.example.com20180725230632994500000001' at 'creatorRequestId' failed to satisfy constraint: Member must have length less than or equal to 64
	status code: 400, request id: 5f661afa-905f-11e8-9197-5bd16439433f

Steps to Reproduce

  1. terraform apply

Important Factoids

Appears to be related to closed issue #4701.

@bflad bflad added bug Addresses a defect in current functionality. service/servicediscovery Issues and PRs that pertain to the servicediscovery service. labels Jul 26, 2018
@bflad
Copy link
Contributor

bflad commented Jul 26, 2018

Indeed! Its likely the code fix in aws/resource_aws_service_discovery_public_dns_namespace.go is very similar if you want to submit it:

Replace:

	requestId := resource.PrefixedUniqueId(fmt.Sprintf("tf-%s", d.Get("name").(string)))
	input := &servicediscovery.CreatePublicDnsNamespaceInput{
		Name:             aws.String(d.Get("name").(string)),
		CreatorRequestId: aws.String(requestId),
	}

With:

	name := d.Get("name").(string)
	// The CreatorRequestId has a limit of 64 bytes
	var requestId string
	if len(name) > (64 - resource.UniqueIDSuffixLength) {
		requestId = resource.PrefixedUniqueId(name[0:(64 - resource.UniqueIDSuffixLength - 1)])
	} else {
		requestId = resource.PrefixedUniqueId(name)
	}

	input := &servicediscovery.CreatePublicDnsNamespaceInput{
		Name:             aws.String(name),
		CreatorRequestId: aws.String(requestId),
	}

And TestAccAWSServiceDiscoveryPrivateDnsNamespace_longname is an acceptance test that covers the behavior, which can be used for inspiration/copy-paste in writing one for this resource.

@bflad bflad added the good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. label Jul 26, 2018
@bflad
Copy link
Contributor

bflad commented Aug 21, 2018

The fix for this has been merged into master and will release with version 1.33.0 of the AWS provider, later this week. 👍

@bflad bflad added this to the v1.33.0 milestone Aug 21, 2018
@bflad
Copy link
Contributor

bflad commented Aug 22, 2018

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

@ghost
Copy link

ghost commented Apr 3, 2020

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 and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/servicediscovery Issues and PRs that pertain to the servicediscovery service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants