layerform
layerform copied to clipboard
`configure` should validate that all `dependecies` exists
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:
https://github.com/ergomake/layerform/assets/7764293/8616e286-80d4-4194-beb3-8637e899677f
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
@vieiralucas Hi, can I work on this? Thanks
Yes @rafiramadhana, let me know if you need some guidance. Thank you in advance!