Live data from Hacker News

Cloud Infrastructure as SQL

iasql.com

111–113 of 113 posts

Re: Cloud Infrastructure as SQL

#111
post #109

Earlier quoted context omitted.

There are two decoupled parts to IAC - describing the state you want and reconciling that with the actual state of the world. Reconciling can be advanced as you want: you could take into account SLAs, perform progressive updates, or just ignore that and remove/create resources at will. So even if you used SQL and inserted it into a database, it's just a representation of state that needs to be reconciled in a separat…

> You're not even _using_ a database to store your state, you're just using SQL to produce some graph of things you need to reconcile. Well, that's one way of doing it. The better way, imho, is to actually have a database to store the state. That also solves: > You would create all these resources, then modify them, then delete them, then create some new resources as a linear history of operations. Not good, very bri…

> Well, that's one way of doing it. The better way, imho, is to actually have a database to store the state

It doesn’t matter how the state is stored, you still need to reconcile it. So yeah you can write your target state into a database if you wish, but you need something else to compare that with the state of the actual world and progress that towards the state you requested.

> When you have an actual database backing your SQL queries, the migrations would all run in this DB, produce a final state of the DB, then this final state would get applied to bring up your system in one shot.

Yes, what you are describing is how Terraform works. Without SQL.

Except it’s never “one shot” because it’s a DAG of requirements where each resource creation can fail.

> Sure, and that's fairly easy to derive, because we already have a unique identifier, the bucket name

In this specific case, sure. But for a KMS key or in the general case, no you wouldn’t. You’d also be hard-coding provider specific information into your system - “a bucket ARN can be derived from the name attribute”. This is not always the case - consider any REST api that accepts a POST request to create something, but returns only an incrementing integer primary key to uniquely identify it.

Re: Cloud Infrastructure as SQL

#112
While there is a point in representing the state of the infrastructure as SQL to enforce type safety and other constraints, I still don’t understand what are the _real_ advantages over the current tooling. All the key advantages listed there, including type safety and cloud providers defined constraints, are already well covered by the actual battle-tested tools and frameworks.

Here are some areas where I identified some red flags regarding the present approach. These are key aspects of the everyday life of an infrastructure engineer.

Usability. The SQL abstractions simply don't scale to make the humanmachine mapping work. You would need another layer of abstraction to map that infrastructure into a state that is easily readable and understandable for our brain. On the other hand, the more consecrated tools use building blocks that both map well to be translated in infrastructure state _and_ are easily understood by our brain. Add some stored procedures to the party and you’re lost in the weeds.

Versioning. What would be the easiest way to extract from the SQL storage the difference between two versions of the infrastructure? With the traditional tools, that is an easy diff which reveals changes in a matter of several keystrokes with no extra layering.

Reusability. How easy is to port infrastructure code to other cloud providers? How easy is to define resource templates?

Re: Cloud Infrastructure as SQL

#113

Earlier quoted context omitted.

SQL is great for querying (and steampipe exists just for that reason), but the point of Terraform is to be a desired state configuration system; SQL updates would remove its best feature. You could use the database as the desired state, but then it would no longer be readable text that you can version-control. Terraform code is equivalent to the desired content of the database, and running plan generates the required…

Database migrations are equivalent to the desired content of the database, and if I'm not mistaken, Terraform state files which are the _actual_ database, are not version controlled.

Terraform state files are sort of a workaround for the fact that it's not really feasible to discover the complete state of Terraform-managed infrastructure via the APIs only because it's not always possible to have an unambiguous mapping from declared resources to real ones. The Terraform code still represents the desired state of reality, but the state is needed to track it in practice.
Post reply on HN