Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

configure should validate that all dependecies exists #75

Open
@vieiralucas

Description

@vieiralucas

Bug

If I write a layerform.json like this:

{
  "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"]
    }
  ]
}

Then run layerform configure on this file, layerform will just panic. See video below:

configure-panic.mov

Solution

We should not assume that all layer listed in dependencies array always exists, we should check if that is the case and fail with a good error message to the user.

This validation can be performed in this method:
https://github.com/ergomake/layerform/blob/a4f6211eb76c602ca5ad8f6429d0afa531499d48/internal/layerfile/layerfile.go#L37

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions