Skip to content

Ensure lifecycle manager zip is present on disk #175

@br3ndonland

Description

@br3ndonland

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions