Skip to content

Commit 684febf

Browse files
author
Enrique Garbi
committed
Fixes and simplier Usage in README, Adds VPC range as Allowed CIDR for SG rule
1 parent 22e2189 commit 684febf

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ AWS Elasticsearch Service Terraform Module
44
Usage:
55

66
```hcl
7+
data "aws_region" "current" {}
8+
9+
data "aws_caller_identity" "current" {}
10+
711
module "es-cluster" {
812
source = "git::https://github.com/egarbi/terraform-aws-es-cluster"
913
1014
name = "example"
1115
vpc_id = "vpc-xxxxx"
12-
subnet_ids = [ "subnet-one","subnet-two"]
16+
subnet_ids = [ "subnet-one" ]
1317
zone_id = "ZA863HSKDDD9"
1418
itype = "m4.large.elasticsearch"
1519
ingress_allow_cidr_blocks = [ "10.20.0.0/16", "10.22.0.0/16" ]
@@ -21,9 +25,7 @@ module "es-cluster" {
2125
"Action": "es:*",
2226
"Principal": "*",
2327
"Effect": "Allow",
24-
"Condition": {
25-
"IpAddress": {"aws:SourceIp": ["66.193.100.22/32"]}
26-
}
28+
"Resource": "arn:aws:es:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:domain/example/*"
2729
}
2830
]
2931
}

example/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module "es-cluster" {
3535
itype = "m4.large.elasticsearch"
3636
icount = 2
3737
zone_awareness = true
38-
ingress_allow_cidr_blocks = "${tolist(data.aws_subnet.default.*.cidr_block)}"
38+
ingress_allow_cidr_blocks = [ "${data.aws_vpc.default.cidr_block}" ]
3939
access_policies = <<CONFIG
4040
{
4141
"Version": "2012-10-17",

0 commit comments

Comments
 (0)