AWSTemplateFormatVersion: "2010-09-09"

Description: Generate the DynamoDB tables for the price-migration-engine

Parameters:
  Stage:
    Description: Stage name
    Type: String
    AllowedValues:
      - DEV
      - CODE
      - PROD
    Default: CODE

Resources:

  CohortSpecTable:
    Type: AWS::DynamoDB::Table
    Description: Holds specification for each cohort.
    Properties:
      TableName: !Sub price-migration-engine-cohort-spec-${Stage}
      BillingMode: PAY_PER_REQUEST
      AttributeDefinitions:
        - AttributeName: cohortName
          AttributeType: S
      KeySchema:
        - AttributeName: cohortName
          KeyType: HASH
      PointInTimeRecoverySpecification:
        PointInTimeRecoveryEnabled: TRUE
      Tags:
        - Key: devx-backup-enabled
          Value: true
