我正在尝试使用Pulumi创建一个新的EKS集群。在其中一个步骤中,我需要使用私有子网In。当我尝试使用VPCID获取I时,它给出错误
TSError: ⨯ Unable to compile TypeScript:
index.ts(9,2): error TS2322: Type 'Output<string>' is not assignable to type 'string'.这就是我正在尝试做的事情
import * as pulumi from "@pulumi/pulumi";
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
import * as aws from "@pulumi/aws";
const vpc = aws.ec2.Vpc.get('ais-name', 'vpc-er33332');
const privateSubnet = aws.ec2.getSubnetIds({
vpcId: vpc.id,
});是我做错了吗,还是有其他方法可以做到这一点?提前谢谢你
发布于 2021-05-27 19:07:46
您可以在vpc.id上使用apply来完成此操作
const vpc = aws.ec2.Vpc.get('ais-name', 'vpc-er33332');
const privateSubnet = vpc.id.apply(
vpcId => aws.ec2.getSubnetIds({
vpcId: vpcId,
})
);https://stackoverflow.com/questions/66988895
复制相似问题