How to specify Dockerrun.aws.json to AWS using Terraform

I am trying to host a Docker application using AWS via Elastic Beanstalk. When you go through manual environment creation, I am given the option to run the sample application in the environment, load my own, or pull the application out of s3. By loading a file Dockerrun.aws.json

with all the required configuration, the framework can pull and run the Docker image.

I am now using Terraform to programmatically build and customize these environments. However, on creation, they all run the sample application, which in turn causes problems when trying to manually load the Dockerrunfile into the environment.

What is the correct way to include Dockerrun information in Terraform config so that my application can deploy without crashing?

+3


source to share


1 answer


You must use an S3 bucket for storage Dockerrun.aws.json

and set up a version of the Beanstalk application.

Something like:

resource "aws_elastic_beanstalk_application_version" "latest" {
  name        = "latest"
  application = "your_app"
  bucket      = "your_bucket"
  key         = "Dockerrun.aws.json"
}

      



Then add to the Beanstalk environment:

version_label = "${aws_elastic_beanstalk_application_version.latest.name}"

      

It is of course better to use links instead of hardcoding names.

0


source







All Articles