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_elb - Name Requirements affect variable interpolation names #3467

Closed
packplusplus opened this issue Oct 9, 2015 · 2 comments
Closed

Comments

@packplusplus
Copy link

Related to #2580

AWS ELBs have a naming requirement which prevents chars like _'s. That is all well and good, but the terraform syntax parser (0.6.3) applies the same logic to the variable names and the interpolated value. It's my opinion the parser shouldn't care what the variable/interpolated thing is called, only it's value.

Example:

resource "aws_elb" "es_elb" {
  name = "es-elb"
  internal = true
  subnets = ["${aws_subnet.private.*.id}"]

  listener {
    instance_port = 9200
    instance_protocol = "http"
    lb_port = 9200
    lb_protocol = "http"
  }

  health_check {
    healthy_threshold = 2
    unhealthy_threshold = 4
    timeout = 5
    target = "HTTP:9200/"
    interval = 10
  }
}

resource "aws_autoscaling_group" "elasticsearch" {
  availability_zones = ["${aws_subnet.private.*.availability_zone}"]
  vpc_zone_identifier = ["${aws_subnet.private.*.id}"]
  name = "elasticsearch_as-${var.tier}"

  max_size = 10
  min_size = 2
  health_check_grace_period = 300
  health_check_type = "EC2"
  desired_capacity = 5
  force_delete = true
  termination_policies = ["OldestLaunchConfiguration", "OldestInstance"]
  launch_configuration = "${aws_launch_configuration.es_as_conf.name}"
  load_balancers = ["${aws_elb.es_elb.name}"]
#snip

Tosses

Errors:

  * aws_elb.es_elb: only alphanumeric characters and hyphens allowed in "name"

Short term fix is sed 's/es_elb/es-elb/g', just weird because all my other variables have _'s in them.

Terraform does inspect the value in ${aws_elb.es_elb.name}, and throws an error if theres an underscore, so that's good.

@packplusplus
Copy link
Author

I was testing this incorrectly, terraform does the right thing.

@ghost
Copy link

ghost commented Apr 30, 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 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.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
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

1 participant