layerform icon indicating copy to clipboard operation
layerform copied to clipboard

Validate if all layers dependencies exist

Open rafiramadhana opened this issue 9 months ago • 0 comments

Why this matters

Resolves #75

Solution

Validate that all layers[*].dependencies exist.

How to test it

Run make test.

Otherwise, we can also reproduce the issue by doing what mentioned in #75.

Here is the result in my local using a similar layerform.json

➜  layerform git:(75-validate-all-dep-exist) ✗ cat layerform.json
{
  "layers": [
    {
      "name": "foo",
      "files": ["foo.tf"]
    },
    {
      "name"  : "bar",
      "files": ["bar.tf"],
      "dependencies": ["foo", "this_layer_does_not_exist"]
    },
    {
      "name"  : "baz",
      "files": ["baz.tf"],
      "dependencies": ["foo"]
    }
  ]
}%                                                                                                                                                                                                                                                                                                                                  
➜  layerform git:(75-validate-all-dep-exist) ✗ ./layerform configure --file layerform.json
✗ Loading layer definitions from "layerform.json"
fail to load layers from layerform layers definitions file: fail to validate layers dependencies: this_layer_does_not_exist: dependency does not exist

Note to reviewers

rafiramadhana avatar Sep 20 '23 17:09 rafiramadhana