【发布时间】:2021-06-07 09:50:13
【问题描述】:
我正在尝试从自定义 vpc 创建 EC2 实例。我有 vpc 作为输出。但我想分配给字符串。非常感谢您在这方面的帮助。
选项 1:
const vpcId = args.network.vpc.id.apply(id => id); //type Output<string>; network extends awsx:Vpc
const mySubnet = aws.ec2.gtSubnet({
availabilityZone: 'ap-southeast-2a',
filters: [
{ name: "tag:Name", values: ["*private-0"]}
],
vpcId: vpcId; //Error: Type 'Output<string>' is not assignable to type 'string'
});
this.vm = new aws.ec2.Instance("ec2Instance", {
ami: amiId,
instanceType: instanceClass,
networkInterfaces: [{
networkInterfaceId: networkInterface.id,
deviceIndex: 0,
}]
});
选项 2:
const sg = new awsx.ec2.SecurityGroup("webserver-sg", { vpc }); //Here again I need vpcid string in the SecurityGroupArgs
【问题讨论】:
标签: pulumi