3 ms·
I gotta say, the core argument in this article is quite weak. Here it is, quoted from the middle of the article: While the operation of checking the value
by wokwokwok 4y ago
I gotta say, the core argument in this article is quite weak.
Here it is, quoted from the middle of the article:
While the operation of checking the value of isMinikube is indeed imperative, the result is still declarative. What does this mean?
Pulumi as a tool is declarative.
It’s the language you’re using to write things that’s imperative, not Pulumi itself.
Ooo.. fighting words.
So let me get this straight, if a tool that uses an imperative language emits a declarative configuration that the tool executes, the original tool is declarative and not imperative.
…because, and this is the core argument here: at the execution step, the commands that are executed, are executed in sequence by the tool without flow control, except that which is internal to the tool itself (eg. check if s3 bucket is present, if so, don’t create it).
So, for example, if I compile source code into a assembly, and then run it… the assembly is executed step by step.
…so, my code is declarative then is it? Since the artifacts emitted by the compile step are a linear sequence of steps with no flow control other than what the compiler emits?
This is just pedantic nonsense.
Look, flat out: if you apply flow control, it is imperative.
It’s completely ridiculous to say that if you generate a declarative configuration in an imperative manner, and execute the declarative configuration, the end-to-end process is declarative.
It’s not. It’s imperative.
No amount of redefining terms is going to change that.
If you want, you could invent something called “declarative infrastructure deployment”, which is where the end user does not manually define imperative code to check the infrastructure state, and relies on the tool to check and resolve the “desired state”. You could also call it “desired state deployments”, or “cool deployments”.
The you could say, sure these tools either are or are not conforming to your definition of this type of tool.
Sure, fine. That’s easy to verify; does the tool expose primitives to express flow control in response to deployed infrastructure state explicitly? It’s a yes / no.
…but, that doesn’t make those tools declarative. They’re just “whatever term you invented here” tools. …but putting “declarative” in the name you invented doesn’t make it declarative.
Pulumi has flow control. It is imperative. QED.
- andreareina 4y agoThe tool takes in a data structure that doesn't encode any control flow. How that data structure is generated is a separate issue. I'm sure there are tools to imperatively generate whatever input Terraform needs (yaml?), does that make Terraform declarative as well? Fundamentally the model is still: this is the state I want, and Pulumi figures out how to make that happen. Just like Terraform. The specification of that state can be static, fill-in-the-blank templated, or make use of imperative logic to build the final data structure. Just like Terraform, albeit one step removed because of the yaml intermediary. Is it easier to write an imperatively-specified boondoggle of a state because of the direct access to an imperative runtime, sure. But that's against best practice and not what they're advocating here. Hell, I could hide the ternary behind a declarative interface (function) and then what's the difference between the imperative code hidden by my function and the imperative code hidden behind Pulumi's or Terraform's state evaluation and application functions?
- wokwokwok 4y agoI’m not asserting that terraform is declarative, or that pulumi and terraform are technically different. I’m saying, this article is about the pedantic definition of what it means to be declarative vs imperative. …and pedantically, if you’re partially imperative, you’re imperative. Otherwise, you’re choosing to redefine the terms to suit your convenience. Which you’re welcome to do too… but you can’t pedantically tell people they don’t know what a term means and redefine it to mean something convenient.