Hi
We are using Terraform (v0.13.5 with AWS provider "hashicorp/aws v3.38.0") to deploy AWS resources into our accounts. Some of these resources are Lambda functions with Lambda layers.
We make use of certain automated processes (Gitlab pipelines) to run those deployments. We can change several Lambda functions at the same time.
We use the same Lambda layer for ALL the Lambda functions, but create different versions of that layer with different code (ZIP files) and attach each version to a concrete Lambda function.
Lately we realized that when modifying several Lambda functions at the same time, the code in the different versions of the same layer is mixed!!! So the code that should go for a concrete layer version is also appearing in other versions created at the same time.
For example:
- when we modify several Lambda functions at the same time (let's say L001 and L002), two new versions of layer MYLAY are created for each, and the corresponding version is linked to each of the modified Lambda functions. So we have L001 with MYLAY-001 and L002 with MYLAY-002. This is how we expect it, so fine so far
- Each version of the layer should have its own code (different ZIP files)
- We have detected that the code for MYLAY-001 is also appearing in MYLAY-002, even though the ZIP files used to create those versions are different!!!
So from my point of view, it seems that the way in which AWS is creating the layer versions for the same layer is not compatible with parallel creation.
Can anyone confirm of shed some light on how AWS is creating those versions?
I guess the best approach considering the previous is to use different layer for each Lambda function, indeed.
Thanks in advance and best regards
Luis