如何修复逻辑ID上资源之间的循环依赖

时间:2019-05-29 12:53:03

标签: amazon-cloudformation serverless-framework

我试图使无服务器应用程序的构建过程自动化。设置CognitoUserPool资源时,我需要资源Ref CognitoUserPoolClient来创建一个链接,以重定向“ EmailMessage”中的客户端

但是CognitoUserPoolClient需要参考CognitoUserPool

 CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      # Generate a name based on the stage
      UserPoolName: ${self:custom.STAGE}-${self:custom.CLIENT}-user-pool
          EmailMessage: !Join
          - ''
          - - >
              You are invited to the SonderMMS platform, the world's first owned media management software. <br>
               Username: {username} <br>
               Password: {####} <br>
               Login
               <a href='
               https://${self:custom.COGNITO_DOMAIN}.auth.${self:custom.REGION}.amazoncognito.com/oauth2/authorize?&response_type=token&redirect_uri=${self:custom.URL.${self:custom.STAGE}}&client_id=
            - !Sub '#{CognitoUserPoolClient}'

            - >
              '> here </a>.
          EmailSubject: "Email Invite"


  CognitoUserPoolClient:
    Type: AWS::Cognito::UserPoolClient
    Properties:
      # Generate an app client name based on the stage
      ClientName: ${self:custom.STAGE}-${self:custom.CLIENT}-user-pool-client
      UserPoolId: !Ref CognitoUserPool
      ExplicitAuthFlows:
        - ADMIN_NO_SRP_AUTH
      GenerateSecret: false

所以我得到这个错误

  

CloudFormation模板无效:资源之间的循环依赖关系:[CognitoUserPoolClient,ApiGatewayAuthorizer,IdentityPool,SSMCognitoUserPoolClientId,IdentityPoolRoleMapping,SSMUserPoolId,ApiGatewayMethodTelstraPost,CognitoUserPool,SSMIdentityPoolId,AoleGateway4,

0 个答案:

没有答案
相关问题