Skip to content

Commit d6a3076

Browse files
adamcrewsaknysh
authored andcommitted
Use the latest label module to support the environment attribute (#44)
1 parent fe9370e commit d6a3076

File tree

4 files changed

+36
-25
lines changed

4 files changed

+36
-25
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,33 +193,34 @@ Available targets:
193193

194194
| Name | Description | Type | Default | Required |
195195
|------|-------------|:----:|:-----:|:-----:|
196-
| attributes | Additional attributes (e.g. `policy` or `role`) | list(string) | `<list>` | no |
196+
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
197197
| autoscale_max_read_capacity | DynamoDB autoscaling max read capacity | number | `20` | no |
198198
| autoscale_max_write_capacity | DynamoDB autoscaling max write capacity | number | `20` | no |
199199
| autoscale_min_read_capacity | DynamoDB autoscaling min read capacity | number | `5` | no |
200200
| autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | number | `5` | no |
201201
| autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | number | `50` | no |
202202
| autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | number | `50` | no |
203203
| billing_mode | DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST | string | `PROVISIONED` | no |
204-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
204+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
205205
| dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | object | `<list>` | no |
206206
| enable_autoscaler | Flag to enable/disable DynamoDB autoscaling | string | `true` | no |
207207
| enable_encryption | Enable DynamoDB server-side encryption | bool | `true` | no |
208208
| enable_point_in_time_recovery | Enable DynamoDB point in time recovery | bool | `true` | no |
209209
| enable_streams | Enable DynamoDB streams | bool | `false` | no |
210210
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
211+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
211212
| global_secondary_index_map | Additional global secondary indexes in the form of a list of mapped values | object | `<list>` | no |
212213
| hash_key | DynamoDB table Hash Key | string | - | yes |
213214
| 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 |
214215
| local_secondary_index_map | Additional local secondary indexes in the form of a list of mapped values | object | `<list>` | no |
215-
| name | Name (e.g. `app` or `cluster`) | string | - | yes |
216-
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
216+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
217+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
217218
| range_key | DynamoDB table Range Key | string | `` | no |
218219
| 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 |
219220
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
220-
| stage | Stage (e.g. `prod`, `dev`, `staging`, `infra`) | string | `` | no |
221+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
221222
| stream_view_type | When an item in the table is modified, what information is written to the stream | string | `` | no |
222-
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map(string) | `<map>` | no |
223+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `<map>` | no |
223224
| ttl_attribute | DynamoDB table TTL attribute | string | `Expires` | no |
224225

225226
## Outputs
@@ -325,7 +326,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
325326

326327
## Copyright
327328

328-
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)
329+
Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)
329330

330331

331332

docs/terraform.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22

33
| Name | Description | Type | Default | Required |
44
|------|-------------|:----:|:-----:|:-----:|
5-
| attributes | Additional attributes (e.g. `policy` or `role`) | list(string) | `<list>` | no |
5+
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
66
| autoscale_max_read_capacity | DynamoDB autoscaling max read capacity | number | `20` | no |
77
| autoscale_max_write_capacity | DynamoDB autoscaling max write capacity | number | `20` | no |
88
| autoscale_min_read_capacity | DynamoDB autoscaling min read capacity | number | `5` | no |
99
| autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | number | `5` | no |
1010
| autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | number | `50` | no |
1111
| autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | number | `50` | no |
1212
| billing_mode | DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST | string | `PROVISIONED` | no |
13-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
13+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
1414
| dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | object | `<list>` | no |
1515
| enable_autoscaler | Flag to enable/disable DynamoDB autoscaling | string | `true` | no |
1616
| enable_encryption | Enable DynamoDB server-side encryption | bool | `true` | no |
1717
| enable_point_in_time_recovery | Enable DynamoDB point in time recovery | bool | `true` | no |
1818
| enable_streams | Enable DynamoDB streams | bool | `false` | no |
1919
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
20+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
2021
| global_secondary_index_map | Additional global secondary indexes in the form of a list of mapped values | object | `<list>` | no |
2122
| hash_key | DynamoDB table Hash Key | string | - | yes |
2223
| 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 |
2324
| local_secondary_index_map | Additional local secondary indexes in the form of a list of mapped values | object | `<list>` | no |
24-
| name | Name (e.g. `app` or `cluster`) | string | - | yes |
25-
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
25+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
26+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
2627
| range_key | DynamoDB table Range Key | string | `` | no |
2728
| 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 |
2829
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
29-
| stage | Stage (e.g. `prod`, `dev`, `staging`, `infra`) | string | `` | no |
30+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
3031
| stream_view_type | When an item in the table is modified, what information is written to the stream | string | `` | no |
31-
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map(string) | `<map>` | no |
32+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `<map>` | no |
3233
| ttl_attribute | DynamoDB table TTL attribute | string | `Expires` | no |
3334

3435
## Outputs

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module "dynamodb_label" {
33
enabled = var.enabled
44
namespace = var.namespace
55
stage = var.stage
6+
environment = var.environment
67
name = var.name
78
delimiter = var.delimiter
89
attributes = var.attributes
@@ -119,10 +120,11 @@ resource "aws_dynamodb_table" "default" {
119120
}
120121

121122
module "dynamodb_autoscaler" {
122-
source = "git::https://github.com/cloudposse/terraform-aws-dynamodb-autoscaler.git?ref=tags/0.4.0"
123+
source = "git::https://github.com/cloudposse/terraform-aws-dynamodb-autoscaler.git?ref=tags/0.5.0"
123124
enabled = var.enabled && var.enable_autoscaler && var.billing_mode == "PROVISIONED"
124125
namespace = var.namespace
125126
stage = var.stage
127+
environment = var.environment
126128
name = var.name
127129
delimiter = var.delimiter
128130
attributes = var.attributes

variables.tf

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
11
variable "namespace" {
22
type = string
3-
description = "Namespace (e.g. `eg` or `cp`)"
43
default = ""
4+
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
55
}
66

7-
variable "stage" {
7+
variable "environment" {
88
type = string
9-
description = "Stage (e.g. `prod`, `dev`, `staging`, `infra`)"
109
default = ""
10+
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
1111
}
1212

13-
variable "enabled" {
14-
type = bool
15-
description = "Set to false to prevent the module from creating any resources"
16-
default = true
13+
variable "stage" {
14+
type = string
15+
default = ""
16+
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
1717
}
1818

1919
variable "name" {
2020
type = string
21-
description = "Name (e.g. `app` or `cluster`)"
21+
default = ""
22+
description = "Solution name, e.g. 'app' or 'jenkins'"
23+
}
24+
25+
variable "enabled" {
26+
type = bool
27+
default = true
28+
description = "Set to false to prevent the module from creating any resources"
2229
}
2330

2431
variable "delimiter" {
2532
type = string
2633
default = "-"
27-
description = "Delimiter to be used between `namespace`, `stage`, `name`, and `attributes`"
34+
description = "Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`"
2835
}
2936

3037
variable "attributes" {
3138
type = list(string)
3239
default = []
33-
description = "Additional attributes (e.g. `policy` or `role`)"
40+
description = "Additional attributes (e.g. `1`)"
3441
}
3542

3643
variable "tags" {
3744
type = map(string)
3845
default = {}
39-
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)"
46+
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
4047
}
4148

4249
variable "autoscale_write_target" {

0 commit comments

Comments
 (0)