Skip to content

Commit aff4a92

Browse files
authored
Merge branch 'master' into add-irsa
2 parents c673978 + dda8ef4 commit aff4a92

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ module "elasticsearch" {
120120
security_groups = ["sg-XXXXXXXXX", "sg-YYYYYYYY"]
121121
vpc_id = "vpc-XXXXXXXXX"
122122
subnet_ids = ["subnet-XXXXXXXXX", "subnet-YYYYYYYY"]
123-
zone_awareness_enabled = "true"
123+
zone_awareness_enabled = true
124124
elasticsearch_version = "6.5"
125125
instance_type = "t2.small.elasticsearch"
126126
instance_count = 4
@@ -180,8 +180,8 @@ Available targets:
180180

181181
| Name | Source | Version |
182182
|------|--------|---------|
183-
| <a name="module_domain_hostname"></a> [domain\_hostname](#module\_domain\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.2 |
184-
| <a name="module_kibana_hostname"></a> [kibana\_hostname](#module\_kibana\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.2 |
183+
| <a name="module_domain_hostname"></a> [domain\_hostname](#module\_domain\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.3 |
184+
| <a name="module_kibana_hostname"></a> [kibana\_hostname](#module\_kibana\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.3 |
185185
| <a name="module_kibana_label"></a> [kibana\_label](#module\_kibana\_label) | cloudposse/label/null | 0.25.0 |
186186
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
187187
| <a name="module_user_label"></a> [user\_label](#module\_user\_label) | cloudposse/label/null | 0.25.0 |
@@ -225,6 +225,7 @@ Available targets:
225225
| <a name="input_cold_storage_enabled"></a> [cold\_storage\_enabled](#input\_cold\_storage\_enabled) | Enables cold storage support. | `bool` | `false` | no |
226226
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
227227
| <a name="input_create_iam_service_linked_role"></a> [create\_iam\_service\_linked\_role](#input\_create\_iam\_service\_linked\_role) | Whether to create `AWSServiceRoleForAmazonElasticsearchService` service-linked role. Set it to `false` if you already have an ElasticSearch cluster created in the AWS account and AWSServiceRoleForAmazonElasticsearchService already exists. See https://github.com/terraform-providers/terraform-provider-aws/issues/5218 for more info | `bool` | `true` | no |
228+
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Whether to create a dedicated security group for the Elasticsearch domain. Set it to `false` if you already have security groups that you want to attach to the domain and specify them in the `security_groups` variable. | `bool` | `true` | no |
228229
| <a name="input_custom_endpoint"></a> [custom\_endpoint](#input\_custom\_endpoint) | Fully qualified domain for custom endpoint. | `string` | `""` | no |
229230
| <a name="input_custom_endpoint_certificate_arn"></a> [custom\_endpoint\_certificate\_arn](#input\_custom\_endpoint\_certificate\_arn) | ACM certificate ARN for custom endpoint. | `string` | `""` | no |
230231
| <a name="input_custom_endpoint_enabled"></a> [custom\_endpoint\_enabled](#input\_custom\_endpoint\_enabled) | Whether to enable custom endpoint for the Elasticsearch domain. | `bool` | `false` | no |
@@ -278,7 +279,7 @@ Available targets:
278279
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
279280
| <a name="input_node_to_node_encryption_enabled"></a> [node\_to\_node\_encryption\_enabled](#input\_node\_to\_node\_encryption\_enabled) | Whether to enable node-to-node encryption | `bool` | `false` | no |
280281
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
281-
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | List of security group IDs to be allowed to connect to the cluster | `list(string)` | `[]` | no |
282+
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | List of security group IDs to be allowed to connect to the cluster or the security group IDs to apply to the cluster when the `create_security_group` variable is set to false. | `list(string)` | `[]` | no |
282283
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
283284
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | VPC Subnet IDs | `list(string)` | `[]` | no |
284285
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |

README.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ usage: |-
6767
security_groups = ["sg-XXXXXXXXX", "sg-YYYYYYYY"]
6868
vpc_id = "vpc-XXXXXXXXX"
6969
subnet_ids = ["subnet-XXXXXXXXX", "subnet-YYYYYYYY"]
70-
zone_awareness_enabled = "true"
70+
zone_awareness_enabled = true
7171
elasticsearch_version = "6.5"
7272
instance_type = "t2.small.elasticsearch"
7373
instance_count = 4

docs/terraform.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
| Name | Source | Version |
1919
|------|--------|---------|
20-
| <a name="module_domain_hostname"></a> [domain\_hostname](#module\_domain\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.2 |
21-
| <a name="module_kibana_hostname"></a> [kibana\_hostname](#module\_kibana\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.2 |
20+
| <a name="module_domain_hostname"></a> [domain\_hostname](#module\_domain\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.3 |
21+
| <a name="module_kibana_hostname"></a> [kibana\_hostname](#module\_kibana\_hostname) | cloudposse/route53-cluster-hostname/aws | 0.12.3 |
2222
| <a name="module_kibana_label"></a> [kibana\_label](#module\_kibana\_label) | cloudposse/label/null | 0.25.0 |
2323
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
2424
| <a name="module_user_label"></a> [user\_label](#module\_user\_label) | cloudposse/label/null | 0.25.0 |
@@ -62,6 +62,7 @@
6262
| <a name="input_cold_storage_enabled"></a> [cold\_storage\_enabled](#input\_cold\_storage\_enabled) | Enables cold storage support. | `bool` | `false` | no |
6363
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
6464
| <a name="input_create_iam_service_linked_role"></a> [create\_iam\_service\_linked\_role](#input\_create\_iam\_service\_linked\_role) | Whether to create `AWSServiceRoleForAmazonElasticsearchService` service-linked role. Set it to `false` if you already have an ElasticSearch cluster created in the AWS account and AWSServiceRoleForAmazonElasticsearchService already exists. See https://github.com/terraform-providers/terraform-provider-aws/issues/5218 for more info | `bool` | `true` | no |
65+
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Whether to create a dedicated security group for the Elasticsearch domain. Set it to `false` if you already have security groups that you want to attach to the domain and specify them in the `security_groups` variable. | `bool` | `true` | no |
6566
| <a name="input_custom_endpoint"></a> [custom\_endpoint](#input\_custom\_endpoint) | Fully qualified domain for custom endpoint. | `string` | `""` | no |
6667
| <a name="input_custom_endpoint_certificate_arn"></a> [custom\_endpoint\_certificate\_arn](#input\_custom\_endpoint\_certificate\_arn) | ACM certificate ARN for custom endpoint. | `string` | `""` | no |
6768
| <a name="input_custom_endpoint_enabled"></a> [custom\_endpoint\_enabled](#input\_custom\_endpoint\_enabled) | Whether to enable custom endpoint for the Elasticsearch domain. | `bool` | `false` | no |
@@ -115,7 +116,7 @@
115116
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
116117
| <a name="input_node_to_node_encryption_enabled"></a> [node\_to\_node\_encryption\_enabled](#input\_node\_to\_node\_encryption\_enabled) | Whether to enable node-to-node encryption | `bool` | `false` | no |
117118
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
118-
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | List of security group IDs to be allowed to connect to the cluster | `list(string)` | `[]` | no |
119+
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | List of security group IDs to be allowed to connect to the cluster or the security group IDs to apply to the cluster when the `create_security_group` variable is set to false. | `list(string)` | `[]` | no |
119120
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
120121
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | VPC Subnet IDs | `list(string)` | `[]` | no |
121122
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |

main.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module "kibana_label" {
1717
}
1818

1919
resource "aws_security_group" "default" {
20-
count = module.this.enabled && var.vpc_enabled ? 1 : 0
20+
count = module.this.enabled && var.vpc_enabled && var.create_security_group ? 1 : 0
2121
vpc_id = var.vpc_id
2222
name = module.this.id
2323
description = "Allow inbound traffic from Security Groups and CIDRs. Allow all outbound traffic"
@@ -29,7 +29,7 @@ resource "aws_security_group" "default" {
2929
}
3030

3131
resource "aws_security_group_rule" "ingress_security_groups" {
32-
count = module.this.enabled && var.vpc_enabled ? length(var.security_groups) : 0
32+
count = module.this.enabled && var.vpc_enabled && var.create_security_group ? length(var.security_groups) : 0
3333
description = "Allow inbound traffic from Security Groups"
3434
type = "ingress"
3535
from_port = var.ingress_port_range_start
@@ -40,7 +40,7 @@ resource "aws_security_group_rule" "ingress_security_groups" {
4040
}
4141

4242
resource "aws_security_group_rule" "ingress_cidr_blocks" {
43-
count = module.this.enabled && var.vpc_enabled && length(var.allowed_cidr_blocks) > 0 ? 1 : 0
43+
count = module.this.enabled && var.vpc_enabled && var.create_security_group && length(var.allowed_cidr_blocks) > 0 ? 1 : 0
4444
description = "Allow inbound traffic from CIDR blocks"
4545
type = "ingress"
4646
from_port = var.ingress_port_range_start
@@ -51,7 +51,7 @@ resource "aws_security_group_rule" "ingress_cidr_blocks" {
5151
}
5252

5353
resource "aws_security_group_rule" "egress" {
54-
count = module.this.enabled && var.vpc_enabled ? 1 : 0
54+
count = module.this.enabled && var.vpc_enabled && var.create_security_group ? 1 : 0
5555
description = "Allow all egress traffic"
5656
type = "egress"
5757
from_port = 0
@@ -179,8 +179,8 @@ resource "aws_elasticsearch_domain" "default" {
179179
instance_count = var.instance_count
180180
instance_type = var.instance_type
181181
dedicated_master_enabled = var.dedicated_master_enabled
182-
dedicated_master_count = var.dedicated_master_count
183-
dedicated_master_type = var.dedicated_master_type
182+
dedicated_master_count = var.dedicated_master_enabled ? var.dedicated_master_count : null
183+
dedicated_master_type = var.dedicated_master_enabled ? var.dedicated_master_type : null
184184
zone_awareness_enabled = var.zone_awareness_enabled
185185
warm_enabled = var.warm_enabled
186186
warm_count = var.warm_enabled ? var.warm_count : null
@@ -226,7 +226,7 @@ resource "aws_elasticsearch_domain" "default" {
226226
for_each = var.vpc_enabled ? [true] : []
227227

228228
content {
229-
security_group_ids = [join("", aws_security_group.default.*.id)]
229+
security_group_ids = var.create_security_group ? [join("", aws_security_group.default.*.id)] : var.security_groups
230230
subnet_ids = var.subnet_ids
231231
}
232232
}
@@ -330,7 +330,7 @@ resource "aws_elasticsearch_domain_policy" "default" {
330330

331331
module "domain_hostname" {
332332
source = "cloudposse/route53-cluster-hostname/aws"
333-
version = "0.12.2"
333+
version = "0.12.3"
334334

335335
enabled = module.this.enabled && var.domain_hostname_enabled
336336
dns_name = var.elasticsearch_subdomain_name == "" ? module.this.id : var.elasticsearch_subdomain_name
@@ -343,7 +343,7 @@ module "domain_hostname" {
343343

344344
module "kibana_hostname" {
345345
source = "cloudposse/route53-cluster-hostname/aws"
346-
version = "0.12.2"
346+
version = "0.12.3"
347347

348348
enabled = module.this.enabled && var.kibana_hostname_enabled
349349
dns_name = var.kibana_subdomain_name == "" ? module.kibana_label.id : var.kibana_subdomain_name

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
variable "security_groups" {
22
type = list(string)
33
default = []
4-
description = "List of security group IDs to be allowed to connect to the cluster"
4+
description = "List of security group IDs to be allowed to connect to the cluster or the security group IDs to apply to the cluster when the `create_security_group` variable is set to false."
5+
}
6+
7+
variable "create_security_group" {
8+
type = bool
9+
default = true
10+
description = "Whether to create a dedicated security group for the Elasticsearch domain. Set it to `false` if you already have security groups that you want to attach to the domain and specify them in the `security_groups` variable."
511
}
612

713
variable "ingress_port_range_start" {

0 commit comments

Comments
 (0)