【发布时间】:2021-06-07 01:34:49
【问题描述】:
在一个 Cloudformation 模板中,我创建了以下角色:
CRMPiccoRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub 'crm-${Environment}-register'
在另一个 EC2 实例的 Cloudformation 模板中,我尝试将该角色附加到我的 EC2 实例,但是我不确定如何引用 动态 角色名称。
Resources:
InstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Path: /
Roles:
- !Ref 'crm-${Environment}-register'
这个可以吗?
当我尝试验证模板时出现错误:
调用 ValidateTemplate 时发生错误 (ValidationError) 操作:模板格式错误:未解决的资源依赖关系 [crm-${Environment}-register] 在模板的 Resources 块中
【问题讨论】:
标签: amazon-web-services amazon-ec2 amazon-cloudformation amazon-iam iaas