1

我有一个问题,执行 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>
4

1 回答 1

2

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

const internatGateway = new aws.ec2.InternetGateway("custom1_gateway", {
     vpcId: vpc.id
});
于 2019-05-23T09:32:52.773 回答