How to rename terraform resources using the worst and the best options
ฝัง
- เผยแพร่เมื่อ 15 ก.ย. 2024
- In this episode, I tackle the different ways of renaming resources that are already created and managed by terraform. This episode shows the tree different options that I have used to go about renaming resources as a result of using a more meaningful resource name or converting flat single resources to index based.
Check out learn.pablossp... for curated list of video materials.
=================================
If you wish to support me, I have a kofi page: ko-fi/pablosspot
Really great info!
thank you
You're welcome
Option 2 seems better than having to write a moved block
100%!
@@pablosspot i was manually editing the state in a text editor before i watched this 😂
@@omirrrr oooh! I did that before and made a mistake and it was a nightmare to recover. I ended up bailing out of my state file and re-importing all my resources.
thanks, as always very interesting.
At my place we still use TF ver 0.11.5 so I have no choice but to do manual state changes and imports :/
That’s very very old. Any reason why you are not upgrading. I mean there’s things to be done before getting to version one but there’s also so much things that will make tf easier with any of the version 1 releases.
@@pablosspot it's just too large. I think they made a team which is responsible for creating mirror infrastructure for different traffic flows with the latest versions of everything. The traffic would be then redirected into that.
Upgrading everything wouldn't work as there are too many dependencies and the code is old
@@flesz_ that’s what I thought. I went through that painful process from 0.12 to 1.1. Extra difficult if you have inherited the code. But if there’s a way you can gradually upgrade, I highly recommend. There’s a number of security related features like masking secret values in state that you can benefit from at least version 1. My words are prescriptive and not imperative :)