{"action":"closed","issue":{"url":"https://api.github.com/repos/awslabs/serverless-application-model/issues/372","repository_url":"https://api.github.com/repos/awslabs/serverless-application-model","labels_url":"https://api.github.com/repos/awslabs/serverless-application-model/issues/372/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/serverless-application-model/issues/372/comments","events_url":"https://api.github.com/repos/awslabs/serverless-application-model/issues/372/events","html_url":"https://github.com/awslabs/serverless-application-model/issues/372","id":312134077,"node_id":"MDU6SXNzdWUzMTIxMzQwNzc=","number":372,"title":"Nested Fn::ImportValue in Fn::Sub not working for SAM template","user":{"login":"nomanyaqubny","id":6394612,"node_id":"MDQ6VXNlcjYzOTQ2MTI=","avatar_url":"https://avatars1.githubusercontent.com/u/6394612?v=4","gravatar_id":"","url":"https://api.github.com/users/nomanyaqubny","html_url":"https://github.com/nomanyaqubny","followers_url":"https://api.github.com/users/nomanyaqubny/followers","following_url":"https://api.github.com/users/nomanyaqubny/following{/other_user}","gists_url":"https://api.github.com/users/nomanyaqubny/gists{/gist_id}","starred_url":"https://api.github.com/users/nomanyaqubny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nomanyaqubny/subscriptions","organizations_url":"https://api.github.com/users/nomanyaqubny/orgs","repos_url":"https://api.github.com/users/nomanyaqubny/repos","events_url":"https://api.github.com/users/nomanyaqubny/events{/privacy}","received_events_url":"https://api.github.com/users/nomanyaqubny/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-06T22:03:48Z","updated_at":"2018-06-29T03:02:44Z","closed_at":"2018-06-29T03:02:44Z","author_association":"NONE","body":"**Description:**\r\nI am trying to define Serverless API resource. But having trouble in defining location of swagger specification file using function ImportValue.\r\n \r\n**Steps to reproduce the issue:**\r\nI am not able to define `AWS::Serverless::Api` resource having nested function `ImportValue` in Location. I have tried following three ways, none of them work.\r\n\r\nNote: Stack parameters are defined properly and export value from other stack exists. Not showing them here for brevity reason. \r\n\r\n```\r\nApiGatewayApi:\r\n    Type: AWS::Serverless::Api\r\n    Properties:\r\n        Name: !Sub ${AWS::StackName}-API\r\n        StageName: !Ref ApiGatewayStageName\r\n        DefinitionBody:\r\n          'Fn::Transform':\r\n            Name: 'AWS::Include'\r\n            Parameters:\r\n              Location:\r\n                Fn::Sub:\r\n                - s3://${BucketName}/${SwaggerSpecificationS3Key}\r\n                - BucketName:\r\n                    Fn::ImportValue:\r\n                      !Sub \"${EnvironmentName}-dist-bucket-${AWS::Region}\" \r\n```\r\n\r\n```\r\nApiGatewayApi:\r\n    Type: AWS::Serverless::Api\r\n    Properties:\r\n        Name: !Sub ${AWS::StackName}-API\r\n        StageName: !Ref ApiGatewayStageName\r\n        DefinitionBody:\r\n          'Fn::Transform':\r\n            Name: 'AWS::Include'\r\n            Parameters:\r\n              Location:\r\n                Fn::Sub:\r\n                - s3://${BucketName}/${SwaggerSpecificationS3Key}\r\n                - BucketName:\r\n                    !ImportValue 'dev-dist-bucket-us-east-1' \r\n```\r\n\r\n```\r\nApiGatewayApi:\r\n    Type: AWS::Serverless::Api\r\n    Properties:\r\n        Name: !Sub ${AWS::StackName}-API\r\n        StageName: !Ref ApiGatewayStageName\r\n        DefinitionBody:\r\n          'Fn::Transform':\r\n            Name: 'AWS::Include'\r\n            Parameters:\r\n              Location:\r\n                Fn::Sub:\r\n                - s3://${BucketName}/${SwaggerSpecificationS3Key}\r\n                - BucketName:\r\n                    Fn::ImportValue: 'dev-dist-bucket-us-east-1' \r\n```\r\n\r\nCloudformation shows following error.\r\n\r\nFAILED - The value of parameter Location under transform Include must resolve to a string, number, boolean or a list of any of these.\r\n\r\nHowever, if I do not use `ImportValue` it works with a nested `Fn::Sub`\r\n\r\n```\r\nApiGatewayApi:\r\n    Type: AWS::Serverless::Api\r\n    Properties:\r\n        Name: !Sub ${AWS::StackName}-API\r\n        StageName: !Ref ApiGatewayStageName\r\n        DefinitionBody:\r\n          'Fn::Transform':\r\n            Name: 'AWS::Include'\r\n            Parameters:\r\n              Location:\r\n                Fn::Sub:\r\n                - s3://${BucketName}/${SwaggerSpecificationS3Key}\r\n                - BucketName:\r\n                    Fn::Sub: dist-bucket-${EnvironmentName}-${AWS::Region} \r\n```\r\n\r\nIs it function ImportValue that cannot be used under function Sub?\r\n\r\nor \r\n\r\nIs it yaml format that does not support ImportValue under a Sub?"}}
{"actor":{"display_login":"brettstack"}}