# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights served. # SPDX-License-Identifier: MIT-0 # # Permission is hereby granted, free of charge, to any person taining a copy of this # software and associated documentation files (the oftware"), to deal in the Software # without restriction, including without limitation the rights use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies the Software, and to # permit persons to whom the Software is furnished to do so. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY ND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF RCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL E AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN NNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ###################### # DynamoDB Resources # ###################### data "aws_region" "current" {} resource "aws_vpc_endpoint" "vpc_dynamodb_endpoint" { count = var.create_dynamodb_vpc_endpoint ? 1 : 0 vpc_id = var.vpc_id service_name = "com.amazonaws.${data.aws_region.current.name}.dynamodb" route_table_ids = var.route_table_ids } resource "aws_dynamodb_table" "lease_dynamodb_table" { name = join("-", [var.application_name, "LeaseTable"]) billing_mode = "PAY_PER_REQUEST" hash_key = "leaseKey" attribute { name = "leaseKey" type = "S" } point_in_time_recovery { enabled = true } server_side_encryption { enabled = true kms_key_arn = var.kms_key_arn } tags = { Name = join("-", [var.application_name, "LeaseTable"]) } }