terraform-aws-modules/terraform-aws-lambda

Building Dependencies Works Even if a Command Fails

p0fi opened this issue · 10 comments

p0fi commented

Description

When using the build dependencies functionality of this module via the commands array the success of any given command is not considered when running the next commands form the array.

  • ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 4.0.0

  • Terraform version:

Terraform v1.3.5
on darwin_arm64
  • Provider version(s):
+ provider registry.terraform.io/hashicorp/aws v4.45.0
+ provider registry.terraform.io/hashicorp/external v2.2.3
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.2.1

Reproduction Code [Required]

If a commands array might look like this:

commands = [
  "yarn install",
  "yarn build",
  ":zip dist/index.js ."
]

Every command is still run, no matter how the previous command exited. It does not make sense to run a build if an install failed and furthermore a zip would result in something completely different from what is expected.

Steps to reproduce the behavior:

  1. Modify the install command to make it fail.
  2. Run terraform apply

Expected behavior

Apply would fail with an error message.

Actual behavior

Apply works fine but lambda code is not working since it was not build correctly.

Terminal Output Screenshot(s)

Additional context

Noticed the problem when yarn install commands would fail in CI but the run was "successful" but lambdas didn't work.

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

p0fi commented

This is still an issue

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

p0fi commented

This is still a problem

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

p0fi commented

This is still an issue 😢

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

This issue was automatically closed because of stale in 10 days

vecchp commented

I believe this is still an issue

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.