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 GitHub 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

Name Version
archive n/a
aws n/a

Modules

No modules.

Resources

Name Type
aws_dynamodb_table.dynamodb-table resource
aws_iam_role.iam_for_lambda_tf resource
aws_kms_alias.this resource
aws_kms_key.this resource
aws_lambda_event_source_mapping.lambda_sqs_trigger resource
aws_lambda_function.insert-into-dynamodb resource
aws_sqs_queue.dev-sqs resource
aws_ssm_parameter.foo resource
archive_file.lambda data source

Inputs

Name Description Type Default Required
alias n/a string "tf-cmk" no
hash_key n/a string "UserId" no
hash_key_type n/a string "S" no
key_spec n/a string "SYMMETRIC_DEFAULT" no
range_key n/a string "FullName" no
range_key_type n/a string "S" no
read_capacity n/a number 5 no
table_name n/a string n/a yes
write_capacity n/a number 5 no

Outputs

No outputs.