Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tf_mod_aws_elasticsearch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steamhaus
tf_mod_aws_elasticsearch
Commits
e4988391
Commit
e4988391
authored
Feb 07, 2018
by
Adrian Horrocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switching policy json to vpc options and adding endpoint output
parent
df4aea33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
45 deletions
+27
-45
access_policy.json
access_policy.json
+0
-30
main.tf
main.tf
+27
-15
No files found.
access_policy.json
deleted
100644 → 0
View file @
df4aea33
{
"Version"
:
"2012-10-17"
,
"Statement"
:
[
{
"Effect"
:
"Allow"
,
"Principal"
:
{
"AWS"
:
"*"
},
"Action"
:
"es:*"
,
"Condition"
:
{
"IpAddress"
:
{
"aws:SourceIp"
:
[
"${other_ips}"
]
}
}
},
{
"Sid"
:
""
,
"Effect"
:
"Allow"
,
"Principal"
:
{
"AWS"
:
"*"
},
"Action"
:
"es:*"
,
"Condition"
:
{
"IpAddress"
:
{
"aws:SourceIp"
:
$
{
nat_ips
}
}
}
}
]
}
\ No newline at end of file
main.tf
View file @
e4988391
...
...
@@ -2,13 +2,15 @@ variable environment {}
variable
name
{}
variable
nat_gateway_ips
{}
variable
access_ips
{}
variable
private_dns_zone
{}
variable
private_dns_address
{}
variable
public_dns_zone
{}
variable
public_dns_address
{}
variable
vpc_id
{}
variable
subnet_ids
{
type
=
"list"
}
variable
security_groups
{
type
=
"list"
}
variable
elasticsearch_version
{
default
=
"
1
.5"
}
variable
elasticsearch_version
{
default
=
"
5
.5"
}
variable
automated_snapshot_start_hour
{
default
=
"02"
}
# EBS options
...
...
@@ -16,31 +18,40 @@ variable ebs_enabled {default = "true"}
variable
ebs_volume_type
{
default
=
"gp2"
}
variable
ebs_volume_size
{
default
=
"20"
}
# Cluster config
# If zone awareness is enabled then an even number of data nodes is required.
# Cluster config
# If zone awareness is enabled then an even number of data nodes is required.
# Dedicated master count should be greater than 1
variable
instance_type
{
default
=
"t2.micro.elasticsearch"
}
# M3 medium minimum instance type for > ES 2.3
variable
instance_type
{
default
=
"m3.medium.elasticsearch"
}
variable
instance_count
{
default
=
"2"
}
variable
zone_awareness_enabled
{
default
=
"true"
}
variable
dedicated_master_enabled
{
default
=
"true"
}
variable
dedicated_master_type
{
default
=
"
t2.micro
.elasticsearch"
}
variable
dedicated_master_type
{
default
=
"
m3.medium
.elasticsearch"
}
variable
dedicated_master_count
{
default
=
"2"
}
resource
"aws_security_group"
"elasticsearch"
{
name
=
"elasticsearch"
description
=
"Allow ingress traffic to the ElasticSearch cluster"
vpc_id
=
"
${
var
.
vpc_id
}
"
data
"template_file"
"access_policy"
{
template
=
"
${
file
(
"
${
path
.
module}
/access_policy.json"
)
}
"
vars
{
nat_ips
=
"
${
jsonencode
(
split
(
","
,
var
.
nat_gateway_ips
))
}
"
other_ips
=
"
${
var
.
access_ips
}
"
ingress
{
from_port
=
80
to_port
=
443
protocol
=
"tcp
"
security_groups
=
[
"
${
var
.
security_groups
}
"
]
}
}
# Add var for domain name
resource
"aws_elasticsearch_domain"
"elasticsearch"
{
domain_name
=
"es-
${
var
.
name
}
-
${
var
.
environment
}
"
elasticsearch_version
=
"
${
var
.
elasticsearch_version
}
"
vpc_options
{
security_group_ids
=
[
"
${
aws_security_group
.
elasticsearch
.
id
}
"
]
subnet_ids
=
[
"
${
var
.
subnet_ids
}
"
]
}
ebs_options
{
ebs_enabled
=
"
${
var
.
ebs_enabled
}
"
volume_type
=
"
${
var
.
ebs_volume_type
}
"
...
...
@@ -50,7 +61,6 @@ resource "aws_elasticsearch_domain" "elasticsearch" {
snapshot_options
{
automated_snapshot_start_hour
=
"
${
var
.
automated_snapshot_start_hour
}
"
}
access_policies
=
"
${data
.
template_file
.
access_policy
.
rendered
}
"
cluster_config
{
instance_type
=
"
${
var
.
instance_type
}
"
...
...
@@ -74,8 +84,6 @@ resource "aws_elasticsearch_domain" "elasticsearch" {
}
}
resource
"aws_route53_record"
"public"
{
zone_id
=
"
${
var
.
public_dns_zone
}
"
name
=
"
${
var
.
public_dns_address
}
"
...
...
@@ -91,3 +99,7 @@ resource "aws_route53_record" "private" {
ttl
=
60
records
=
[
"
${
aws_elasticsearch_domain
.
elasticsearch
.
endpoint
}
"
]
}
output
"endpoint"
{
value
=
"
${
aws_elasticsearch_domain
.
elasticsearch
.
endpoint
}
"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment