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

Errors creating redis groups #1

Closed
BigAl opened this issue May 22, 2017 · 5 comments · Fixed by #3
Closed

Errors creating redis groups #1

BigAl opened this issue May 22, 2017 · 5 comments · Fixed by #3
Assignees

Comments

@BigAl
Copy link

BigAl commented May 22, 2017

I received the following errors while trying to use this module:

* aws_elasticache_subnet_group.redis_subnet_group: Error creating CacheSubnetGroup: InvalidParameterValue: The parameter CacheSubnetGroupName is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
	status code: 400, request id: d6037af0-3e99-11e7-9aa8-573aaeaa8fe0
* module.redis.aws_elasticache_parameter_group.redis_parameter_group: 1 error(s) occurred:

* aws_elasticache_parameter_group.redis_parameter_group: Error creating Cache Parameter Group: InvalidParameterValue: The parameter CacheParameterGroupName is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
	status code: 400, request id: d60464d2-3e99-11e7-b077-5967719aeab4

I believe the issue relates to the use of the vpc.tags["Name"] in main.tf on line 20 and 26. It's not clear that from the Readme that this needs to be set and in my case the Name tag on my VPC contains a space, hence the error. Simply removing -${data.aws_vpc.vpc.tags["Name"]} fixes the issue for me, perhaps I'm missing the need to add this addition information to these 2 groups

@BigAl BigAl changed the title Errors creating redistribution Errors creating redis groups May 22, 2017
@antonbabenko
Copy link
Member

@tfhartmann Values should not be so long. Something like this should help for several types of resources: name = "${replace(format("%.100s", lower(replace("${var.name}", "_", "-"))), "/-+$/", "")}"

@tfhartmann
Copy link
Member

@BigAl you shouldn't need to specify the value of the VPC name, it should be extracted from the VPC data source here https://github.com/terraform-community-modules/tf_aws_elasticache_redis/blob/master/main.tf#L1

I accounted for the name length in the replication group id replication_group_id = "${format("%.20s","${var.name}-${var.env}")}" but not in the other locations that use that tag value, It also doesn't account for spaces, which I suspect is the issue @BigAl is running into... @antonbabenko I like what you are thinking with name = "${replace(format("%.100s", lower(replace("${var.name}", "_", "-"))), "/-+$/", "")}" let me see if I can update with something that accounts for spaces in particular.

@tfhartmann
Copy link
Member

Take a look at #3 it should resolve the issue you ran into, if I can get a 👍 I'll merge that in and push a new version tag. In testing, it also surfaced a bug I had in the redis_version regex replace function as well! :)

@tfhartmann
Copy link
Member

@BigAl I just pushed a new version that should resolve you issue, let me know if you are still having problems!

@BigAl
Copy link
Author

BigAl commented May 24, 2017

👍 All looks fine now.

antonbabenko pushed a commit that referenced this issue Apr 3, 2018
fixed error:  if variable are the output from other module
antonbabenko pushed a commit that referenced this issue Nov 28, 2019
Upgraded to latest terraform 0.12.6 syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants