# Terraform to create lambda layer by specify arn

**URL:** <https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479>\
**Category:** Terraform\
**Created:** [January 7, 2021, 3:23pm UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479 "2021-01-07T15:23:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamednazarae](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mohamednazarae/32/16276_2.png) [@mohamednazarae](https://discuss.hashicorp.com/u/mohamednazarae)\
**Post date:** [January 7, 2021, 3:23pm UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/1 "2021-01-07T15:23:28Z")

</div>

I’m trying to use libre office lambda layer in my lambda function :

I can set this up manually from console. However, I’m not sure how to get it working in terraform. So far I have the following resource:

data “archive\_file” “converttopdf\_lambda” {  
type = “zip”  
source\_dir = “./data/converttopdf”  
output\_path = “converttopdf.zip”  
}

resource “aws\_lambda\_layer\_version” “lambda\_converttopdf\_lambda” {  
layer\_name = var.converttopdf\_layername  
filename = “${data.archive\_file.converttopdf\_lambda.output\_path}”  
}

resource “aws\_lambda\_function” “converttopdf\_lambda\_funcn” {  
filename = “{data.archive\_file.converttopdf\_lambda.output\_path}" function\_name = "copi\_{var.environment}\_converttopdf”  
role = aws\_iam\_role.role\_lambda.arn  
handler = var.converttopdf\_lambda\_handler  
runtime = var.converttopdf\_lambda\_runtime  
publish = var.converttopdf\_lambda\_publish  
timeout = var.lambdatimeout  
memory\_size = var.lambda\_memorysize  
layers = [aws\_lambda\_layer\_version.lambda\_converttopdf\_lambda.arn]  
}

Please check this image that how I created via manually.

 ![image](https://global.discourse-cdn.com/hashicorp/original/3X/7/b/7bd5aa8cc738f0b43e75851908582e48b97d6f0d.png)

please help!

---

<div class="post-metadata">

**Author:** ![pselle](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/pselle/32/1903_2.png) [@pselle](https://discuss.hashicorp.com/u/pselle)\
**Post date:** [January 7, 2021, 8:10pm UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/2 "2021-01-07T20:10:01Z")

</div>

I’m not seeing what the issue is. Are you getting an error? If so, what is that error?

The `layers =[]` declaration looks correct. What you’re doing looks correct to me from the AWS provider docs. You might also want to try (or search) the AWS provider category, where folks more familiar with that provider might help: [AWS - HashiCorp Discuss](https://discuss.hashicorp.com/c/terraform-providers/tf-aws/33)

---

<div class="post-metadata">

**Author:** ![mohamednazarae](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mohamednazarae/32/16276_2.png) [@mohamednazarae](https://discuss.hashicorp.com/u/mohamednazarae)\
**Post date:** [January 8, 2021, 5:18am UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/3 "2021-01-08T05:18:22Z")

</div>

Thanks for the response. I am not getting any error. My request is different. Hope you referred the snip in my earlier post. I want to know how I can specify ARN in “aws\_lambda\_layer\_version” resource? As per AWS Provider [docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_layer_version) I dont find any argument reference to specify the ARN. So what I am expecting now is which argument reference I have to use to specify the ARN?

I have to specify following ARN in lambda layer.

arn:aws:lambda:us-east-1:764866452798:layer:libreoffice-brotli:1

Thanks again

---

<div class="post-metadata">

**Author:** ![tbugfinder](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/tbugfinder/32/12689_2.png) [@tbugfinder](https://discuss.hashicorp.com/u/tbugfinder)\
**Post date:** [January 8, 2021, 10:47pm UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/4 "2021-01-08T22:47:48Z")

</div>

I understand that your screenshot was created during creating a new lambda function not a layer.

Do you want to create another lambda layer version which is stacked on top of the arn provided?  
Wouldn’t you rather include multiple layers within the lambda function?

---

<div class="post-metadata">

**Author:** ![mohamednazarae](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mohamednazarae/32/16276_2.png) [@mohamednazarae](https://discuss.hashicorp.com/u/mohamednazarae)\
**Post date:** [January 11, 2021, 4:11am UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/5 "2021-01-11T04:11:34Z")

</div>

No Lambda was already created, now I am trying to add layer for that Lambda that is what my screenshot looks. Ok what ever it would be is fine but my request is how to create layer by specifying another Lambda ARN through terraform?

Thanks

---

<div class="post-metadata">

**Author:** ![mohamednazarae](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mohamednazarae/32/16276_2.png) [@mohamednazarae](https://discuss.hashicorp.com/u/mohamednazarae)\
**Post date:** [January 12, 2021, 10:12am UTC](https://discuss.hashicorp.com/t/terraform-to-create-lambda-layer-by-specify-arn/19479/6 "2021-01-12T10:12:22Z")

</div>

I just found that we dont want to create new layer, just we can specify libre office ARN directly in Lambda configuration in terraform. Hence closing this.
