如何使用 Pulumi 创建 InternetGateway

how can I create InternetGateway with Pulumi

我有一个问题,当执行 pulumi up 时,我无法使用 pulumi 创建 InternetGateway。

即使我执行pulumi up,执行结果也会在上面这句话。 我的理想是(阅读)→(创造)。

代码如下。

const vpc = new aws.ec2.Vpc("custom1-vpc", {
            cidrBlock: "10.51.0.0/16",
            enableDnsHostnames: true,
            enableClassiclinkDnsSupport: true,
            instanceTenancy: "default",
            tags: {
                Name: "custom1-vpc"
            }
        });

const internatGateway = new aws.ec2.InternetGateway("custom1_gateway", {
            vpcId: vpc.id
        }, vpc);

结果如下

Do you want to perform this update? details
+ pulumi:pulumi:Stack: (create)
    [urn=urn:pulumi:pulumi-with-typescript::typescriptPulumi::pulumi:pulumi:Stack::typescriptPulumi-pulumi-with-typescript]
    + aws:ec2/vpc:Vpc: (create)
        [urn=urn:pulumi:pulumi-with-typescript::typescriptPulumi::aws:ec2/vpc:Vpc::custom1-vpc]
        assignGeneratedIpv6CidrBlock: false
        cidrBlock                   : "10.51.0.0/16"
        enableClassiclinkDnsSupport : true
        enableDnsHostnames          : true
        enableDnsSupport            : true
        instanceTenancy             : "default"
        tags                        : {
            Name      : "custom1-vpc"
        }
    > aws:ec2/internetGateway:InternetGateway: (read)
        [urn=urn:pulumi:pulumi-with-typescript::typescriptPulumi::aws:ec2/internetGateway:InternetGateway::custom1_gateway]
        vpcId: output<string>

您不应将 vpc 指定为第三个参数。只是 运行 这个:

const internatGateway = new aws.ec2.InternetGateway("custom1_gateway", {
     vpcId: vpc.id
});