【发布时间】:2020-11-08 10:56:26
【问题描述】:
我尝试构建一个 jenkins 管道,它将部署一些常见的 AWS 资源,然后将部署特定的服务资源。
这是公共资源部分,正在成功部署。
resources:
Resources:
GoatfolioUserPool:
Type: 'AWS::Cognito::UserPool'
Properties:
AccountRecoverySetting:
RecoveryMechanisms:
- Name: verified_email
Priority: 1
AutoVerifiedAttributes:
- email
EmailVerificationSubject: "GOATFOLIO - Verifique seu e-mail"
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: true
RequireNumbers: true
RequireSymbols: true
RequireUppercase: true
TemporaryPasswordValidityDays: 1
Schema:
- AttributeDataType: String
Name: email
Required: true
- AttributeDataType: String
Name: given_name
Required: true
AliasAttributes:
- email
UsernameConfiguration:
CaseSensitive: false
UserPoolName: "goatfolio"
ApiGatewayRestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Name: ApiGatewayRestApi
ApiGatewayAuthorizer:
Type: AWS::ApiGateway::Authorizer
Properties:
AuthorizerResultTtlInSeconds: 10
IdentitySource: method.request.header.Authorization
Name: GoatCognitoAuthorizer
RestApiId:
Ref: ApiGatewayRestApi
Type: COGNITO_USER_POOLS
ProviderARNs:
- {"Fn::Join": ["", ["arn:aws:cognito-idp:", {Ref: "AWS::Region"}, ":", {Ref: "AWS::AccountId"}, ":userpool/goatfolio", Ref: GoatfolioUserPool]]}
Outputs:
ApiGatewayAuthorizerOutput:
Value:
Ref: ApiGatewayAuthorizer
Export:
Name: ${self:provider.stage}-ApiGatewayAuthorizerOutput
具体部分:
functions:
getConsolidated:
handler: handlers.consolidate_investments_handler
events:
- http:
path: portfolio/
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: {'Fn::ImportValue': '${self:provider.stage}-ApiGatewayAuthorizerOutput'}
我正在尝试使用此 ImportValue,但出现此错误:
Error: The CloudFormation template is invalid: Template error: every Ref object must have a single String value.
我也尝试了其他一些方法,但没有成功。
有一种方法可以打印 ImportValue 的返回值,以便我了解发生了什么?
我做错了什么?
提前致谢。
【问题讨论】:
标签: amazon-web-services amazon-cloudformation serverless-framework serverless