Honestly I like the idea of using declarative code for infra stuff because this way it becomes an inventory-like configuration language. There is a reason why YAML dominates today.
Terraform does not use YAML. And in the last updates they try to make their HCL more "programming language like". Pulumi is already there (they are using an actual programming language)
Of course Terraform does not use YAML. I mean that YAML or other approaches like HCL allow for a declarative style while maintaining some constructions like for-loops or conditionals.
Having your infrastructure in an inventory-like codebase makes it clearer to reason about. It can't go too crazy like most programs end up like
Pulumi is declarative. You can't tell Pulumi what to do, you can only tell it what you want. (Disclosure: I work on Pulumi.)
I see there's a way to not use the hosted service for storing state files, but how do you address things like locking in Pulumi?
I haven't used that scenario, but you are responsible for locking. I guess if you use S3 or something similar to store/retrieve state you can easily make it work.