I'm trying to use a remote state reference, and ke...
# typescript
a
I'm trying to use a remote state reference, and keep getting a
index.ts(39,35): error TS2345: Argument of type '{ peerVpcId: string; filters: ({ name: string; values: string[]; } | { name: string; values: Output<string>[]; })[]; }' is not assignable to parameter of type 'GetVpcPeeringConnectionArgs'.
Copy code
const peerId = remoteState.getOutput("peerId"); // export const peerId = VpcPeeringConnection.id

let doVpcPeeringRoutes = true
try {
  aws.ec2.getVpcPeeringConnection({
      peerVpcId: "vpc-XYZ",
      filters: [
        {
          name: "status-code",
          values: ["active"],
        },
        {
          name: "vpc-peering-connection-id",
          values: [ peerId.apply(x => `${x}`) ]
        }
      ],
  })
}
catch(x) {
  doVpcPeeringRoutes = false
}
Sooo....
peerId.apply(x => console.log(x))
spits out the right string. so that's cool.
I got a tip to try using
getOutputSync
instead of getOutput, and that seems to have worked, but i'm still confused about the .apply not behaving how I'd expect.