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 d251ed9..f69e64a 100644 --- a/{{cookiecutter.project_slug}}/serverless.yml +++ b/{{cookiecutter.project_slug}}/serverless.yml @@ -11,8 +11,10 @@ provider: 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: @@ -32,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