gpt4 book ai didi

aws-cloudformation - 找不到自定义资源输出

转载 作者:行者123 更新时间:2023-12-03 07:39:19 24 4
gpt4 key购买 nike

我已经使用 cloudformation-cli-go-plugin 在 Go 中编写了一个自定义资源,当我尝试在堆栈中使用它时失败

Unable to retrieve Guid attribute for MyCo::CloudFormation::Workloads, with error message NotFound guid not found.

堆栈:

AWSTemplateFormatVersion: 2010-09-09
Description: Sample MyCo Workloads Template
Resources:
Resource1:
Type: 'MyCo::CloudFormation::Workloads'
Properties:
APIKey: ""
AccountID: ""
Workload: >-
workload: {entityGuids: "", name: "CloudFormationTest-Create"}
Outputs:
CustomResourceAttribute1:
Value: !GetAtt Resource1.Guid

如果我删除 Outputs 节,堆栈将成功运行,并且我可以看到创建的资源。

在本地使用 SAM 运行时,我已验证实际上总是返回 Guid。 FWIW 资源通过了所有合约测试,GuidprimaryIdentifier,并且是 readOnlyProperties

我已经尝试使用 !GetAtt 定义进行多次测试,所有这些测试都因架构错误而失败,因此看来 CF 知道资源属性的格式。

建议和/或指示将不胜感激。

最佳答案

此处的问题是由于 CloudFormation 的行为与契约(Contract)测试不同而导致读取失败。契约(Contract)测试不遵循 CloudFormation 模型规则,它们更加宽松。

契约(Contract)测试和 CloudFormation 的行为方式存在许多差异 - 通过契约(Contract)测试并不能保证 CloudFormation 兼容性。举两个例子:

  • 合约测试允许返回一个临时的primaryIdentifier,该临时primaryIdentifier可以在handler.InProgresshandler.Success之间变化
  • 合约测试将整个模型传递给所有事件。 CloudFormation 仅将 primaryIdentifier 传递给 ReadDelete

关于aws-cloudformation - 找不到自定义资源输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73717516/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com