sam-template.json 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {
  2. "AWSTemplateFormatVersion": "2010-09-09",
  3. "Transform": "AWS::Serverless-2016-10-31",
  4. "Description": "Slack Invite Automation",
  5. "Parameters": {
  6. "CommunityName": {
  7. "Type": "String",
  8. "Description": "Name of your Slack community (e.g., \"Example Team\")"
  9. },
  10. "SlackUrl": {
  11. "Type": "String",
  12. "Description": "URL host for your Slack community (e.g., \"exampleteam.slack.com\")"
  13. },
  14. "SlackToken": {
  15. "Type": "String",
  16. "NoEcho": true,
  17. "Description": "Slack access token"
  18. },
  19. "InviteToken": {
  20. "Type": "String",
  21. "Description": "Optional invite token"
  22. },
  23. "RecaptchaSiteKey": {
  24. "Type": "String",
  25. "Description": "Optional Recaptcha site key"
  26. },
  27. "RecaptchaSecretKey": {
  28. "Type": "String",
  29. "NoEcho": true,
  30. "Description": "Optional Recaptcha secret key"
  31. },
  32. "Locale": {
  33. "Type": "String",
  34. "Description": "Optional locale string (e.g., \"it\")"
  35. }
  36. },
  37. "Resources": {
  38. "SlackInviteApi": {
  39. "Type": "AWS::Serverless::Api",
  40. "Properties": {
  41. "DefinitionUri": "api-swagger.json",
  42. "StageName": "Api",
  43. "Variables": {
  44. "ExpressFunction": { "Ref": "ExpressFunction" }
  45. }
  46. }
  47. },
  48. "ExpressFunction": {
  49. "Type": "AWS::Serverless::Function",
  50. "Properties": {
  51. "FunctionName": { "Fn::Sub": "${AWS::StackName}-Express" },
  52. "Description": "Express API handler",
  53. "CodeUri": "build/",
  54. "Handler": "lambda.handler",
  55. "Runtime": "nodejs8.10",
  56. "MemorySize": 1024,
  57. "Timeout": 10,
  58. "Tracing": "Active",
  59. "Policies": ["AWSXrayWriteOnlyAccess"],
  60. "Environment": {
  61. "Variables": {
  62. "COMMUNITY_NAME": { "Ref": "CommunityName" },
  63. "SLACK_URL": { "Ref": "SlackUrl" },
  64. "SLACK_TOKEN": { "Ref": "SlackToken" },
  65. "INVITE_TOKEN": { "Ref": "InviteToken" },
  66. "RECAPTCHA_SITE": { "Ref": "RecaptchaSiteKey" },
  67. "RECAPTCHA_SECRET": { "Ref": "RecaptchaSecretKey" },
  68. "LOCALE": { "Ref": "Locale" }
  69. }
  70. },
  71. "Events": {
  72. "ExpressProxyApiRoot": {
  73. "Type": "Api",
  74. "Properties": {
  75. "RestApiId": { "Ref": "SlackInviteApi" },
  76. "Path": "/",
  77. "Method": "ANY"
  78. }
  79. },
  80. "ExpressProxyApiGreedy": {
  81. "Type": "Api",
  82. "Properties": {
  83. "RestApiId": { "Ref": "SlackInviteApi" },
  84. "Path": "/{proxy+}",
  85. "Method": "ANY"
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }