Elastic Beanstalk

To deploy an application in Elastic Beanstalk, we have to create following resources

  • Elastic Beanstalk Application
  • Elastic Beanstalk Environment
  • Elastic Beanstalk Application Version

Following are the resource types in terraform configuration to provision Elastic Beanstalk in the AWS cloud.

aws_elastic_beanstalk_application” provides an Elastic Beanstalk Application resource.

aws_elastic_beanstalk_environment” provides an Elastic Beanstalk Environment resource to run the application.

aws_elastic_beanstalk_application_version” provides an Elastic Beanstalk Application Version Resource.

Example Usage :

resource "aws_elastic_beanstalk_application" "app-1" {
  name = "app-1"
}


resource "aws_elastic_beanstalk_environment" "app-1-env" {
  name = "app-1-env"
  application = "${aws_elastic_beanstalk_application.app-1.name}"
  solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
}
resource "aws_s3_bucket" "default" {
  bucket = "app-1.applicationversion.bucket"
}

resource "aws_s3_bucket_object" "default" {
  bucket = "${aws_s3_bucket.default.id}"
  key = "beanstalk/go-v1.zip"
  source = "go-v1.zip"
}

resource "aws_elastic_beanstalk_application_version" "app-1-version" {
  name = "app-1-version"
  application = "app-1"
  bucket = "${aws_s3_bucket.default.id}"
  key = "${aws_s3_bucket_object.default.id}"
}

 

Advertisements