tfk8s icon indicating copy to clipboard operation
tfk8s copied to clipboard

Wishlist: Support inserting dependencies

Open haegar opened this issue 3 years ago • 4 comments

Moin,

Kubernet manifests are rarely completely standalone, they often have some prerequisits to be installed before, even if it is just that the kubernetes cluster needs to be there first.

I am using the kubernetes yaml files as authitative, and regenerate the tf files using tfk8s through Makefiles whenever the yaml (or helm chart) changes.

So it would be nice to have some commandline parameter to insert depends_on = [ ... ] option lists into the generated .tf output.

Could be for example

--depends google_container_cluster.my_cluster --depends google_compute_address.ingress-ip

or

--depends google_container_cluster.my_cluster,google_compute_address.ingress-ip

Additionally it would be nice to have a parameter to make multiple manifests from one tfk8s call / input (file/stdin) sequential - meaning that the second manifest generated from one file depends on the first, the third manifest depends on the two before, etc.

haegar avatar Nov 11 '21 16:11 haegar

Could be for example

--depends google_container_cluster.my_cluster --depends google_compute_address.ingress-ip

This makes sense to me – can do.

Additionally it would be nice to have a parameter to make multiple manifests from one tfk8s call / input (file/stdin) sequential - meaning that the second manifest generated from one file depends on the first, the third manifest depends on the two before, etc.

I'm not exactly sure what you mean here. Are you proposing an option that if the YAML file contains multiple resources, each resource is a dependency of the one that comes after it in the file?

jrhouston avatar Nov 16 '21 18:11 jrhouston

Could be for example --depends google_container_cluster.my_cluster --depends google_compute_address.ingress-ip

This makes sense to me – can do. Thanks!

Additionally it would be nice to have a parameter to make multiple manifests from one tfk8s call / input (file/stdin) sequential - meaning that the second manifest generated from one file depends on the first, the third manifest depends on the two before, etc.

I'm not exactly sure what you mean here. Are you proposing an option that if the YAML file contains multiple resources, each resource is a dependency of the one that comes after it in the file?

The opposite order. When multiple resources are in one yaml file then each (after the first) has a dependency on the resource before. The second has a dependency on the first, the third on the second, the fourth on the third, and so on. (In addition to dependencies given on the commandline, which would get added to each of them)

Would make it possible from one input file for example to first create a namespace and then place objects into it, or to add a CustomResourceDefinition followed by a resource of that new type.

haegar avatar Nov 17 '21 00:11 haegar

Gotcha. Not sure what we could call the flag. --chain-depends maybe?

jrhouston avatar Nov 18 '21 05:11 jrhouston

I'm also not good with naming, but --chain-depends sounds usable to me.

haegar avatar Dec 09 '21 12:12 haegar