Search code examples
amazon-web-servicesamazon-s3terraformamazon-elastic-beanstalkterraform-provider-aws

use jar file from s3 bucket in elastic beanstalk


I am trying to create a beanstalk app. It offers to upload a file or choose a s3 bucket.

I have uploaded some jar files to a s3 bucket and want to pick the bucket instead of uploading them.

The reason I do this is that in the next step I want to do it with terraform and I don't find any configuration in terraform to upload a file directly.

My problem now is that beanstalk keeps reporting an error.

Source code is required.Source code URL must be a valid S3 location.

beanstalk menu showing s3 url and error

How can I make this work? Or is there another way I can do it later with terraform. I don't understand how to get the actual code there with the AWS provider. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_application


Solution

  • You do this using aws_elastic_beanstalk_application_version. Prior to creating that resource you have to upload your jar to s3 using aws_s3_bucket_object.