3
3
4
4
[ ![ Cloud Posse] [ logo ]] ( https://cpco.io/homepage )
5
5
6
- # terraform-aws-dynamodb [ ![ Build Status] ( https://travis-ci.org/ cloudposse/terraform-aws-dynamodb.svg?branch=master )] ( https://travis-ci.org/ cloudposse/terraform-aws-dynamodb ) [ ![ Latest Release] ( https://img.shields.io/github/release/cloudposse/terraform-aws-dynamodb.svg )] ( https://github.com/cloudposse/terraform-aws-dynamodb/releases/latest ) [ ![ Slack Community] ( https://slack.cloudposse.com/badge.svg )] ( https://slack.cloudposse.com )
6
+ # terraform-aws-dynamodb [ ![ Codefresh Build Status] ( https://g.codefresh.io/api/badges/pipeline/ cloudposse/terraform-modules%2Fterraform- aws-dynamodb?type=cf-1 )] ( https://g.codefresh.io/public/accounts/ cloudposse/pipelines/5d1cdacfa7e22eb4aa7ea776 ) [ ![ Latest Release] ( https://img.shields.io/github/release/cloudposse/terraform-aws-dynamodb.svg )] ( https://github.com/cloudposse/terraform-aws-dynamodb/releases/latest ) [ ![ Slack Community] ( https://slack.cloudposse.com/badge.svg )] ( https://slack.cloudposse.com )
7
7
8
8
9
9
Terraform module to provision a DynamoDB table with autoscaling.
@@ -48,6 +48,11 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
48
48
49
49
## Usage
50
50
51
+
52
+ ** IMPORTANT:** The ` master ` branch is used in ` source ` just as an example. In your code, do not pin to ` master ` because there may be breaking changes between releases.
53
+ Instead pin to the release tag (e.g. ` ?ref=tags/x.y.z ` ) of one of our [ latest releases] ( https://github.com/cloudposse/terraform-aws-dynamodb/releases ) .
54
+
55
+
51
56
``` hcl
52
57
module "dynamodb_table" {
53
58
source = "git::https://github.com/cloudposse/terraform-aws-dynamodb.git?ref=master"
@@ -62,7 +67,7 @@ module "dynamodb_table" {
62
67
autoscale_max_read_capacity = 20
63
68
autoscale_min_write_capacity = 5
64
69
autoscale_max_write_capacity = 20
65
- enable_autoscaler = " true"
70
+ enable_autoscaler = true
66
71
}
67
72
```
68
73
@@ -84,7 +89,7 @@ module "dynamodb_table" {
84
89
autoscale_max_read_capacity = 20
85
90
autoscale_min_write_capacity = 5
86
91
autoscale_max_write_capacity = 20
87
- enable_autoscaler = " true"
92
+ enable_autoscaler = true
88
93
89
94
dynamodb_attributes = [
90
95
{
@@ -95,22 +100,26 @@ module "dynamodb_table" {
95
100
name = "HighWater"
96
101
type = "N"
97
102
},
103
+ {
104
+ name = "Timestamp"
105
+ type = "S"
106
+ }
98
107
]
99
108
100
109
local_secondary_index_map = [
101
- {
102
- name = "TimestampSortIndex"
103
- range_key = "Timestamp"
104
- projection_type = "INCLUDE"
105
- non_key_attributes = ["HashKey", "RangeKey"]
106
- },
107
- {
108
- name = "HighWaterIndex"
109
- range_key = "Timestamp"
110
- projection_type = "INCLUDE"
111
- non_key_attributes = ["HashKey", "RangeKey"]
112
- }
113
- ]
110
+ {
111
+ name = "TimestampSortIndex"
112
+ range_key = "Timestamp"
113
+ projection_type = "INCLUDE"
114
+ non_key_attributes = ["HashKey", "RangeKey"]
115
+ },
116
+ {
117
+ name = "HighWaterIndex"
118
+ range_key = "Timestamp"
119
+ projection_type = "INCLUDE"
120
+ non_key_attributes = ["HashKey", "RangeKey"]
121
+ }
122
+ ]
114
123
115
124
global_secondary_index_map = [
116
125
{
@@ -121,14 +130,7 @@ module "dynamodb_table" {
121
130
read_capacity = 5
122
131
projection_type = "INCLUDE"
123
132
non_key_attributes = ["HashKey", "RangeKey"]
124
- },
125
- {
126
- name = "HighWaterIndex"
127
- hash_key = "HighWater"
128
- write_capacity = 5
129
- read_capacity = 5
130
- projection_type = "KEYS_ONLY"
131
- },
133
+ }
132
134
]
133
135
}
134
136
```
@@ -152,32 +154,32 @@ Available targets:
152
154
153
155
| Name | Description | Type | Default | Required |
154
156
| ------| -------------| :----:| :-----:| :-----:|
155
- | attributes | Additional attributes (e.g. ` policy ` or ` role ` ) | list | ` <list> ` | no |
156
- | autoscale_max_read_capacity | DynamoDB autoscaling max read capacity | string | ` 20 ` | no |
157
- | autoscale_max_write_capacity | DynamoDB autoscaling max write capacity | string | ` 20 ` | no |
158
- | autoscale_min_read_capacity | DynamoDB autoscaling min read capacity | string | ` 5 ` | no |
159
- | autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | string | ` 5 ` | no |
160
- | autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | string | ` 50 ` | no |
161
- | autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | string | ` 50 ` | no |
157
+ | attributes | Additional attributes (e.g. ` policy ` or ` role ` ) | list(string) | ` <list> ` | no |
158
+ | autoscale_max_read_capacity | DynamoDB autoscaling max read capacity | number | ` 20 ` | no |
159
+ | autoscale_max_write_capacity | DynamoDB autoscaling max write capacity | number | ` 20 ` | no |
160
+ | autoscale_min_read_capacity | DynamoDB autoscaling min read capacity | number | ` 5 ` | no |
161
+ | autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | number | ` 5 ` | no |
162
+ | autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | number | ` 50 ` | no |
163
+ | autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | number | ` 50 ` | no |
162
164
| billing_mode | DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST | string | ` PROVISIONED ` | no |
163
165
| delimiter | Delimiter to be used between ` namespace ` , ` stage ` , ` name ` , and ` attributes ` | string | ` - ` | no |
164
- | dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | list | ` <list> ` | no |
166
+ | dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | object | ` <list> ` | no |
165
167
| enable_autoscaler | Flag to enable/disable DynamoDB autoscaling | string | ` true ` | no |
166
- | enable_encryption | Enable DynamoDB server-side encryption | string | ` true ` | no |
167
- | enable_point_in_time_recovery | Enable DynamoDB point in time recovery | string | ` true ` | no |
168
- | enable_streams | Enable DynamoDB streams | string | ` false ` | no |
169
- | enabled | Set to false to prevent the module from creating any resources | string | ` true ` | no |
170
- | global_secondary_index_map | Additional global secondary indexes in the form of a list of mapped values | list | ` <list> ` | no |
168
+ | enable_encryption | Enable DynamoDB server-side encryption | bool | ` true ` | no |
169
+ | enable_point_in_time_recovery | Enable DynamoDB point in time recovery | bool | ` true ` | no |
170
+ | enable_streams | Enable DynamoDB streams | bool | ` false ` | no |
171
+ | enabled | Set to false to prevent the module from creating any resources | bool | ` true ` | no |
172
+ | global_secondary_index_map | Additional global secondary indexes in the form of a list of mapped values | object | ` <list> ` | no |
171
173
| hash_key | DynamoDB table Hash Key | string | - | yes |
172
174
| hash_key_type | Hash Key type, which must be a scalar type: ` S ` , ` N ` , or ` B ` for (S)tring, (N)umber or (B)inary data | string | ` S ` | no |
173
- | local_secondary_index_map | Additional local secondary indexes in the form of a list of mapped values | list | ` <list> ` | no |
175
+ | local_secondary_index_map | Additional local secondary indexes in the form of a list of mapped values | object | ` <list> ` | no |
174
176
| name | Name (e.g. ` app ` or ` cluster ` ) | string | - | yes |
175
- | namespace | Namespace (e.g. ` eg ` or ` cp ` ) | string | - | yes |
177
+ | namespace | Namespace (e.g. ` eg ` or ` cp ` ) | string | `` | no |
176
178
| range_key | DynamoDB table Range Key | string | `` | no |
177
179
| range_key_type | Range Key type, which must be a scalar type: ` S ` , ` N ` , or ` B ` for (S)tring, (N)umber or (B)inary data | string | ` S ` | no |
178
- | stage | Stage (e.g. ` prod ` , ` dev ` , ` staging ` , ` infra ` ) | string | - | yes |
180
+ | stage | Stage (e.g. ` prod ` , ` dev ` , ` staging ` , ` infra ` ) | string | `` | no |
179
181
| stream_view_type | When an item in the table is modified, what information is written to the stream | string | `` | no |
180
- | tags | Additional tags (e.g. map(` BusinessUnit ` ,` XYZ ` ) | map | ` <map> ` | no |
182
+ | tags | Additional tags (e.g. map(` BusinessUnit ` ,` XYZ ` ) | map(string) | ` <map> ` | no |
181
183
| ttl_attribute | DynamoDB table TTL attribute | string | ` Expires ` | no |
182
184
183
185
## Outputs
0 commit comments