Skip to content

Commit

Permalink
Merge pull request #123 from alithya-oss/hotfix/existing-vpc-eip
Browse files Browse the repository at this point in the history
Fixed EIP retreival from plugin subnet on existing VPC
  • Loading branch information
z-sourcecode authored Oct 29, 2024
2 parents 8476745 + 46646a2 commit 4031f3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions iac/roots/opa-common-constructs/src/network-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,27 @@ export class NetworkConstruct extends Construct {
vpcId: props.existingVpcId,
});

// Retrieve the subnet IDs

// Retrieve the subnet IDs
// Retrieve the subnet IDs
const publicsubnetIds = vpc.publicSubnets.length > 0
? vpc.publicSubnets.map(subnet => subnet.subnetId)
: [' '];
const privateSubnetIds = vpc.privateSubnets.length > 0
? vpc.privateSubnets.map(subnet => subnet.subnetId)
: [' '];

// Retrieve Elastic IPs allocated to the existing public subnet
this.publicEIPref = [];
vpc.publicSubnets
.map((subnet) =>
(subnet as ec2.PublicSubnet).node.children
.filter((child) => child.node.id == "EIP")
.map((child) => child as ec2.CfnEIP),
)
.flat()
.forEach((eip) => {
this.publicEIPref.push(eip.ref);
});

// Store the public subnet IDs in AWS Systems Manager Parameter Store
new ssm.StringListParameter(this, `${envIdentifier}-pub-subnet-param`, {
allowedPattern: ".*",
Expand Down
2 changes: 1 addition & 1 deletion iac/roots/opa-platform/src/opa-platform-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class OPAPlatformStack extends cdk.Stack {
{
id: "AwsSolutions-SMG4",
reason:
"Rotation is not nessacry .",
"Rotation is not necessary.",
},
]);
}
Expand Down

0 comments on commit 4031f3f

Please sign in to comment.