Skip to content

Commit

Permalink
Issue 1915 - VPE reserved ips in the same VPC unique name (#1916)
Browse files Browse the repository at this point in the history
* fixed jsontotf for vpe reserved IP to add unique name

* prettier formatting + changelog

* fixed typo in changelog
  • Loading branch information
Ay1man2 authored and GitHub Enterprise committed May 10, 2024
1 parent d1d1cf9 commit 7228e5e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
### Fixes

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

## 1.15.3

Expand Down
3 changes: 2 additions & 1 deletion client/src/lib/docs/release-notes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.15.4",
"features": [],
"fixes": [
"Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`"
"Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`",
"Fixed an issue preventing Terraform from creating multiple VPEs in the same VPC"
],
"upgrade_notes": [
"Updated footer for CRAIG v2 UI",
Expand Down
18 changes: 9 additions & 9 deletions client/src/lib/json-to-iac/vpe.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ const serviceToEndpointMap = {

/**
* format reserved ip
* @param {string} vpcName
* @param {object} vpe
* @param {string} subnetName
* @returns {string} terraform formatted code
*/

function ibmIsSubnetReservedIp(vpcName, subnetName) {
function ibmIsSubnetReservedIp(vpe, subnetName) {
return {
name: `${vpcName} vpc ${subnetName} subnet vpe ip`,
name: `${vpe.vpc} vpc ${subnetName} subnet vpe ip ${vpe.name}`,
data: {
subnet: `\${module.${snakeCase(vpcName)}_vpc.${snakeCase(
subnet: `\${module.${snakeCase(vpe.vpc)}_vpc.${snakeCase(
subnetName
)}_id}`,
},
Expand All @@ -40,12 +40,12 @@ function ibmIsSubnetReservedIp(vpcName, subnetName) {

/**
* format reserved ip
* @param {string} vpcName
* @param {object} vpe
* @param {string} subnetName
* @returns {string} terraform formatted code
*/
function formatReservedIp(vpcName, subnetName) {
let ip = ibmIsSubnetReservedIp(vpcName, subnetName);
function formatReservedIp(vpe, subnetName) {
let ip = ibmIsSubnetReservedIp(vpe, subnetName);
return jsonToTfPrint(
"resource",
"ibm_is_subnet_reserved_ip",
Expand Down Expand Up @@ -139,7 +139,7 @@ function ibmIsVirtualEndpointGatewayIp(vpe, subnetName) {
),
reserved_ip: tfRef(
"ibm_is_subnet_reserved_ip",
`${vpe.vpc} vpc ${subnetName} subnet vpe ip`,
`${vpe.vpc} vpc ${subnetName} subnet vpe ip ${vpe.name}`,
"reserved_ip"
),
},
Expand Down Expand Up @@ -172,7 +172,7 @@ function vpeTf(config) {
config.virtual_private_endpoints.forEach((vpe) => {
let blockData = "";
vpe.subnets.forEach(
(subnet) => (blockData += formatReservedIp(vpe.vpc, subnet))
(subnet) => (blockData += formatReservedIp(vpe, subnet))
);
blockData += fortmatVpeGateway(vpe, config);
vpe.subnets.forEach(
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/api/craig-api.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7228e5e

Please sign in to comment.