top | item 42074914

(no title)

Longwelwind | 1 year ago

I would agree with you, if HCL wasn't a bad language in itself:

* You can't make have variables in an import block (for example, to specify a different "id" value for each workspace)

* There is no explicit way to make a resource conditional based on variables. Only a hacky way to do that using "count = foo ? 1 : 0"

* You can't have variables in the backend configuration, making it impossible to store states in different places depending on the environment.

* You can't have variables in the "ignore_changes" field of a resource, making it impossible to dynamically ignore changes for a field (for example, based on module variables).

* The VSCode extension for HCL is slow and buggy. Using TS with pulumi or TFCDK makes it possible to use all the existing tooling of the language.

discuss

order

breendreams|1 year ago

For Terraform, most of the issues with conditionals can be resolved by creating dictionaries dynamically and looping through it to generate resources.

You get the bonus of controlling the resource id and being able to selectively delete resources without worrying about ordering.

cyberpunk|1 year ago

This massively depends on your provider code. Using loops to manage tf stuff can you you into really “fun” scenarios when you want to e.g delete an openstack firewall rule from the middle of the array.

I’ve been burned so many times here that I hate all of this stuff with an extreme passion.

Crossplane seems to be a genuinely better way out but there are big gotchas there also like resources that can simply never be deleted