theappnest / terraform-monorepo-action

A GitHub action to return an array of paths to Terraform modules.
12 stars 14 forks source link

fix: mode all ignore empty path error #329

Open fr12k opened 7 months ago

fr12k commented 7 months ago

We want to use this Github action to run terraform for all modules within one Github repository except in certain folders.

- uses: fr12k/terraform-monorepo-action@master
  id: all-stacks
  with:
    mode: all
    ignore: organization/**/*

The setup from above always resulted in the following error no matter what was configured in the ignore block.

path must not be empty

It looks like the found terraform modules list contains invalid or empty paths

modules = await getAllModules(token, monitored)

This cause the used ignore library to throw the error path must not be empty.

https://github.com/kaelzhang/node-ignore/blob/49bd7fa2f1be34ed3e78995d4f6a92fa0b5033d2/index.js#L399

Solution

Remove any null, not defined or empty paths from the modules list.