govuk-aws icon indicating copy to clipboard operation
govuk-aws copied to clipboard

Add a variable to set the version of the lambda to use

Open rtrinque opened this issue 5 years ago • 1 comments

Terraform doesn't behave when trying to use $LATEST, there has to be a better way to deal with this but in the meantime we have to increment the version each time we publish a new lambda.

rtrinque avatar Aug 06 '19 11:08 rtrinque

I think what you want to do is keep the $LATEST but to add a source_code_hash to the aws_lambda_function resource that is a hash of the zip ... this causes terraform to update the resource when it changes.

source_code_hash - (Optional) Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is filebase64sha256("file.zip") (Terraform 0.11.12 and later) or base64sha256(file("file.zip")) (Terraform 0.11.11 and earlier), where "file.zip" is the local filename of the lambda function source archive.

There's an example in infra-public-services / waf.tf where I had to do this previously.

chrisfarms avatar Aug 06 '19 11:08 chrisfarms

Hi, @rtrinque is this still needed or should we close this PR?

MuriloDalRi avatar Sep 28 '22 10:09 MuriloDalRi

I'm going to assume there's no value in keeping this PR, as it's three years old, has conflicts, and has minimal changes.

Please reopen if you disagree.

ChrisBAshton avatar Sep 30 '22 07:09 ChrisBAshton