3 ms·
You can just switch from `count = 1` to `enabled = true` (or vice-versa, works back-and-forth) for a resource and tofu will automatically move it next time you
by cube2222 10mo ago
You can just switch from `count = 1` to `enabled = true` (or vice-versa, works back-and-forth) for a resource and tofu will automatically move it next time you apply.
It's pretty seamless.
- lijok 10mo agoAmazing. Good work !
- joombaga 10mo agoThat's cool! We'll still need to change all of the references to `resource[0]`, right? Or does tofu obviate that need as well?
- cube2222 10mo agoI’m not sure I understand. You refer to the conditional resource fields normally - without list indices. You just have to make sure the object isn’t null. There’s some samples in the docs[0] on safe access patterns! [0]: https://opentofu.org/docs/language/meta-arguments/enabled/ https://opentofu.org/docs/language/meta-arguments/enabled/
- darkwater 10mo agoAnd you don't get the annoying array form for the resulting resource with the `enabled` syntax, right? EDIT: Oh just realized the sibling asked the same, but the doc doesn't state that clearly, although it seems to me that the doc implies that yeah, it doesn't use the array form anymore.