News for hackers. Stuff that matters.
Re:The future of Terraform CDK by cube2222 on Wednesday December 10, 2025 @03:15PM (#46223110)
Yep, as of yesterday’s 1.11 release it’s supported!

That also includes a new “enabled” meta argument, so you don’t have to hack around conditional resources with count = 0.

[0]: https://opentofu.org/blog/opentofu-1-11-0/

Disclaimer: affiliated with the project

Re:The future of Terraform CDK by lijok on Wednesday December 10, 2025 @03:24PM (#46223239)
How do you migrate from count/for_each to `enabled` ?
Re:The future of Terraform CDK by cube2222 on Wednesday December 10, 2025 @03:33PM (#46223370)
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.

Re:The future of Terraform CDK by lijok on Wednesday December 10, 2025 @03:41PM (#46223483)
Amazing. Good work !
Re:The future of Terraform CDK by joombaga on Wednesday December 10, 2025 @04:31PM (#46224171)
That's cool! We'll still need to change all of the references to `resource[0]`, right? Or does tofu obviate that need as well?
Re:The future of Terraform CDK by cube2222 on Wednesday December 10, 2025 @05:41PM (#46224994)
I’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/

Re:The future of Terraform CDK by darkwater on Thursday December 11, 2025 @04:47AM (#46229439)
And 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.

Re:The future of Terraform CDK by cube2222 on Thursday December 11, 2025 @12:56PM (#46234681)
Yes indeed! It does not use the annoying array form.
Re:The future of Terraform CDK by darkwater on Friday December 12, 2025 @04:41AM (#46242461)
Worth switching to Opentofu only for this, then! I fuckin hate the count pattern for conditional present/not present that leads to an array of size == 1.
Re:The future of Terraform CDK by Hamuko on Wednesday December 10, 2025 @03:57PM (#46223725)
Damn, might finally be able to use it. The lack of ephemeral values was a major blocker.