I am creating hosts and adding them to a network where they get their IP address. Is there a way to make that IP ‘stick’ to a given host until it’s destroyed? As it is, my machines sadly get a new IP on that same network whenever I re-apply my plan, even if no other operations are needed on them.
Hi @MWinther,
If this is possible it will be something provided by your chosen target platform rather than by Terraform.
For example, in AWS EC2 it’s possible to declare a network interface separately from any particular EC2 instance and then associate it with different EC2 instances over time. The network interface can therefore act as a private IP address reservation. You can get a similar effect with public IP addresses by using so-called “Elastic IP Addresses”.
Some other platforms have similar mechanisms but the exact details tend to differ slightly. Once you’ve found a suitable mechanism for reserving IP addresses in your chosen platform, you can then translate that into the appropriate provider resource types to declare it with Terraform.
Ah, you were right, I tried updating my provider and alas, it seems to keep from redoing the IPs now. Thanks a bunch!