Skip to content

k-candidate/tf-module-dynamodb

Repository files navigation

tf-module-dynamodb

Flow chart of how this works

  • This has been made locally using localstack.
  • To deploy, you can use a file main.tf with the following content:
module "tf-module-dynamodb" {
  source        = "[email protected]:k-candidate/tf-module-dynamodb.git"
  table_name    = "tf-test"
  hash_key      = "id"
  hash_key_type = "N"
  range_key     = "name"
  alias         = "mykey"
}
  • A GHA has been put in place to generate the docs for tf below.

This a simple PoC. Possible improvements:

  • If we are given data with defined schema, Aurora Serverless v2 would be the go-to solution, but it is not available in the community version of localstack. However DynamoDB is.
  • Locally, use tfsec to scan the tf code before making the commit. Or put it in the CD flow (possible to soft or hard fail). DONE: Added Action that will comment inside PRs using tfsec's output.
  • Have a S3 bucket as backend to store the tf state.

Requirements

No requirements.

Providers

NameVersion
archiven/a
awsn/a

Modules

No modules.

Resources

NameType
aws_dynamodb_table.dynamodb-tableresource
aws_iam_role.iam_for_lambda_tfresource
aws_kms_alias.thisresource
aws_kms_key.thisresource
aws_lambda_event_source_mapping.lambda_sqs_triggerresource
aws_lambda_function.insert-into-dynamodbresource
aws_sqs_queue.dev-sqsresource
aws_ssm_parameter.fooresource
archive_file.lambdadata source

Inputs

NameDescriptionTypeDefaultRequired
aliasn/astring"tf-cmk"no
hash_keyn/astring"UserId"no
hash_key_typen/astring"S"no
key_specn/astring"SYMMETRIC_DEFAULT"no
range_keyn/astring"FullName"no
range_key_typen/astring"S"no
read_capacityn/anumber5no
table_namen/astringn/ayes
write_capacityn/anumber5no

Outputs

No outputs.