title: Why can't I update my Lambda LayerVersion using SAM?
body: <p>When I use sam deploy to update a layer or even just re-run the SAM template I run into problems. Even if I haven't changed the actual layer, because of how SAM packages the layers CF thinks things are getting updated. That aside the error I see in the CF events looks like this:</p>
  <p><a href="https://i.stack.imgur.com/fPpQe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fPpQe.png" alt="enter image description here" /></a></p>
  <p>I set the RetentionPolicy of the layer to Retain but that doesn't seem to have the desired effect. Is there anything I can do other than delete downstream resources, or create a new stack with new names and switch all the downstream resources over to the new layers?</p>
  <p><strong>Update</strong></p>
  <p>Here's a sample from my SAM template. Is there something I should change?</p>
  <pre><code>    Resources:
        LoggingLayer:
          Type: AWS::Serverless::LayerVersion
          Properties:
            LayerName: !Ref LoggingLayerName
            Description: Hyphensolutions Logging Layer
            ContentUri: logging/
            LicenseInfo: 'MIT'
            RetentionPolicy: Retain
          Metadata:
            BuildMethod: nodejs12.x
  </code></pre>