-
Notifications
You must be signed in to change notification settings - Fork 47
Description
When attempting to use v4+ of the Spacelift EC2 module, the following error may be seen on tofu apply:
Error: reading ZIP file (ec2-workerpool-lifecycle-manager.zip):
open ec2-workerpool-lifecycle-manager.zip: no such file or directory
with module.spacelift_ec2.module.lifecycle_manager[0].aws_lambda_function.this,
on .terraform/modules/spacelift_ec2/lifecycle_manager/asg_lifecycle_manager.tf
line 22, in resource "aws_lambda_function" "this":
22: resource "aws_lambda_function" "this" {
The error occurs because of the archive_file data source used in the lifecycle_manager submodule:
terraform-aws-spacelift-workerpool-on-ec2/lifecycle_manager/asg_lifecycle_manager.tf
Lines 6 to 10 in 65107ed
| data "archive_file" "this" { | |
| type = "zip" | |
| source_file = local.lifecycle_code | |
| output_path = "ec2-workerpool-lifecycle-manager.zip" | |
| } |
The archive_file documentation explains,
The archive is built during the terraform plan, so you must persist the archive through to the terraform apply.
This seems like a similar issue to the one reported in #129 and fixed by #130/#138 - the module is assuming a local file will be present on the runner from one operation to the next, but that's not necessarily the case.
For the autoscaler zip, the module offers the option of storing the zip in S3, which can also help work around this issue. The lifecycle manager submodule doesn't offer that option.