terraform-provider-softlayer
terraform-provider-softlayer copied to clipboard
Global IP data source
I follow an active/standby pattern with my terraform clusters. I'm currently in need of a global ip that can be transferred between terraform clusters, depending on which one is active. I think the best way to do this is to have a global ip datasource and control the global ip lifecycle outside of terraform.
Some more thoughts on the subject:
Would it be possible to not destroy a global ip resource when the "routes_to" attribute is updated?
Since softlayer supports having a global ip that is unrouted, and my use case for using global ips requires that I'm able to re-route them to different servers as needed, it would be extremely helpful if terraform could do that routing for me, as opposed to simply destroying the resource.
Another issue is that global ips do not clean up easily. The process that cleans up global ips runs very infrequently. So if in the course of testing terraform changes, terraform creates 5 global ips, but then destroys them when it detects a change to "routes_to", then I'm stuck, because an account can't have more than 5 global ips, and while the billing item in softlayer no longer exists, softlayer still detects that there are global ips under "SoftLayer_Account/getGlobalIpRecords" and will refuse to create any more until they are cleaned up.
@tomwganem The global ip resource should already support updating the routes_to
attribute without having to destroy the resource. If that is not how it works, you should file a separate bug for it.
@tomwganem If you want to update routes_to
with terraform, you can edit the value of routes_to
in .tf
file and execute terraform apply
. If you want to update routes_to
using another system such as SL portal, you can use ignore_change
block as follows:
resource "softlayer_global_ip" "test-global-ip" {
routes_to = "X.X.X.X"
lifecycle {
ignore_changes = ["routes_to"]
}
}
Then, terraform will ignore the update even if the routes_to
is updated in SL portal. If you want to protect global IP from terraform destroy operation, you can use prevent_destroy
block. For more detail, please refer the link
Global IP cleaning up problem also happens when you cancel global IPs in SL portal menu. It is necessary to open SL ticket for this issue.