I've created a canary via terraform. I'm now attempting to update the canary script via terraform. I input my script directly into the canary. I've included a null resource with a trigger that always recreates my zip file. My canary script/ lambda layer doesn't update. I'm wondering how I trigger an update to use a new script version? So far the only thing I've found to work is a terraform destroy/apply.
I'm aware of the cli update-canary command and s3 options. I'd ideally like to continue inputing my script directly into the canary.
resource "null_resource" "script-zip" {
provisioner "local-exec" {
command = <<EOT
zip -r ./recordedScript.zip nodejs/node_modules/
EOT
working_dir = path.module
}
triggers = {
always_run = "${timestamp()}"
}
}
resource "aws_synthetics_canary" "canary" {
name = var.synthetic-name
artifact_s3_location = "s3://${aws_s3_bucket.synthetics-bucket.id}"
execution_role_arn = aws_iam_role.synthetics_role.arn
handler = var.handler
zip_file = "${path.module}/recordedScript.zip"
runtime_version = var.runtime-version
start_canary = var.start-canary
depends_on = [
resource.null_resource.script-zip
]