Skip to content

Commit 2e7e68f

Browse files
update autoscaler version (cloudposse#87)
* update autoscaler version * readme updated * Auto Format Co-authored-by: cloudpossebot <[email protected]>
1 parent 62a2566 commit 2e7e68f

File tree

6 files changed

+677
-24
lines changed

6 files changed

+677
-24
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010

1111
**/.build-harness
1212
**/build-harness
13+
14+
**/.terraform.lock.hcl

examples/complete/main.tf

+56-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,66 @@ provider "aws" {
22
region = var.region
33
}
44

5-
module "dynamodb_table" {
5+
module "dynamodb_table_1" {
66
source = "../../"
77

8+
name = "first"
89
hash_key = "HashKey"
910
range_key = "RangeKey"
10-
enable_autoscaler = false
11+
enable_autoscaler = true
12+
13+
dynamodb_attributes = [
14+
{
15+
name = "DailyAverage"
16+
type = "N"
17+
},
18+
{
19+
name = "HighWater"
20+
type = "N"
21+
},
22+
{
23+
name = "Timestamp"
24+
type = "S"
25+
}
26+
]
27+
28+
local_secondary_index_map = [
29+
{
30+
name = "TimestampSortIndex"
31+
range_key = "Timestamp"
32+
projection_type = "INCLUDE"
33+
non_key_attributes = ["HashKey", "RangeKey"]
34+
},
35+
{
36+
name = "HighWaterIndex"
37+
range_key = "Timestamp"
38+
projection_type = "INCLUDE"
39+
non_key_attributes = ["HashKey", "RangeKey"]
40+
}
41+
]
42+
43+
global_secondary_index_map = [
44+
{
45+
name = "DailyAverageIndex"
46+
hash_key = "DailyAverage"
47+
range_key = "HighWater"
48+
write_capacity = 5
49+
read_capacity = 5
50+
projection_type = "INCLUDE"
51+
non_key_attributes = ["HashKey", "RangeKey"]
52+
}
53+
]
54+
55+
context = module.this.context
56+
}
57+
58+
module "dynamodb_table_2" {
59+
source = "../../"
60+
61+
name = "second"
62+
hash_key = "HashKey"
63+
range_key = "RangeKey"
64+
enable_autoscaler = true
1165

1266
dynamodb_attributes = [
1367
{

examples/complete/outputs.tf

+42-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,59 @@
1-
output "table_name" {
2-
value = module.dynamodb_table.table_name
1+
output "table_name_1" {
2+
value = module.dynamodb_table_1.table_name
33
description = "DynamoDB table name"
44
}
55

6-
output "table_id" {
7-
value = module.dynamodb_table.table_id
6+
output "table_id_1" {
7+
value = module.dynamodb_table_1.table_id
88
description = "DynamoDB table ID"
99
}
1010

11-
output "table_arn" {
12-
value = module.dynamodb_table.table_arn
11+
output "table_arn_1" {
12+
value = module.dynamodb_table_1.table_arn
1313
description = "DynamoDB table ARN"
1414
}
1515

16-
output "global_secondary_index_names" {
17-
value = module.dynamodb_table.global_secondary_index_names
16+
output "global_secondary_index_names_1" {
17+
value = module.dynamodb_table_1.global_secondary_index_names
1818
description = "DynamoDB secondary index names"
1919
}
2020

21-
output "table_stream_arn" {
22-
value = module.dynamodb_table.table_stream_arn
21+
output "table_stream_arn_1" {
22+
value = module.dynamodb_table_1.table_stream_arn
2323
description = "DynamoDB table stream ARN"
2424
}
2525

26-
output "table_stream_label" {
27-
value = module.dynamodb_table.table_stream_label
26+
output "table_stream_label_1" {
27+
value = module.dynamodb_table_1.table_stream_label
28+
description = "DynamoDB table stream label"
29+
}
30+
31+
output "table_name_2" {
32+
value = module.dynamodb_table_2.table_name
33+
description = "DynamoDB table name"
34+
}
35+
36+
output "table_id_2" {
37+
value = module.dynamodb_table_2.table_id
38+
description = "DynamoDB table ID"
39+
}
40+
41+
output "table_arn_2" {
42+
value = module.dynamodb_table_2.table_arn
43+
description = "DynamoDB table ARN"
44+
}
45+
46+
output "global_secondary_index_names_2" {
47+
value = module.dynamodb_table_2.global_secondary_index_names
48+
description = "DynamoDB secondary index names"
49+
}
50+
51+
output "table_stream_arn_2" {
52+
value = module.dynamodb_table_2.table_stream_arn
53+
description = "DynamoDB table stream ARN"
54+
}
55+
56+
output "table_stream_label_2" {
57+
value = module.dynamodb_table_2.table_stream_label
2858
description = "DynamoDB table stream label"
2959
}

test/src/examples_complete_test.go

+18-4
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,30 @@ func TestExamplesComplete(t *testing.T) {
2222
// At the end of the test, run `terraform destroy` to clean up any resources that were created
2323
defer terraform.Destroy(t, terraformOptions)
2424

25+
// This will run `terraform init` and `terraform plan` and fail the test if there are any errors
26+
terraform.InitAndPlan(t, terraformOptions)
27+
2528
// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
2629
terraform.InitAndApply(t, terraformOptions)
2730

2831
// Run `terraform output` to get the value of an output variable
29-
tableName := terraform.Output(t, terraformOptions, "table_name")
32+
tableName1 := terraform.Output(t, terraformOptions, "table_name_1")
33+
// Verify we're getting back the outputs we expect
34+
assert.Equal(t, "eg-test-first", tableName1)
35+
36+
// Run `terraform output` to get the value of an output variable
37+
tableArn1 := terraform.Output(t, terraformOptions, "table_arn_1")
3038
// Verify we're getting back the outputs we expect
31-
assert.Equal(t, "eg-test-dynamodb-table", tableName)
39+
assert.Contains(t, tableArn1, "table/eg-test-first")
3240

3341
// Run `terraform output` to get the value of an output variable
34-
tableArn := terraform.Output(t, terraformOptions, "table_arn")
42+
tableName2 := terraform.Output(t, terraformOptions, "table_name_2")
3543
// Verify we're getting back the outputs we expect
36-
assert.Contains(t, tableArn, "table/eg-test-dynamodb-table")
44+
assert.Equal(t, "eg-test-second", tableName2)
45+
46+
// Run `terraform output` to get the value of an output variable
47+
tableArn2 := terraform.Output(t, terraformOptions, "table_arn_2")
48+
// Verify we're getting back the outputs we expect
49+
assert.Contains(t, tableArn2, "table/eg-test-second")
50+
3751
}

test/src/go.mod

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ go 1.13
44

55
require (
66
github.com/aws/aws-sdk-go v1.34.7 // indirect
7-
github.com/davecgh/go-spew v1.1.1 // indirect
8-
github.com/google/uuid v1.1.1 // indirect
9-
github.com/gruntwork-io/terratest v0.16.0
10-
github.com/pquerna/otp v1.2.0 // indirect
7+
github.com/gruntwork-io/terratest v0.31.0
118
github.com/stretchr/testify v1.5.1
12-
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
13-
golang.org/x/sys v0.0.0-20190527104216-9cd6430ef91e // indirect
149
)

0 commit comments

Comments
 (0)