-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdynamo.tf
More file actions
52 lines (46 loc) · 1.18 KB
/
dynamo.tf
File metadata and controls
52 lines (46 loc) · 1.18 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# The table that stores all of the objects persisted by the Unison Cloud `State` ability.
resource "aws_dynamodb_table" "unison_cloud_byoc_state" {
name = local.dynamodb_table_name
billing_mode = "PAY_PER_REQUEST"
# productionization: set this to true
deletion_protection_enabled = false
hash_key = "K"
range_key = "NS"
# key
attribute {
name = "K"
type = "B"
}
# namespace
attribute {
name = "NS"
type = "S"
}
tags = {
Name = "cloud-byoc"
Environment = "byoc"
}
}
resource "aws_iam_policy" "byoc_container_dynamo_policy" {
description = "byoc containers need to connect to dynamodb"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:ConditionCheckItem",
"dynamodb:TransactWriteItems",
"dynamodb:PutItem",
"dynamodb:UpdateItem",
"dynamodb:DeleteItem",
"dynamodb:BatchGetItem",
"dynamodb:BatchWriteItem",
"dynamodb:Scan"
],
"Resource": [ "${aws_dynamodb_table.unison_cloud_byoc_state.arn}" ]
}
]
})
}