Compute V2: Don't fail when disassociating floating IP from the instance when it is already not associated. #761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to Compute API documentation, an attempt to remove floating IP association from an instance may fail with 409, when floating IP address was not associated with this instance initially.
This patch enables "create_before_destroy" lifecycle in
openstack_compute_floatingip_associate_v2
resource. When used together with an instance, whose lifecycle also hascreate_before_destroy
, this patch will remove downtime in a rolling update - floating IP address will be reassociated only when the new instance is completely provisioned.Without this patch, setting
create_before_destroy
in lifecycle ofopenstack_compute_floatingip_associate_v2
will cause terraform to fail. New VM will be provisioned before deleting the old one, then new floating ip address association will be created, re-assigning same floating IP address from the existing resource, but on the next step terraform will fail while trying to delete old association since it is not there anymore in OpenStack. However, there is no need to fail - resource is actually deleted, and consequent "terraform plan" will show no changes.This issue is discussed in here: https://github.com/terraform-providers/terraform-provider-openstack/issues/439