Linked Questions

Popular Questions

How to find the ARN of existing AWS lambda layer

Asked by At

I created a lambda layer using this script.

resource "aws_lambda_layer_version" "lambda_common_layer" {
  layer_name = "lambda_common_layer"
  s3_bucket = "${aws_s3_bucket_object.object_lambda_common_layer.bucket}"
  s3_key = "${aws_s3_bucket_object.object_lambda_common_layer.key}"
  s3_object_version = "${aws_s3_bucket_object.object_lambda_common_layer.version_id}"
  source_code_hash = "${data.archive_file.layer_zip_lambda_common_layer.output_base64sha256}"
  description = "Common layer providing logging"
  compatible_runtimes = ["python3.6"]
}

I also has a lambda definition which I want to use the layer in. To do that I need to pass a list of ARNs and I don't know how to get the ARN of existing lambda layer Those are different projects with separate Terraform scripts. How to do that ? Here is my lambda declaration

I tried to put only layer name as a resouce but it's getting highlighted

resource "aws_lambda_layer_version" "lambda_common_layer" {
layer_name = "lambda_common_layer"
}

...
  layers = ["${aws_lambda_layer_version.lambda_common_layer.layer_arn}"]

Related Questions