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

ELB cannot be attached to multiple subnets in the same AZ #25

Closed
moesy opened this issue Feb 7, 2018 · 9 comments
Closed

ELB cannot be attached to multiple subnets in the same AZ #25

moesy opened this issue Feb 7, 2018 · 9 comments

Comments

@moesy
Copy link

moesy commented Feb 7, 2018

Current Setup:

  • VPC in us-east-1
  • private & public subnet in each availability zone

When explicitly specifying a list of availability zones through the "availability_zone" variable and subsequently defining the private subnets in those associated zones deployment through the "vpc_subnets" variable fails with the message below:

1 error(s) occurred:

* aws_elb.es_client_lb: 1 error(s) occurred:

* aws_elb.es_client_lb: InvalidConfigurationRequest: ELB cannot be attached to multiple subnets in the same AZ.
	status code: 409, request id:

This is likely due to vpc subnets being pulled automatically from the VPC and availability_zone variable not being respected. Unless it is a design feature that needs to be documented.

workaround:

  • Delete all public subnets form VPC
  • Deploy ES using terraform scripts
  • Reconfigure public subnets
@synhershko
Copy link
Member

The availability_zones variable should have been removed because we now pull this data as data. Would using those available zones work in your case or do you need to specify a subset of AZs?

@moesy
Copy link
Author

moesy commented Feb 15, 2018

@synhershko, unfortunately, the way data pulls currently it does not differentiate between public and private subnets hence the error where multiple subnets from the same AZ are being used.

@pranas
Copy link
Contributor

pranas commented Mar 28, 2018

The availability_zones variable should have been removed because we now pull this data as data.

In my case I went the opposite way and removed pulling availability_zones and subnets as data. We had subnets in our VPC I didn't want to use here so I made another var for subnets. I think this approach covers more use cases, would you merge it in if I open PR?

@synhershko
Copy link
Member

@pranas sure, how would that work though? pulling AZs via data only if no var value was specified?

@pranas
Copy link
Contributor

pranas commented Apr 9, 2018

You could do the same thing as you did with AZs here. However, I actually went the stupid simple way by just requiring putting subnets in variables. I even deleted the forementioned code and require AZs in variables as well to make things simpler.

@tomerleib
Copy link

I was able to overcome this issue with by separating it to two different sections filtered by tag, so the ELB will be created using the correct public subnets and the instances will be created in the private subnets:
data "aws_subnet_ids" "public" {
vpc_id = "${data.aws_vpc.selected.id}"
filter {
name = "tag:public"
values = [""]
}
}

data "aws_subnet_ids" "private" {
vpc_id = "${data.aws_vpc.selected.id}"
filter {
name = "tag:private"
values = [""]
}
}

@cwarny
Copy link

cwarny commented Nov 16, 2018

I'm facing this problem as well. What is the recommended workaround?

@cwarny
Copy link

cwarny commented Nov 16, 2018

@tomerleib I'm trying your workaround but could you elaborate as to how to modify the other files after implementing the change mentioned above?

@synhershko
Copy link
Member

Fixed by f776fb5

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

No branches or pull requests

5 participants