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 Beanstalk: Crash when applying beanstalk environment creation #7740

Closed
KieranP opened this issue Jul 21, 2016 · 5 comments
Closed

AWS Beanstalk: Crash when applying beanstalk environment creation #7740

KieranP opened this issue Jul 21, 2016 · 5 comments

Comments

@KieranP
Copy link

KieranP commented Jul 21, 2016

Terraform Version

Terraform v0.6.16

Affected Resource(s)

  • aws_elastic_beanstalk_environment

Terraform Configuration Files

variable "aws_access_key" {
  description = "AWS access key"
}

variable "aws_secret_key" {
  description = "AWS secret key"
}

variable "aws_region" {
  description = "AWS region"
  default     = "us-west-2"
}

provider "aws" {
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
  region     = "${var.aws_region}"
}

resource "aws_elastic_beanstalk_application" "default" {
  name = "tf-test-beanstalk"
}

resource "aws_elastic_beanstalk_environment" "default" {
  name = "tf-test-beanstalk"
  application = "${aws_elastic_beanstalk_application.default.name}"
  solution_stack_name = "64bit Amazon Linux 2016.03 v2.1.3 running Ruby 2.3 (Passenger Standalone)"
}

Debug Output

https://gist.github.com/KieranP/555c40b23db3ce7b2773fcfcfedeaf02#file-debug-log

Panic Output

https://gist.github.com/KieranP/555c40b23db3ce7b2773fcfcfedeaf02#file-crash-log

Expected Behavior

Should spin up a new beanstalk environment and after some time, it should display as running/green in the AWS web panel.

Actual Behaviour

It creates the environment object viewable by AWS web panel, but then TF crashes with debug/panic gist output above, and the beanstalk environment remains grey after 10 minutes, a failed initialisation.

Steps to Reproduce

  1. terraform apply

Important Factoids

We removed the default VPC and instead have a custom VPC for hiding servers away from public access. This may be a factor in the failure. Within the AWS web console, the following "ERROR" lines are visible under the grey environments logs:

  1. Creating load balancer failed Reason: Default VPC not found
  2. Stack named 'awseb-e-qpxzigerip-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBLoadBalancer].

From the TF AWS Beanstalk environment docs, there isn't any configuration settings for setting a VPC, so we can't provide the VPC that we have configured.

References

Not that I could find.

@KieranP
Copy link
Author

KieranP commented Jul 21, 2016

Updated Important Factoids section to include information about our VPC setup which might be why this is failing.

@dharrisio
Copy link
Contributor

@KieranP The crash you observed here should be fixed when v0.7.0 is released. (Fixed in #7222)

I think you are correct, that the VPC info is what is causing the Beanstalk Environment to fail. The VPC settings are setup through option settings, so from your example above the environment resource would look something like this:

resource "aws_elastic_beanstalk_environment" "default" {
  name = "tf-test-beanstalk"
  application = "${aws_elastic_beanstalk_application.default.name}"
  solution_stack_name = "64bit Amazon Linux 2016.03 v2.1.3 running Ruby 2.3 (Passenger Standalone)"

  setting {
    namespace = "aws:ec2:vpc"
    name      = "VPCId"
    value     = "${var.setting_ec2_vpc_id}"
  }

  setting {
    namespace = "aws:ec2:vpc"
    name      = "ELBSubnets"
    value     = "${var.setting_ec2_vpc_elb_subnets}"
  }

  setting {
    namespace = "aws:ec2:vpc"
    name      = "Subnets"
    value     = "${var.setting_ec2_vpc_subnets}"
  }
}

This probably the most basic default setup for most people (unless they have ec2-classic/non-default vpc), so I'll update the documentation to hopefully be a little more clear on this. Most of the customization of Beanstalk Environments comes from the "option settings" , which are documented at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html.

Hope that helps!

@catsby
Copy link
Contributor

catsby commented Jul 21, 2016

Thanks for the follow up here @dharrisio ! Going to close this for now; @KieranP let us know if you're still hitting v0.7.0 is released.

Thanks!

@catsby catsby closed this as completed Jul 21, 2016
@KieranP
Copy link
Author

KieranP commented Jul 22, 2016

@dharrisio Awesome. Thank you. Tweaking those configs you gave a bit has fixed it. Perfect!

@ghost
Copy link

ghost commented Apr 24, 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 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants