Amazon cloudformation 参考从以前的资源创建的arn

Amazon cloudformation 参考从以前的资源创建的arn,amazon-cloudformation,Amazon Cloudformation,我试图将从第一步创建的策略的资源arn添加到第二步。但我无法将arn从资源1转为资源2。我试过了!ref和getattr都不工作。这有什么办法吗 下面是我正在尝试执行的cloudformation模板 Parameters: AccountID: Type: 'String' Default: "123465646" Description: "account id where the resources will be c

我试图将从第一步创建的策略的资源arn添加到第二步。但我无法将arn从资源1转为资源2。我试过了!ref和getattr都不工作。这有什么办法吗

下面是我正在尝试执行的cloudformation模板

    Parameters: 
      AccountID: 
        Type: 'String'
        Default: "123465646"
        Description: "account id where the resources will be created"
    Resources:
      ssmPolicyEc2Manage: 
        Type: AWS::IAM::ManagedPolicy
        Properties: 
          Description: "This policy will be attached to EC2 running ssm agent"
          Path: "/"
          PolicyDocument: 
          Version: "2012-10-17"
          Statement: 
            - 
              Effect: "Allow"
              Action: "iam:PassRole"
              Resource: 
                  - !Join [ "", [ "arn:aws:iam::", !Ref AccountID, ":role/ssm_role_policy" ] ]

      snsPolicyRole:
        Type: AWS::IAM::Role
        Properties:    
          AssumeRolePolicyDocument: 
            Version: "2012-10-17"
            Statement:
              -
                Effect : "Allow"
                Principal:
                  Service :
                    - "ssm.amazonaws.com"
                    - "ec2.amazonaws.com"
                Action:
                    - "sts:AssumeRole"
          Path: "/"
          ManagedPolicyArns:
            - "HERE INCLUDE THE RESOURCE ARN CREATED FROM THE PREVIOUS RESOURCE I.E,ssmPolicyEc2Manage "
        DependsOn: ssmPolicyEc2Manage

谢谢你的帮助。

!Ref SSMPolic2Manage将返回资源的ARN。您可以查看以获得更好的理解。

!Ref SSMPolic2Manage将返回资源的ARN。您可以查看以更好地理解。

您是否只是尝试了
Ref:ssmpolic2manage
?你有什么特别的错误信息吗?谢谢。你的评论很有帮助。我试过了!相反,裁判只是Ref@PruthviRaj
!Ref
Ref:
是等效的。您是否只是尝试了
Ref:ssmpolic2manage
?你有什么特别的错误信息吗?谢谢。你的评论很有帮助。我试过了!相反,裁判只是Ref@PruthviRaj
!Ref
Ref:
是等效的。