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

Not able to create auto-scaling group with custom vpc on AWS #4801

Closed
ethicalmohit opened this issue Jun 10, 2018 · 6 comments
Closed

Not able to create auto-scaling group with custom vpc on AWS #4801

ethicalmohit opened this issue Jun 10, 2018 · 6 comments
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.

Comments

@ethicalmohit
Copy link

I was trying to spin up complete aws basic infrastructure with a launch configuration and the auto-scaling group but terraform is giving error while spinning up the autoscaling group in the custom vpc.

Terraform Version

terraform -v
Terraform v0.11.4

  • provider.aws v1.22.0

Affected Resource(s)

terraform -v
Terraform v0.11.4

  • provider.aws v1.22.0

Terraform Configuration Files

https://github.com/ethicalmohit/zox/tree/master/aws_setup

Debug Output

https://gist.github.com/ethicalmohit/ee5d1af7c526421a5517ed4d77aa3db1

Expected Behavior

It should create an autoscaling group in the same subnet which is mentioned in the vpc_zone_identifier.

Actual Behavior

It has not created any ASG.

Steps to Reproduce

Create ASG with the file mentioned in this gist : https://gist.github.com/ethicalmohit/d6e351498c6c33bb8db2d8dd0726b2f6

  1. terraform apply

Important Factoids

No

  • #0000
@radeksimko radeksimko added service/autoscaling Issues and PRs that pertain to the autoscaling service. bug Addresses a defect in current functionality. labels Jun 13, 2018
@avengers009
Copy link

avengers009 commented Jun 21, 2018

As we are creating VPC on fly we need to comment out availability zone and it works.

The AZs are defined by the AZ of the subnets and Terraform can throw “diff’s don’t match” errors when both are defined

Note: either one sould be defined not both.
vpc_zone_identifier = ["${var.subnets_id_vpc}"]
availability_zones = ["${split(",", var.availability_zones)}"]

resource "aws_autoscaling_group" "web-asg" {

       availability_zones   = ["${split(",", var.availability_zones)}"]
       name                 = "${var.Environment}-web_asg"
      .........}

please refer: https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html#availability_zones

@bflad
Copy link
Contributor

bflad commented Jun 21, 2018

@avengers009 is spot on here, commenting or removing availability_zones here should make this work as expected. The warnings about specifying both attributes are fairly recent so apologies if you ran into this before those updates happened in the documentation. Please do let us know if the documentation can be improved more though!

@bflad bflad closed this as completed Jun 21, 2018
@ketzacoatl
Copy link
Contributor

Using provider.aws: version = "~> 1.27", I am still running into the ASG failing and reporting itself. I'm using the latest AWS provider. After TF fails, I can re-run the plan/apply to get the ASG to go through just fine.

@bflad
Copy link
Contributor

bflad commented Jul 14, 2018

@ketzacoatl can you please provide your configuration and the error message? If its similar to the above, commenting/removing availability_zones when vpc_zone_identifier is already configured will fix the issue.

@ketzacoatl
Copy link
Contributor

@bflad sure, I am using the asg module seen here: https://github.com/fpco/terraform-aws-foundation/blob/master/modules/asg/main.tf

availability_zones is in use, but vpc_zone_identifier is not.

@ghost
Copy link

ghost commented Apr 4, 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 4, 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. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Projects
None yet
Development

No branches or pull requests

5 participants