Skip to content

Commit

Permalink
feat: reserved IPs are now named using the service name, subnet zone …
Browse files Browse the repository at this point in the history
…and region where as previously there were always assigned a random name (#437)
  • Loading branch information
shemau committed Nov 16, 2023
1 parent 8c53528 commit 32dc9bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ The module supports the following actions:
- Create reserved IP addresses
- Attach endpoint gateways to reserved IP addresses

### Known provider issues

An IBM Provider [issue](https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4927) has been raised that impacts this module. When changing the name of reserved ip addresses for the VPE gateways, the outputs of this module may not be updated in the terraform state file. When this issue occurs, run a `terraform apply -refresh-only` to update the terraform state.

<!-- Below content is automatically populated via pre-commit hook -->
<!-- BEGIN OVERVIEW HOOK -->
## Overview
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ locals {
ip_name = "${subnet.name}-${service.service_name}-gateway-${replace(subnet.zone, "/${var.region}-/", "")}-ip"
subnet_id = subnet.id
gateway_name = service.vpe_name != null ? service.vpe_name : "${var.prefix}-${var.vpc_name}-${service.service_name}"
name = service.vpe_name != null ? "${service.vpe_name}-${replace(subnet.zone, "/${var.region}-/", "")}" : "${var.prefix}-${var.vpc_name}-${service.service_name}-${replace(subnet.zone, "/${var.region}-/", "")}"
}
],
[
Expand All @@ -45,6 +46,7 @@ locals {
ip_name = service.vpe_name != null ? "${subnet.name}-${service.vpe_name}-gateway-${replace(subnet.zone, "/${var.region}-/", "")}-ip" : "${subnet.name}-${service.service_name != null ? service.service_name : element(split(":", service.crn), 4)}-gateway-${replace(subnet.zone, "/${var.region}-/", "")}-ip"
subnet_id = subnet.id
gateway_name = service.vpe_name != null ? service.vpe_name : "${var.prefix}-${var.vpc_name}-${service.service_name != null ? service.service_name : element(split(":", service.crn), 4)}"
name = service.vpe_name != null ? "${service.vpe_name}-${replace(subnet.zone, "/${var.region}-/", "")}" : "${var.prefix}-${var.vpc_name}-${service.service_name != null ? service.service_name : element(split(":", service.crn), 4)}-${replace(subnet.zone, "/${var.region}-/", "")}"
}
])
])
Expand All @@ -69,7 +71,7 @@ resource "ibm_is_subnet_reserved_ip" "ip" {
for gateway_ip in local.endpoint_ip_list :
(gateway_ip.ip_name) => gateway_ip
}
# name # Tracked at https://github.com/terraform-ibm-modules/terraform-ibm-vpe-gateway/issues/435
name = each.value.name
subnet = each.value.subnet_id
}

Expand Down

0 comments on commit 32dc9bd

Please sign in to comment.