-
Notifications
You must be signed in to change notification settings - Fork 1
/
dynamo.tf
37 lines (32 loc) · 902 Bytes
/
dynamo.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
resource "aws_iam_role" "dynamo_role" {
count = var.dynamo_testing ? 1 : 0
name = "dynamo_role"
managed_policy_arns = ["arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"]
assume_role_policy = data.aws_iam_policy_document.dynamo_policy.json
}
resource "aws_iam_instance_profile" "dynamo_profile" {
count = var.dynamo_testing ? 1 : 0
name = "dynamo_profile"
role = aws_iam_role.dynamo_role[count.index].name
}
data "aws_iam_policy_document" "dynamo_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
}
}
resource "aws_dynamodb_table" "basic-dynamodb-table" {
count = var.dynamo_testing ? 1 : 0
name = "usertable"
hash_key = "p"
attribute {
name = "p"
type = "S"
}
billing_mode = "PROVISIONED"
read_capacity = 1000
write_capacity = 1000
}