Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
vpc: fix getting existing namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Sep 18, 2024
1 parent 331445d commit 1c949c8
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions platform/src/components/aws/vpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ComponentResourceOptions, Output, all, output } from "@pulumi/pulumi";
import {
ComponentResourceOptions,
Output,
all,
interpolate,
output,
} from "@pulumi/pulumi";
import { Component, Transform, transform } from "../component";
import { Input } from "../input";
import {
Expand Down Expand Up @@ -718,7 +724,10 @@ export class Vpc extends Component implements Link.Linkable {
const natGatewayIds = subnets.map((subnet, i) =>
ec2
.getNatGatewaysOutput({
filters: [{ name: "subnet-id", values: [subnet.id] }],
filters: [
{ name: "subnet-id", values: [subnet.id] },
{ name: "state", values: ["available"] },
],
})
.ids.apply((ids) => ids[0]),
);
Expand Down Expand Up @@ -748,9 +757,14 @@ export class Vpc extends Component implements Link.Linkable {
? ec2.Instance.get(`${name}BastionInstance`, ids[0])
: undefined,
);

const namespaceId = servicediscovery.getDnsNamespaceOutput({
name: "sst",
type: "DNS_PRIVATE",
}).id;
const cloudmapNamespace = servicediscovery.PrivateDnsNamespace.get(
`${name}CloudmapNamespace`,
vpc.id,
interpolate`${namespaceId}:${vpcID}`,
);

return new Vpc(name, {
Expand Down

0 comments on commit 1c949c8

Please sign in to comment.