Skip to content

Commit da8207c

Browse files
committed
initial version
0 parents  commit da8207c

File tree

5 files changed

+139
-0
lines changed

5 files changed

+139
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 devops-made-easy
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# terraform-aws-dax
2+
3+
# Sample way of calling this module
4+
5+
```
6+
module "dax" {
7+
source = "[email protected]:devops-made-easy/terraform-aws-dax.git"
8+
version = "0.0.1"
9+
iam_role_arn = "iam_arn"
10+
name = "devops-made-easy-dax"
11+
node_count = 1
12+
node_type = "dax.t2.small"
13+
security_group_ids = [sg-xxxx]
14+
subnet_ids = [sub-xxxx]
15+
}
16+
```

main.tf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Create DAX Subnet Group
2+
resource "aws_dax_subnet_group" "subnet_group" {
3+
name = var.name
4+
subnet_ids = var.subnet_ids
5+
}
6+
# Create DAX Subnet Group
7+
resource "aws_dax_parameter_group" "parameter_group" {
8+
name = var.name
9+
10+
parameters {
11+
name = "query-ttl-millis"
12+
value = var.query_ttl
13+
}
14+
15+
parameters {
16+
name = "record-ttl-millis"
17+
value = var.record_ttl
18+
}
19+
}
20+
21+
# Create DAX Cluster
22+
resource "aws_dax_cluster" "cluster" {
23+
cluster_name = var.name
24+
iam_role_arn = var.iam_role_arn
25+
node_type = var.node_type
26+
replication_factor = var.node_count
27+
server_side_encryption {
28+
enabled = var.server_side_encryption
29+
}
30+
parameter_group_name = aws_dax_parameter_group.parameter_group.name
31+
subnet_group_name = aws_dax_subnet_group.subnet_group.name
32+
maintenance_window = var.maintenance_window
33+
security_group_ids = var.security_group_ids
34+
}
35+
36+
37+

outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
output "configuration_endpoint" {
2+
value = aws_dax_cluster.cluster.configuration_endpoint
3+
description = "Configuration endpoint for this DAX cluster, consisting of a DNS name and a port number"
4+
}
5+
6+
7+
output "cluster_address" {
8+
value = aws_dax_cluster.cluster.cluster_address
9+
description = "DNS name of the DAX cluster without the port appended"
10+
}

variables.tf

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
variable "name" {
2+
type = string
3+
description = "(Required) Name of Cluster"
4+
}
5+
6+
variable "subnet_ids" {
7+
type = list(string)
8+
description = "(Required) List of Subnets to use for Cluster Group"
9+
}
10+
11+
variable "query_ttl" {
12+
type = string
13+
description = "(optional) Query Time To Live in milliseconds Defaults: 300000"
14+
default = "300000"
15+
}
16+
17+
variable "record_ttl" {
18+
type = string
19+
description = "(optional) Record Time To Live in milliseconds Defaults: 300000"
20+
default = "300000"
21+
}
22+
23+
variable "iam_role_arn" {
24+
type = string
25+
description = "(Required) A valid Amazon Resource Name (ARN) that identifies an IAM role. At runtime, DAX will assume this role and use the role's permissions to access DynamoDB on your behalf"
26+
}
27+
28+
29+
variable "node_type" {
30+
type = string
31+
description = "(Required) The compute and memory capacity of the nodes"
32+
}
33+
34+
variable "node_count" {
35+
type = number
36+
description = "(Required) The number of nodes in the DAX cluster. If 1 then it will create a single-node cluster, without any read replicas [ Default to 1 ]"
37+
default = 1
38+
}
39+
40+
variable "maintenance_window" {
41+
type = string
42+
description = "(Optional) Specifies the weekly time range for when maintenance on the cluster is performed. The format is ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Defaults: sun:00:00-sun:01:00"
43+
default = "sun:00:00-sun:01:00"
44+
}
45+
46+
variable "security_group_ids" {
47+
type = list(string)
48+
description = "(Required) One or more VPC security groups associated with the cluster"
49+
}
50+
51+
variable "server_side_encryption" {
52+
type = boolean
53+
description = "(Optional) Encrypt at rest options Default = true"
54+
default = true
55+
}

0 commit comments

Comments
 (0)