I need to create simple terraform infrastructure and part of this infrastructure needs to create AWS Lambda with java Spring Boot application as source code.
I read documentation related to lambda and looks like right now terraform can only load sources from local file or from s3 bucket. In my case I store application jar file in Nexus repository(binary storage) and want to load source code/jar during Lambda creation from Nexus too.
Based on terraform documentation it has:
text/* or application/json
and in my case I have application/java-archive
no one of this approaches solve my problem. Of cause I can create bash file that will run wget
command for jar file and then run terraform command. But this does not look pretty from my perspective.
May be you can suggest any other solutions that would be more accurate and flexible.
1. Open the Lambda section of the AWS Resources window. 2. Under Local Functions, open the context (right-click) menu for your function. 3. Choose Deploy. After deploying your function, you can run your code using the additional modules that you imported.
A common scenario with AWS Lambda is the need to use an external library in your function (AWS SDK functions are available by default) such as Axios. However Lambda will not detect and install NPM packages for you automatically if you require them in your functions.
You can get it from a Arn using the get-layer-version-by-arn function in the CLI. You can run the below command to get the source of the Lambda layer you requested.
Ready-to-upload AWS Lambda Layer packages in under 2 minutes. Using a Lambda to create layers for our Lambdas AWS Cloud services, like AWS Lambda, are a flexible way to quickly deploy data solutions. But, handling packages and related dependencies can be frustrating when deploying complex Lambda infrastructure, even if you are using Lambda Layers.
The simplest solution is the one you have already suggested - wrap terraform in a parent command that first fetches the jar file - or even just document this as a required manual step / dependency. I believe this is fairly common.
Alternatively, if you really want to be provided with something for which there is no existing provider, you can create your own Terraform provider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With