Amazon web services 从不同堆栈导入实例配置文件的值
我正在CloudFormation模板中创建InstanceProfile,并尝试导入在不同堆栈中创建的IAM角色。当我尝试启动导入IAM角色的模板时,我面临模板验证错误:Amazon web services 从不同堆栈导入实例配置文件的值,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我正在CloudFormation模板中创建InstanceProfile,并尝试导入在不同堆栈中创建的IAM角色。当我尝试启动导入IAM角色的模板时,我面临模板验证错误: Template error: the attribute in Fn::ImportValue must be a string or a function that returns a string TesRole: Description: Ec2 role Value: !Ref T
Template error: the attribute in Fn::ImportValue must be a string or a function that returns a string
TesRole:
Description: Ec2 role
Value:
!Ref TesRole
Export:
Name: !Sub "${AWS::StackName}-TesRole"
用于导入IAM角色的My CloudFormation模板片段如下所示:
InstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Path: "/"
Roles:
-
Fn::ImportValue:
!Sub "${VPCStackName}-TesRole"
TesRole:
Description: Ec2 role
Value:
!Ref TesRole
Export:
Name: !Sub "${AWS::StackName}-TesRole"
Tes角色的输出为字符串:
TesRole:
Description: Ec2 role
Value:
!Ref TesRole
Export:
Name: !Sub "${AWS::StackName}-TesRole"
输出值为StackName-teslore-MKNLV7ORDDRY
TesRole:
Description: Ec2 role
Value:
!Ref TesRole
Export:
Name: !Sub "${AWS::StackName}-TesRole"
我尝试了不同的语法,仍然得到模板验证错误。任何指导都将不胜感激。在源代码堆栈中,作为
TesRole
输出的值是多少?它是一个字符串,一个ARN,一个对象。。。?您是否可以编辑您的问题以包括源模板中具有角色和输出的部分?在源堆栈中,作为TesRole
输出的值是多少?它是一个字符串,一个ARN,一个对象。。。?您是否可以编辑问题以包括源模板中具有角色和输出的部分?
TesRole:
Description: Ec2 role
Value:
!Ref TesRole
Export:
Name: !Sub "${AWS::StackName}-TesRole"