0

내가 가지고있는 API 엔드 포인트를 수출하는 API 게이트웨이 API 생성하는 SAM 템플릿 :에서FN :: ImportValue 확장하지

AWSTemplateFormatVersion : '2010-09-09' 
Transform: AWS::Serverless-2016-10-31 
Description: 'API Server for Skynet: AWS Management Assistant' 
Resources: 
    ApiGatewayApi: 
    Type: AWS::Serverless::Api 
    Properties: 
     DefinitionUri: swagger.yml 
     StageName: prod 
     Variables: 
     Region: !Ref AWS::Region 
     AccountId: !Ref AWS::AccountId 

Outputs: 
    ApiEndpoint: 
    Description: API Endpoint 
    Value: !Sub 
     - 'https://${ApiId}.execute-api.${AWS::Region}.amazonaws.com/prod' 
     - {ApiId: !Ref ApiGatewayApi} 
    Export: 
     Name: !Sub '${AWS::StackName}-ApiEndpoint' 

을 내 CodePipeline/CodeBuild 스택 : 나는 그것을 참조하고 있습니다 :

CodeBuildWeb: 
    Type: AWS::CodeBuild::Project 
    Properties: 
     Name: !Sub '${PipelineName}-web' 
     Artifacts: 
     Type: CODEPIPELINE 
     Environment: 
     ComputeType: BUILD_GENERAL1_SMALL 
     Image: aws/codebuild/nodejs:7.0.0 
     Type: LINUX_CONTAINER 
     EnvironmentVariables: 
      - Name: S3_BUCKET 
      Value: !Ref S3WebBucket 
      - Name: API_URL 
      Value: Fn::ImportValue 
       !Sub '${PipelineName}-server-ApiEndpoint' 
     ServiceRole: !Ref CodeBuildRole 
     Source: 
     BuildSpec: 'web/buildspec.yml' 
     Type: CODEPIPELINE 

문제는 확장되지 않고 내 코드에서 ApiEndpoint가 Fn::ImportValue !Sub '${PipelineName}-server-ApiEndpoint'으로 잘못 표시되는 것을 볼 수 있습니까?

답변

1

OK, 내 실수를 발견

- Name: API_URL 
    Value: Fn::ImportValue: 
     !Sub '${PipelineName}-server-ApiEndpoint' 

내가 추가해야을 :Fn::ImportValue

관련 문제