|
| 1 | +# Terraform-Tutorial |
| 2 | + |
| 3 | + |
| 4 | +## Introduction |
| 5 | + |
| 6 | +This module will create: |
| 7 | +- Elasticsearch cluster with the specified node count in aws |
| 8 | +- Elasticsearch domain policy that accepts a list of IAM role ARNs from which to permit management traffic to the cluster |
| 9 | + |
| 10 | +__NOTE:__ To enable [zone awareness](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html#es-managedomains-zoneawareness) to deploy Elasticsearch nodes into two different Availability Zones, you need to set `zone_awareness_enabled` to `true` |
| 11 | +If you don't enable zone awareness, Amazon ES places an endpoint into only one subnet. |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +Basic [example](examples/basic) |
| 16 | + |
| 17 | +```hcl |
| 18 | +module "elasticsearch" { |
| 19 | + source = "git::https://github.com/easyawslearn/Terraform-Tutorial/terraform-aws-elasticsearch.git" |
| 20 | + domain_name = "eg" |
| 21 | + elasticsearch_version = "6.5" |
| 22 | + zone_awareness_enabled = "false" |
| 23 | + instance_type = "t2.small.elasticsearch" |
| 24 | + instance_count = 2 |
| 25 | + encrypt_at_rest_enabled = true |
| 26 | +
|
| 27 | + advanced_options { |
| 28 | + "rest.action.multi.allow_explicit_index" = "true" |
| 29 | + } |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | + |
| 34 | +## Developing |
| 35 | + |
| 36 | +- **Terraform**: v0.11.14 |
| 37 | +- **Terraform Docs**: https://www.terraform.io/docs/configuration-0-11/index.html |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +## Inputs |
| 42 | + |
| 43 | +| Name | Description | Type | Default | Required | |
| 44 | +|------|-------------|:----:|:-----:|:-----:| |
| 45 | +| advanced_options | Key-value string pairs to specify advanced configuration options | map(string) | `<map>` | no | |
| 46 | +| automated_snapshot_start_hour | Hour at which automated snapshots are taken, in UTC | number | `0` | no | |
| 47 | +| availability_zone_count | Number of Availability Zones for the domain to use. | number | `2` | no | |
| 48 | +| dedicated_master_count | Number of dedicated master nodes in the cluster | number | `0` | no | |
| 49 | +| dedicated_master_enabled | Indicates whether dedicated master nodes are enabled for the cluster | bool | `false` | no | |
| 50 | +| dedicated_master_type | Instance type of the dedicated master nodes in the cluster | string | `t2.small.elasticsearch` | no | |
| 51 | +| ebs_iops | The baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable only for the Provisioned IOPS EBS volume type | number | `0` | no | |
| 52 | +| ebs_volume_size | EBS volumes for data storage in GB | number | `0` | no | |
| 53 | +| ebs_volume_type | Storage type of EBS volumes | string | `gp2` | no | |
| 54 | +| elasticsearch_version | Version of Elasticsearch to deploy | string | `6.5` | no | |
| 55 | +| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no | |
| 56 | +| encrypt_at_rest_enabled | Whether to enable encryption at rest | bool | `true` | no | |
| 57 | +| encrypt_at_rest_kms_key_id | The KMS key ID to encrypt the Elasticsearch domain with. If not specified, then it defaults to using the AWS/Elasticsearch service KMS key | string | `` | no | |
| 58 | +| instance_count | Number of data nodes in the cluster | number | `4` | no | |
| 59 | +| instance_type | Elasticsearch instance type for data nodes in the cluster | string | `t2.small.elasticsearch` | no | |
| 60 | +| log_publishing_application_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for ES_APPLICATION_LOGS needs to be published | string | `` | no | |
| 61 | +| log_publishing_application_enabled | Specifies whether log publishing option for ES_APPLICATION_LOGS is enabled or not | bool | `false` | no | |
| 62 | +| log_publishing_index_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for INDEX_SLOW_LOGS needs to be published | string | `` | no | |
| 63 | +| log_publishing_index_enabled | Specifies whether log publishing option for INDEX_SLOW_LOGS is enabled or not | bool | `false` | no | |
| 64 | +| log_publishing_search_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for SEARCH_SLOW_LOGS needs to be published | string | `` | no | |
| 65 | +| log_publishing_search_enabled | Specifies whether log publishing option for SEARCH_SLOW_LOGS is enabled or not | bool | `false` | no | |
| 66 | +| domain_name | Name of the application | string | - | yes | |
| 67 | +| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no | |
| 68 | +| node_to_node_encryption_enabled | Whether to enable node-to-node encryption | bool | `false` | no | |
| 69 | +| zone_awareness_enabled | Enable zone awareness for Elasticsearch cluster | bool | `true` | no | |
| 70 | + |
| 71 | +## Outputs |
| 72 | + |
| 73 | +| Name | Description | |
| 74 | +|------|-------------| |
| 75 | +| domain_arn | ARN of the Elasticsearch domain | |
| 76 | +| domain_endpoint | Domain-specific endpoint used to submit index, search, and data upload requests | |
| 77 | +| domain_hostname | Elasticsearch domain hostname to submit index, search, and data upload requests | |
| 78 | +| domain_id | Unique identifier for the Elasticsearch domain | |
| 79 | +| elasticsearch_user_iam_role_arn | The ARN of the IAM role to allow access to Elasticsearch cluster | |
| 80 | +| elasticsearch_user_iam_role_name | The name of the IAM role to allow access to Elasticsearch cluster | |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +## References |
| 87 | + |
| 88 | +For additional context, refer to some of these links. |
| 89 | + |
| 90 | +- [What is Amazon Elasticsearch Service](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/what-is-amazon-elasticsearch-service.html) - Complete description of Amazon Elasticsearch Service |
| 91 | +- [Amazon Elasticsearch Service Access Control](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html) - Describes several ways of controlling access to Elasticsearch domains |
| 92 | +- [VPC Support for Amazon Elasticsearch Service Domains](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html) - Describes Elasticsearch Service VPC Support and VPC architectures with and without zone awareness |
| 93 | +- [Creating and Configuring Amazon Elasticsearch Service Domains](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html) - Provides a complete description on how to create and configure Amazon Elasticsearch Service (Amazon ES) domains |
| 94 | +- [Kibana and Logstash](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-kibana.html) - Describes some considerations for using Kibana and Logstash with Amazon Elasticsearch Service |
| 95 | +- [Control Access to Amazon Elasticsearch Service Domain](https://aws.amazon.com/blogs/security/how-to-control-access-to-your-amazon-elasticsearch-service-domain/) - Describes how to Control Access to Amazon Elasticsearch Service Domain |
| 96 | +- [elasticsearch_domain](https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain.html) - Terraform reference documentation for the `elasticsearch_domain` resource |
| 97 | +- [elasticsearch_domain_policy](https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain_policy.html) - Terraform reference documentation for the `elasticsearch_domain_policy` resource |
0 commit comments