如何使用Pulumi创建InternetGateway

时间:2019-05-23 09:08:42

标签: pulumi

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

即使我执行了pulumi,执行结果也会高于句子。 我的理想是(阅读)→(创建)。

代码在后面。

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>

1 个答案:

答案 0 :(得分:0)

您不应指定vpc作为第三个参数。只需运行此:

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