0

I持っ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 

問題は、そのコードが展開されていない、私はFn::ImportValue !Sub '${PipelineName}-server-ApiEndpoint'ここで何が間違っているとしてApiEndpointを参照してください?

答えて

1

OK、私は私のミスを見つけた:

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

私は:

Fn::ImportValue後を追加する必要があります
関連する問題