terraform-provider-newrelic icon indicating copy to clipboard operation
terraform-provider-newrelic copied to clipboard

Add New Relic AWS lambda layer arns

Open jpd4dazn opened this issue 4 years ago • 4 comments

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.

jpd4dazn avatar Jul 31 '20 10:07 jpd4dazn

I would like to work on this issue @kidk @jpvajda Should be straight forward by creating a data_source for nrlayers ?

Kavinraja-G avatar Jan 08 '22 12:01 Kavinraja-G

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

kidk avatar Jan 13 '22 09:01 kidk

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)
}

Kavinraja-G avatar Jan 14 '22 07:01 Kavinraja-G

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.

kidk avatar Jan 25 '22 08:01 kidk