3 ms·
Further, state-managing configuration languages lack sufficient hierarchy. Terraform providers are pretty nice but they aren't first class objects (resources)
by benlivengood 4y ago
Further, state-managing configuration languages lack sufficient hierarchy. Terraform providers are pretty nice but they aren't first class objects (resources) in the language and so dependencies between providers can fail to apply on creation (Kubernetes resources depending on a cluster created by managed resources is a common one) and there are some other weird edge-cases like dependency cycles that arise when removing or changing resources across provider version upgrades. Provider aliases help but aren't a complete solution. Similarly, providers for additional state management tools (such as Helm for k8s template management) don't have sufficient visibility into the state management of the encapsulated tool. What configuration languages need is arbitrarily deep nesting of state management with a well-defined interface to inspect and diff it from a higher level.
Most imperative programming languages aren't quite a natural fit for declarative management of resources because the general loop of how the tools work is functional evaluation of the declarative statements to instantiate the desired states of all managed resources, a reader to get the current states of managed resources, a dependency solver to help order the plans, a differ to produce a plan of what needs to be changed detect and show what will need to be changed, and finally the applicative layer to modify/create/delete managed resources by executing plans against APIs. This is a pretty functional model at every step (except perhaps plan execution, but in theory all executions should be modeled as edges on state machines of valid possible configurations and not as a spaghetti of if/then http/bash invocations) and so while it's certainly possible to implement configuration in imperative languages I think it will almost always fit functional languages a bit better.
I haven't implemented anything better than the current crop of tools, so take this with a pinch of salt I guess.