Skip to content

Commit da18f90

Browse files
authored
Merge pull request #51 from lgallard/feature/public-cold-storage
Add support and example for cold_storage_options
2 parents 7844cd0 + 965ce78 commit da18f90

File tree

12 files changed

+252
-2
lines changed

12 files changed

+252
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.13.0 (June 10, 2022)
2+
3+
ENHANCEMENTS:
4+
5+
* Add support and example for `cold_storage_options`
6+
17
## 0.12.2 (August 26, 2021)
28

39
FIXES:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ module "aws_es" {
131131

132132
| Name | Version |
133133
|------|---------|
134-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.6.0 |
135-
| <a name="provider_random"></a> [random](#provider\_random) | 3.1.2 |
134+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.18.0 |
135+
| <a name="provider_random"></a> [random](#provider\_random) | 3.3.1 |
136136

137137
## Modules
138138

examples/public_cold_storage/.terraform.lock.hcl

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Public AWS Elasticearch Domain example
2+
3+
```
4+
module "aws_es" {
5+
6+
source = "lgallard/elasticsearch/aws"
7+
8+
domain_name = var.es_domain_name
9+
elasticsearch_version = var.es_version
10+
11+
cluster_config = {
12+
dedicated_master_enabled = "true"
13+
instance_count = "3"
14+
instance_type = "r5.large.elasticsearch"
15+
zone_awareness_enabled = "true"
16+
availability_zone_count = "3"
17+
}
18+
19+
ebs_options = {
20+
ebs_enabled = "true"
21+
volume_size = "25"
22+
}
23+
24+
encrypt_at_rest = {
25+
enabled = "true"
26+
kms_key_id = "alias/aws/es"
27+
}
28+
29+
log_publishing_options = {
30+
index_slow_logs = {
31+
enabled = true
32+
cloudwatch_log_group_arn = "arn:aws:logs:us-east-1:123456789101:log-group:/aws/elasticsearch/index_slow_logs:*"
33+
rog_publishing_options_retention = 90
34+
}
35+
search_slow_logs = {
36+
enabled = true
37+
cloudwatch_log_group_arn = "arn:aws:logs:us-east-1:123456789101:log-group:/aws/elasticsearch/search_slow_logs:*"
38+
}
39+
es_application_logs = {
40+
enabled = true
41+
cloudwatch_log_group_name = "es_application_logs_dev"
42+
}
43+
audit_logs = {
44+
enabled = false
45+
cloudwatch_log_group_name = "audit_logs_dev"
46+
}
47+
}
48+
49+
advanced_options = {
50+
"rest.action.multi.allow_explicit_index" = "true"
51+
}
52+
53+
access_policies = templatefile("${path.module}/whitelits.tpl", {
54+
region = data.aws_region.current.name,
55+
account = data.aws_caller_identity.current.account_id,
56+
domain_name = var.es_domain_name,
57+
whitelist = "${jsonencode(var.whitelist)}"
58+
})
59+
60+
node_to_node_encryption_enabled = "true"
61+
snapshot_options_automated_snapshot_start_hour = "23"
62+
63+
timeouts_update = "60m"
64+
65+
tags = {
66+
Owner = "sysops"
67+
env = "dev"
68+
}
69+
}
70+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Use this data source to get the access to the effective Account ID in which
2+
# Terraform is working.
3+
data "aws_caller_identity" "current" {}
4+
5+
# To obtain the name of the AWS region configured on the provider
6+
data "aws_region" "current" {}

examples/public_cold_storage/main.tf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module "aws_es" {
2+
3+
source = "../../"
4+
5+
domain_name = var.es_domain_name
6+
elasticsearch_version = var.es_version
7+
8+
cluster_config = {
9+
dedicated_master_enabled = true
10+
instance_count = 3
11+
instance_type = "r5.large.elasticsearch"
12+
zone_awareness_enabled = true
13+
warm_enabled = true
14+
warm_type = "ultrawarm1.medium.elasticsearch"
15+
warm_count = 2
16+
cold_storage_options_enabled = true
17+
availability_zone_count = 3
18+
}
19+
20+
ebs_options = {
21+
ebs_enabled = true
22+
volume_size = 25
23+
}
24+
25+
encrypt_at_rest = {
26+
enabled = true
27+
#kms_key_id = "arn:aws:kms:us-east-1:123456789101:key/cccc103b-4ba3-5993-6fc7-b7e538b25fd8"
28+
}
29+
30+
log_publishing_options = {
31+
index_slow_logs = {
32+
enabled = false
33+
cloudwatch_log_group_arn = "arn:aws:logs:us-east-1:758889637411:log-group:/aws/elasticsearch/index_slow_logs:*"
34+
log_publishing_options_retention = 90
35+
}
36+
search_slow_logs = {
37+
enabled = false
38+
cloudwatch_log_group_arn = "arn:aws:logs:us-east-1:758889637411:log-group:/aws/elasticsearch/search_slow_logs:*"
39+
}
40+
es_application_logs = {
41+
enabled = false
42+
cloudwatch_log_group_name = "es_application_logs_dev"
43+
}
44+
audit_logs = {
45+
enabled = false
46+
cloudwatch_log_group_name = "audit_logs_dev"
47+
}
48+
}
49+
50+
advanced_options = {
51+
"rest.action.multi.allow_explicit_index" = true
52+
}
53+
54+
access_policies = templatefile("${path.module}/whitelits.tpl", {
55+
region = data.aws_region.current.name,
56+
account = data.aws_caller_identity.current.account_id,
57+
domain_name = var.es_domain_name,
58+
whitelist = jsonencode(var.whitelist)
59+
})
60+
61+
node_to_node_encryption_enabled = true
62+
snapshot_options_automated_snapshot_start_hour = 23
63+
64+
timeouts_update = "60m"
65+
66+
tags = {
67+
Owner = "sysops"
68+
env = "dev"
69+
}
70+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider "aws" {
2+
region = var.region
3+
profile = var.profile
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
region = "us-east-1"
2+
profile = "default"
3+
es_domain_name = "elasticsearch-public"
4+
es_version = "OpenSearch_1.2"
5+
whitelist = ["1.1.1.1", "2.2.2.2"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Provider
2+
variable "region" {}
3+
variable "profile" {}
4+
5+
6+
# AWS Elasticsearch
7+
variable "es_domain_name" {}
8+
variable "es_version" {}
9+
10+
11+
# Whitelist (allow public IPs)
12+
variable "whitelist" {
13+
default = []
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
terraform {
3+
required_version = ">= 0.12"
4+
required_providers {
5+
aws = ">= 3.35.0"
6+
}
7+
}

0 commit comments

Comments
 (0)