diff --git a/cookiecutter.json b/cookiecutter.json index 868056f..e6ca3a5 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -2,6 +2,7 @@ "project_name": "Project Name", "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '').replace('-', '').replace('_', '') }}", "arch": ["arm64", "x86_64"], + "function_url": "y", "vpc": "n", "_copy_without_render": [ ".github/workflows/*.yml" diff --git a/{{cookiecutter.project_slug}}/serverless.yml b/{{cookiecutter.project_slug}}/serverless.yml index ddee28f..f69e64a 100644 --- a/{{cookiecutter.project_slug}}/serverless.yml +++ b/{{cookiecutter.project_slug}}/serverless.yml @@ -1,16 +1,20 @@ service: {{ cookiecutter.project_slug }} +configValidationMode: error + provider: name: aws architecture: {{ cookiecutter.arch }} deploymentMethod: direct memorySize: 128 - timeout: 30 + timeout: 20 stage: ${opt:stage, "production"} region: eu-west-2 logRetentionInDays: 30 - apiGateway: - description: "{{ cookiecutter.project_name }}" +{%- if cookiecutter.function_url != 'y' %} + httpApi: + shouldStartNameWithService: true +{%- endif %} {%- if cookiecutter.vpc == 'y' %} vpc: securityGroupIds: @@ -30,8 +34,11 @@ resources: functions: app: description: "{{ cookiecutter.project_name }} - app" +{%- if cookiecutter.function_url == 'y' %} + url: true +{%- else %} events: - - http: ANY / - - http: 'ANY /{proxy+}' + - httpApi: '*' +{%- endif %} image: uri: 253670703218.dkr.ecr.eu-west-2.amazonaws.com/${self:service}-${sls:stage}:latest