sst icon indicating copy to clipboard operation
sst copied to clipboard

sst.aws.Vpc.get() fails with "resource '/sst/vpc/vpc-{id}/private-key' does not exist" on deploy

Open aatecey opened this issue 1 year ago • 0 comments

sst version 3.2.70 Was attempting to spin up a stage hanging off a VPC in our dev account and have started encountering this error on deploy:

| Error KindledPrivateKey aws:ssm:Parameter | resource '/sst/vpc/vpc-{id}/private-key' does not exist

The VPC is using ec2 nats and I never enabled bastion.

export const vpc = isPermanentStage($app.stage)
  ? new sst.aws.Vpc("Kindled", {
      az: isProduction($app.stage) ? 3 : 2,
      nat: isProduction($app.stage) ? "managed" : "ec2",
      transform: {
        vpc: {
          cidrBlock: CIDR_BLOCK,
        },
      },
    })
  : sst.aws.Vpc.get("Kindled", "vpc-{id}");

Within the sst vpc component bastionInstance always is defined for me here so its goes to make a request to ssm:

    const privateKeyValue = bastionInstance.apply((v) => {
      if (!v) return;
      const param = ssm.Parameter.get(
        `${name}PrivateKey`,
        interpolate`/sst/vpc/${vpc.id}/private-key`,
        undefined,
        opts,
      );
      return param.value;
    });

Related commit: https://github.com/sst/sst/commit/fe2f41cbfb9632a3277cceb02414d1bd37fbc219

aatecey avatar Oct 30 '24 00:10 aatecey