Hello. I am trying to use Lambda Layers with with externally managed code deployed separately using a CI. The problem is that when I use the deployment script to deploy the lambda layer it creates a new version thus making Terraform think it needs to change the layer version in the lambda back to the old version. I have tried using the aws_lambda_layer_version data resource which works fine for getting the latest version as long as the layer exists on AWS already but does not work for anything that hasn’t been deployed as trying to get data for something that doesn’t exist on AWS returns an error on terraform.
In short: is there a way to make terraform not try to update the version of the layer in my lambda once it’s been initially deployed.