Skip to content

Commit 7228e5e

Browse files
Ay1man2GitHub Enterprise
authored andcommitted
Issue 1915 - VPE reserved ips in the same VPC unique name (#1916)
* fixed jsontotf for vpe reserved IP to add unique name * prettier formatting + changelog * fixed typo in changelog
1 parent d1d1cf9 commit 7228e5e

File tree

7 files changed

+46
-30
lines changed

7 files changed

+46
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
### Fixes
1313

1414
- Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`
15+
- Fixed an issue preventing Terraform from creating multiple VPEs in the same VPC
1516

1617
## 1.15.3
1718

client/src/lib/docs/release-notes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "1.15.4",
44
"features": [],
55
"fixes": [
6-
"Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`"
6+
"Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`",
7+
"Fixed an issue preventing Terraform from creating multiple VPEs in the same VPC"
78
],
89
"upgrade_notes": [
910
"Updated footer for CRAIG v2 UI",

client/src/lib/json-to-iac/vpe.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ const serviceToEndpointMap = {
2222

2323
/**
2424
* format reserved ip
25-
* @param {string} vpcName
25+
* @param {object} vpe
2626
* @param {string} subnetName
2727
* @returns {string} terraform formatted code
2828
*/
2929

30-
function ibmIsSubnetReservedIp(vpcName, subnetName) {
30+
function ibmIsSubnetReservedIp(vpe, subnetName) {
3131
return {
32-
name: `${vpcName} vpc ${subnetName} subnet vpe ip`,
32+
name: `${vpe.vpc} vpc ${subnetName} subnet vpe ip ${vpe.name}`,
3333
data: {
34-
subnet: `\${module.${snakeCase(vpcName)}_vpc.${snakeCase(
34+
subnet: `\${module.${snakeCase(vpe.vpc)}_vpc.${snakeCase(
3535
subnetName
3636
)}_id}`,
3737
},
@@ -40,12 +40,12 @@ function ibmIsSubnetReservedIp(vpcName, subnetName) {
4040

4141
/**
4242
* format reserved ip
43-
* @param {string} vpcName
43+
* @param {object} vpe
4444
* @param {string} subnetName
4545
* @returns {string} terraform formatted code
4646
*/
47-
function formatReservedIp(vpcName, subnetName) {
48-
let ip = ibmIsSubnetReservedIp(vpcName, subnetName);
47+
function formatReservedIp(vpe, subnetName) {
48+
let ip = ibmIsSubnetReservedIp(vpe, subnetName);
4949
return jsonToTfPrint(
5050
"resource",
5151
"ibm_is_subnet_reserved_ip",
@@ -139,7 +139,7 @@ function ibmIsVirtualEndpointGatewayIp(vpe, subnetName) {
139139
),
140140
reserved_ip: tfRef(
141141
"ibm_is_subnet_reserved_ip",
142-
`${vpe.vpc} vpc ${subnetName} subnet vpe ip`,
142+
`${vpe.vpc} vpc ${subnetName} subnet vpe ip ${vpe.name}`,
143143
"reserved_ip"
144144
),
145145
},
@@ -172,7 +172,7 @@ function vpeTf(config) {
172172
config.virtual_private_endpoints.forEach((vpe) => {
173173
let blockData = "";
174174
vpe.subnets.forEach(
175-
(subnet) => (blockData += formatReservedIp(vpe.vpc, subnet))
175+
(subnet) => (blockData += formatReservedIp(vpe, subnet))
176176
);
177177
blockData += fortmatVpeGateway(vpe, config);
178178
vpe.subnets.forEach(

unit-tests/api/craig-api.test.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)