簡體   English   中英

使用 Pulumi Cli 導入 aws.alb.TargetGroup 時如何解決此錯誤

[英]How I can solve this error when importing aws.alb.TargetGroup using Pulumi Cli

我嘗試將現有資源導入 Pulumi。 我在我的終端上執行以下命令。

$ pulumi import aws:alb/targetGroup:TargetGroup target-group-name target-group-arn

但是我有以下錯誤。

error: internal error: Error: cannot assign expression of type tuple(cty.NullVal(cty.DynamicPseudoType)) to location of type union(list(union(object({onDeregistration = union(output(string), string, annotated(0x14001d12b40)), onUnhealthy = union(output(string), string, annotated(0x14001d12b80))}, annotated(0x14001d12b00)), output(object({onDeregistration = string, onUnhealthy = string}, annotated(0x14001d12bc0))), annotated(0x14001d12c00))), none, output(list(object({onDeregistration = string, onUnhealthy = string}, annotated(0x14001d12bc0)))), annotated(0x14001d12cc0)):

  on anonymous.pp line 22:
  23:     targetFailovers =[
  24:         null]

我無法解決這個錯誤。 請教我如何解決。 或者請教我如何從 pulumi state 生成 typescript 代碼。因為導入成功了。

附錄 我的環境是:

  • 操作系統
    • macOS 蒙特雷 v12.5
    • 平方米
  • pulumi版
    • v3.51.1
  • 哪個pulumi
    • /opt/homebrew/bin/pulumi
  • pulumi 運行時
    • 節點(打字稿)

查看文檔https://www.pulumi.com/docs/guides/adopting/import/ - 命令應如下所示:

pulumi import aws:s3/bucket:Bucket infra-logs company-infra-logs

infra-logs是您的 Pulumi 程序的資源名稱,而company-infra-logs是存儲桶名稱時。

在您的情況下,當導入目標組時,需要一個 ARN 而不是資源名稱。

我試過像這樣獲取目標組:

pulumi import aws:alb/targetGroup:TargetGroup test-tg <ARN>

它對我有用。

幾個要點供您驗證:

  1. 確保正確復制 ARN,ARN 構建如下:

    arn:aws:elasticloadbalancing::<ACCOUNT_ID>:targetgroup/<TARGET_GROUP_NAME>/

  2. 確保您的 pulumi 堆棧與您的目標群體位於同一區域

  3. 確保您的 AWS 憑據配置正確(您可能使用了錯誤的配置文件或錯誤的帳戶)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM