将 Akamai 属性导入 Pulumi 时,输入验证失败

问题描述

按照 directions 将 Akamai 属性导入 pulumi,但运行类似 pulumi import akamai:index/property:Property example_property prp_00000,ctr_M-00000,grp_000000 的命令会出现以下验证错误

Diagnostics:
  pulumi:pulumi:Stack (akamai-import-dev):
    error: preview Failed

  akamai:index:Property (example_property):
    error: akamai:index/property:Property resource 'example_property' has a problem: ExactlyOne: "group_id": one of `group,group_id` must be specified
    error: akamai:index/property:Property resource 'example_property' has a problem: ExactlyOne: "contract_id": one of `contract,contract_id` must be specified
    error: Preview Failed: one or more inputs Failed to validate

这很奇怪,因为我在命令中指定了 property_id、contract_id 和 group_id。

解决方法

我已打开 https://github.com/pulumi/pulumi-akamai/issues/30 来解决错误本身。

作为一种解决方法,使用 https://www.pulumi.com/docs/guides/adopting/import/#pulumi-import-resource-operation 中所述的导入资源选项应该允许导入资源并避免此错误。

例如:

const example = new akamai.Property("example",{
    //  add your resource properties here
},{ 
    // run `pulumi up` with this set will import the resource,then you can remove this line on subsequent updates
    import: "prp_00000,ctr_M-00000,grp_000000" 
} );