Skip to content

Commit

Permalink
fix: fix bug where floating IPs were incorrectly getting created in t…
Browse files Browse the repository at this point in the history
…he default resource group (#580)

BREAKING CHANGE: If you are upgrading to this version, and have set `enable_floating_ip` to `true`, or are passing values to the `secondary_floating_ips` list, the floating IPs are going to be deleted and recreated in the correct resource group. Please plan accordingly before upgrading incase this change will cause disruption for whatever is using the floating IPs.
  • Loading branch information
ocofaigh authored Nov 9, 2023
1 parent 30009d7 commit 6bf4256
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-07-24T10:57:54Z",
"generated_at": "2023-07-25T10:57:54Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
20 changes: 11 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,24 @@ resource "ibm_is_instance" "vsi" {
##############################################################################

resource "ibm_is_floating_ip" "vsi_fip" {
for_each = var.enable_floating_ip ? ibm_is_instance.vsi : {}
name = "${each.value.name}-fip"
target = each.value.primary_network_interface[0].id
tags = var.tags
access_tags = var.access_tags
for_each = var.enable_floating_ip ? ibm_is_instance.vsi : {}
name = "${each.value.name}-fip"
target = each.value.primary_network_interface[0].id
tags = var.tags
access_tags = var.access_tags
resource_group = var.resource_group_id
}

resource "ibm_is_floating_ip" "secondary_fip" {
for_each = length(var.secondary_floating_ips) == 0 ? {} : {
for interface in local.secondary_fip_list :
(interface.name) => interface
}
name = each.key
target = each.value.target
tags = var.tags
access_tags = var.access_tags
name = each.key
target = each.value.target
tags = var.tags
access_tags = var.access_tags
resource_group = var.resource_group_id
}

##############################################################################

0 comments on commit 6bf4256

Please sign in to comment.