Skip to content

v1.538.1

Latest

Choose a tag to compare

@cloudposse-releaser cloudposse-releaser released this 05 Jun 16:17
a7c02ca
fix(lambda): prevent strcontains null error on zip deploys @johncblandii (#54) ## Summary
  • Fix a plan-time failure that occurred whenever the function was deployed from a zip (image_uri == null) while cicd_ssm_param_name was set.
  • Add a fast, credential-free terraform test unit suite that reproduces the regression and guards the image_uri resolution logic going forward.

Changes

  • src/main.tf: make the local.image_uri resolution null-safe. Terraform/OpenTofu's && does not short-circuit, so strcontains(var.image_uri, "%s") was evaluated even when var.image_uri was null, failing with Invalid value for "str" parameter: argument must not be null. The string fed to strcontains() now goes through an inner ternary (var.image_uri == null ? "" : var.image_uri), which does short-circuit. (Note: coalesce(var.image_uri, "") is not a valid fix here — coalesce also rejects empty strings and would error when image_uri is null.)
  • test/unit/image_uri/: new native terraform test fixture mirroring the local.image_uri logic, runnable without AWS credentials. The component itself can only be planned via the atmos/Terratest harness (it depends on account-map and remote-state modules), so this isolates the pure logic that broke.
  • test/README.md: document the integration (atmos test run) and new unit test workflows.

Testing

  • Unit tests added (test/unit/image_uri/image_uri_unit_test.tftest.hcl, 4 cases)
  • Verified the test fails against the buggy logic, reproducing the exact production error (Invalid value for "str" parameter)
  • Verified the test passes against the fix — Success! 4 passed, 0 failed
  • terraform fmt -check -recursive clean

Run the unit tests with:

```bash
terraform -chdir=test/unit/image_uri init
terraform -chdir=test/unit/image_uri test
```

Notes

Covered scenarios: zip deploy with SSM param set (the regression), templated image_uri formatted with the SSM value, static image_uri passthrough, and image_uri passthrough when no SSM param is configured.

The unit fixture mirrors the src/main.tf expression rather than executing it directly (the component can't init standalone in plain CI). Cross-reference comments in both files note they must stay in sync.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed null-value handling in image URI computation to prevent errors when certain parameters are undefined.
  • Tests

    • Added comprehensive unit tests validating image URI resolution behavior across multiple scenarios.
  • Documentation

    • Added testing layer documentation covering integration and native unit tests with setup instructions.

🤖 Automatic Updates

chore(deps): update tflint plugin terraform-linters/tflint-ruleset-aws to v0.46.0 @[renovate[bot]](https://github.com/apps/renovate) (#50) This PR contains the following updates:
Package Type Update Change
terraform-linters/tflint-ruleset-aws plugin minor 0.45.00.46.0

Release Notes

terraform-linters/tflint-ruleset-aws (terraform-linters/tflint-ruleset-aws)

v0.46.0

Compare Source

What's Changed

Enhancements
Chores

New Contributors

Full Changelog: terraform-linters/tflint-ruleset-aws@v0.45.0...v0.46.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.