I have created a module that creates for me, among other resources, a DigitalOcean droplet with user_data for cloud-init.
The issue is, when I change the user data, it forces the droplet to be recreated. The user data contains some configurations that ensure better security for the droplet, so it’s important to me that it is applied as soon as possible, hence there’s no better way than cloud-init IMO.
I have thought about creating an image with these configurations already in place, but it would increase the cost of my infrastructure, and since these are for my personal stuff, it’s not desirable.
Is it possible to exclude the user data from the state?
Are there any other, better approaches you could recommend?