AWSTemplateFormatVersion: '2010-09-09'
Description: Creates required S3 buckets.
Parameters:
  EnvironmentName:
    Description: An environment name that is prefixed to resource names
    Type: String

Resources:
  DeploymentBucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: !Sub heisenberg-serverless-deployments-${EnvironmentName}
  FrontendBucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: !Sub heisenberg-frontend-${EnvironmentName}
  PrescriptionBucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: !Sub heisenberg-prescriptions-${EnvironmentName}
      CorsConfiguration:
        CorsRules:
          - AllowedHeaders:
              - '*'
            AllowedMethods:
              - GET
              - PUT
              - POST
              - HEAD
            AllowedOrigins:
              - '*'