terraform-provider-newrelic
terraform-provider-newrelic copied to clipboard
Add New Relic AWS lambda layer arns
Feature Description
The serverless product provides AWS lambda layers which are exposed on an api - https://nr-layers.iopipe.com/
Currently it's a manual process to keep it in sync, the New Relic provider should expose this so it can be used when defining lambda.
I would like to work on this issue @kidk @jpvajda Should be straight forward by creating a data_source for nrlayers ?
That's awesome @Kavinraja-G
Indeed it would mean adding a new data source. If you could post your suggested data structure here first we can review before you start coding.
cc @mbazhlekova
Sure @kidk! Eventhough it's a data source -- it does involve some API calls. Currently those API / functions are not defined in the NR client. Where we need to define these APIs? Are we good to have like a helper functions for this data source in the provider itself?
I'm planning to have the data source as
data "nr_layer_arn" "example" {
region = "us-east-1"
compatible_runtime = "nodejs14.x"
compatible_architecture = "x86_64"
}
All the arguments defined in the above data source example might be required - region
is required to construct the API_URL, compatible_runtime
& compatible_architecture
is for filtering out the layer ARN from the response.
API_URL = https://<region>.layers.newrelic-external.com/get-layers?CompatibleRuntime=<compatible_runtime>
Data source attributes:
{
"compatible_architecture": "string",
"compatible_runtime": "string",
"id": "string", (computed)
"layer_arn": "string", (computed)
"layer_version": "number" (computed)
}
Thanks @Kavinraja-G
@sanderblue and @mbazhlekova do you mind reviewing? I think this is an interesting use-case that would allow us to create an end to end flow for Lambda monitoring.