Project: KICS (Provisioning / Security & Compliance)
File: 23edf35f-7c22-4ff9-87e6-0ca74261cfbf.md

title: BOM - AWS DynamoDB hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 23edf35f-7c22-4ff9-87e6-0ca74261cfbf Query name: BOM - AWS DynamoDB Platform: Terraform Severity: <span style="color:#CCCCCC">Trace</span> Category: Bill Of Materials URL: A list of DynamoDB resources found. Amazon DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale.<br> ```tf title="Positive test num. 1 - tf file" hl_lines="21" resource "awsvpcendpoint_policy" "example" { vpcendpointid = awsvpcendpoint.example.id policy = jsonencode({ "Version" : "2012-10-17", "Statement" : [ { "Sid" : "AllowAll", "Effect" : "Allow", "Principal" : { "AWS" : "*" }, "Action" : [ "dynamodb:*" ], "Resource" : "*" } ] }) } resource "awsdynamodbtable" "basic-dynamodb-table" { name = "GameScores" billing_mode = "PROVISIONED" read_capacity = 20 write_capacity = 20 hash_key = "UserId" range_key = "GameTitle" attribute { name = "UserId" type = "S" } attribute { name = "GameTitle" type = "S" } attribute { name = "TopScore" type = "N" } ttl { attribute_name = "TimeToExist" enabled = false } globalsecondaryindex { name = "GameTitleIndex" hash_key = "GameTitle" range_key = "TopScore" write_capacity = 10 read_capacity = 10 projection_type = "INCLUDE" nonkeyattributes = ["UserId"] } tags = { Name = "dynamodb-table-1" Environment = "production" } } ``` ```tf title="Positive test num. 2 - tf file" hl_lines="21" resource "awsvpcendpoint_policy" "example2" { vpcendpointid =

policy = jsonencode({ "Version" : "2012-10-17", "Statement" : [ { "Sid" : "AllowAll", "Effect" : "Allow", "Principal" : { "AWS" : "*" }, "Action" : [ "*" ], "Resource" : "arn:aws:dynamodb:ap-southeast-2:123412341234:table/GameScores2", } ] }) } resource "awsdynamodbtable" "example2-table" { name = "GameScores2" billing_mode = "PROVISIONED" read_capacity = 20 write_capacity = 20 hash_key = "UserId" range_key = "GameTitle" attribute { name = "UserId" type = "S" } attribute { name = "GameTitle" type = "S" } attribute { name = "TopScore" type = "N" } ttl { attribute_name = "TimeToExist" enabled = false } globalsecondaryindex { name = "GameTitleIndex" hash_key = "GameTitle" range_key = "TopScore" write_capacity = 10 read_capacity = 10 projection_type = "INCLUDE" nonkeyattributes = ["UserId"] } tags = { Name = "dynamodb-table-1" Environment = "production" } } ``` ```tf title="Positive test num. 3 - tf file" hl_lines="21" resource "awsvpcendpoint_policy" "example3" { vpcendpointid = awsvpcendpoint.example3.id policy = jsonencode({ "Version" : "2012-10-17", "Statement" : [ { "Sid" : "AllowAll", "Effect" : "Allow", "Principal" : { "AWS" : "some" }, "Action" : [ "*" ], "Resource" : "*" } ] }) } resource "awsdynamodbtable" "example3-table" { name = "GameScores3" billing_mode = "PROVISIONED" read_capacity = 20 write_capacity = 20 hash_key = "UserId" range_key = "GameTitle" attribute { name = "UserId" type = "S" } attribute { name = "GameTitle" type = "S" } attribute { name = "TopScore" type = "N" } ttl { attribute_name = "TimeToExist" enabled = false } globalsecondaryindex { name = "GameTitleIndex" hash_key = "GameTitle" range_key = "TopScore" write_capacity = 10 read_capacity = 10 projection_type = "INCLUDE" nonkeyattributes = ["UserId"] } tags = { Name = "dynamodb-table-1" Environment = "production" } } ``` <details><summary>Positive test num. 4 - tf file</summary> ```tf hl_lines="1" resource "awsdynamodbtable" "example3-table" { name = "GameScores3" billing_mode = "PROVISIONED" read_capacity = 20 write_capacity = 20 hash_key = "UserId" range_key = "GameTitle" attribute { name = "UserId" type = "S" } attribute { name = "GameTitle" type = "S" } attribute { name = "TopScore" type = "N" } ttl { attribute_name = "TimeToExist" enabled = false } globalsecondaryindex { name = "GameTitleIndex" hash_key = "GameTitle" range_key = "TopScore" write_capacity = 10 read_capacity = 10 projection_type = "INCLUDE" nonkeyattributes = ["UserId"] } sse { enabled = true } tags = { Name = "dynamodb-table-1" Environment = "production" } } ``` </details> ```tf title="Negative test num. 1 - tf file" module "s3_bucket" { source = "terraform-aws-modules/s3-bucket/aws" version = "3.7.0" bucket = "my-s3-bucket" acl = "private" versioning = { enabled = true } serversideencryption_configuration { rule { applyserversideencryptionby_default { kmsmasterkeyid = awskms_key.mykey.arn sse_algorithm = "aws:kms" } } } } ```