aws_synthetics_canary resource: Add source_code_hash attribute from aws_lambda_function resource #18089
Labels
enhancement
Requests to existing resources that expand the functionality or scope.
service/synthetics
Issues and PRs that pertain to the synthetics service.
Community Note
Description
This is a feature request to add the "source_code_hash" attribute from the resource "aws_lambda_function" to the "aws_synthetics_canary" resource. AWS Synthetics canary runs a lambda to query website health.
Currently I use a data.archive_file to compress my script file for lambda. I pass the source code hash as below to the lambda so if the script file is updated the hashes don't match, it then updates the zip file and uploads the change.
depends_on = [ data.archive_file.lambda-zip ]
source_code_hash = data.archive_file.lambda-zip.output_base64sha256
The aws_synthetics_canary doesn't have the source code hash option so there's no way to tell TF that the file has changed and the canary resource is not updated when I change the source script file.
New or Affected Resource(s)
aws_synthetics_canary
Potential Terraform Configuration
References
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function
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.
This is a similar problem to #17948 - stuff from lambda that's not exposed in the Canary resource atm
The text was updated successfully, but these errors were encountered: