本文介绍了为什么GetAttr在cloudformation模板参数上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在父子关系中具有cloudformation模板的集合,并希望将AWS :: IAM :: Role传递到子堆栈的参数中,并使用GetAttr获取Arn。

Have a collection of cloudformation templates in a parent-child relationship and want to pass an AWS::IAM::Role into the parameters of a child stack and use GetAttr to get the Arn.

这将使验证失败,因为只能对资源而不是参数调用GetAttr。

This fails validation because can only call GetAttr on resources, not on parameters.

任何人都知道/猜测为什么以此方式设计?

Anyone know/guess why this is designed in this way?

这不是问题,因为可以通过将Arn传递到堆栈中来解决,我很好奇

It's not a problem as it can be worked around by just passing the Arn into the stack, I'm just curious really

推荐答案

什么 Fn :: GetAttr Parameters 正在尝试在 AWS CloudFormation 中执行的操作根本不同。根据AWS文档:

What Fn::GetAttr and Parameters are trying to do in AWS CloudFormation is fundamentally different. As per AWS docs:

[1]

[2]

我相信您的困惑源于您试图从以下方面考虑这一事实:面向对象/其他编程范例,其中资源参数是某种对象,而 Fn :: GetAttr 是一个泛型函数,用于检索作为参数传入的引用的值。

I believe your confusion is stemming from the fact that you're trying to think of this in terms of the object-oriented/some other programming paradigm, where Resources and Parameters are some kind of objects and Fn::GetAttr is a generic function which retrieves the value of a reference that's passed in as an argument.

这篇关于为什么GetAttr在cloudformation模板参数上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 23:54