provider "aws" {
  region = "us-east-1"

  default_tags {
    tags = module.default_tags.tags
  }
}

module "default_tags" {
  source             = "git@github.com:theorchard/terraform-default-tags.git//?ref=2.0.0"
  environment        = "dev"
  application_family = "devops"
  service_name       = "terraform-dynamodb-test-on-demand-no-range-key"
  team_name          = "devops"
}

module "on_demand_no_range_key" {
  source    = "../../"
  attribute = [
    { name = "primary_key", type = "S" },
    { name = "another_attribute", type = "S" },
  ]
  application_family           = "devops"
  env                          = "dev"
  table_name                   = "terraform-dynamodb-test-on-demand-no-range-key"
  use_on_demand                = true
  range_key_enabled            = false

  global_secondary_index = [
    {
      name            = "gsi-no-range-key"
      hash_key        = "another_attribute"
      projection_type = "KEYS_ONLY"
    },
    {
      name            = "gsi-with-range-key"
      hash_key        = "another_attribute"
      range_key       = "primary_key"
      projection_type = "KEYS_ONLY"
    }
  ]
}
