Skip to content

S3 TemplateURLs transformed to local file path #1839

@1davidmichael

Description

@1davidmichael

Description

sam build transforms TemplateURL from S3 https link to local file path. The example provided is a basic CFN template to show the output but have seen this on full SAM templates with SAM resources as well.

Steps to reproduce

Run sam build with the following example template:

---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A test CFN template

Resources:
  ExampleNestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: https://s3.amazonaws.com/examplebucket/exampletemplate.yml

Observed result

$ sam build --debug
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
'build' command is called
No Parameters detected in the template
1 resources found in the template

Build Succeeded

Built Artifacts  : .aws-sam/build
Built Template   : .aws-sam/build/template.yaml

Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Deploy: sam deploy --guided

Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 141, 'exitReason': 'success', 'exitCode': 0, 'requestId': 'a878c824-f550-4eae-8528-56d1d0595c2d', 'installationId': '320f3374-6b5d-450f-9735-ce91d16a517f', 'sessionId': '787a2613-5ee8-4d71-9ba5-0520625027b6', 'executionEnvironment': 'CLI', 'pyversion': '3.7.6', 'samcliVersion': '0.43.0'}}]}

Note that template URL is transformed to TemplateURL: ../../https:/s3.amazonaws.com/examplebucket/exampletemplate.yml in the output template in .aws-sam/build/template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A test CFN template
Resources:
  ExampleNestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: ../../https:/s3.amazonaws.com/examplebucket/exampletemplate.yml

Expected result

Expect TemplateURL for S3 paths remains untouched. Example:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A test CFN template
Resources:
  ExampleNestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: https://s3.amazonaws.com/examplebucket/exampletemplate.yml

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Amazon Linux 2 Linux ip-10-255-156-170.ec2.internal 4.14.165-131.185.amzn2.x86_64 #1 SMP Wed Jan 15 14:19:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  2. sam --version: SAM CLI, version 0.43.0 Installed via https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html instructions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions