Skip to content

Commit 32dc9bd

Browse files
authored
feat: reserved IPs are now named using the service name, subnet zone and region where as previously there were always assigned a random name (#437)
1 parent 8c53528 commit 32dc9bd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ The module supports the following actions:
1313
- Create reserved IP addresses
1414
- Attach endpoint gateways to reserved IP addresses
1515

16+
### Known provider issues
17+
18+
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.
19+
1620
<!-- Below content is automatically populated via pre-commit hook -->
1721
<!-- BEGIN OVERVIEW HOOK -->
1822
## Overview

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ locals {
3737
ip_name = "${subnet.name}-${service.service_name}-gateway-${replace(subnet.zone, "/${var.region}-/", "")}-ip"
3838
subnet_id = subnet.id
3939
gateway_name = service.vpe_name != null ? service.vpe_name : "${var.prefix}-${var.vpc_name}-${service.service_name}"
40+
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}-/", "")}"
4041
}
4142
],
4243
[
@@ -45,6 +46,7 @@ locals {
4546
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"
4647
subnet_id = subnet.id
4748
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)}"
49+
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}-/", "")}"
4850
}
4951
])
5052
])
@@ -69,7 +71,7 @@ resource "ibm_is_subnet_reserved_ip" "ip" {
6971
for gateway_ip in local.endpoint_ip_list :
7072
(gateway_ip.ip_name) => gateway_ip
7173
}
72-
# name # Tracked at https://github.com/terraform-ibm-modules/terraform-ibm-vpe-gateway/issues/435
74+
name = each.value.name
7375
subnet = each.value.subnet_id
7476
}
7577

0 commit comments

Comments
 (0)