https://github.com/jameswoolfenden/terraform-aws-elastic
Provision an elasticsearch cluster from the AWS managed service
https://github.com/jameswoolfenden/terraform-aws-elastic
aws elasticsearch module terraform
Last synced: 3 months ago
JSON representation
Provision an elasticsearch cluster from the AWS managed service
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-elastic
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2021-02-26T13:23:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-29T20:18:32.000Z (almost 3 years ago)
- Last Synced: 2025-01-25T19:27:56.393Z (over 1 year ago)
- Topics: aws, elasticsearch, module, terraform
- Language: HCL
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-aws-elastic
[](https://github.com/JamesWoolfenden/terraform-aws-elastic)
[](https://github.com/JamesWoolfenden/terraform-aws-elastic/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-elastic/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-elastic&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-elastic&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module - to provision an Elasticsearch cluster.
---
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
## Usage
Include this repository as a module in your existing Terraform code:
```hcl
module "elastic" {
source = "JamesWoolfenden/elastic/aws"
version = "0.0.2"
subnets = var.subnets
vpc =
kms_key_id = aws_kms_key.elastic.id
log_name = var.log_name
common_tags = var.common_tags
}
```
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_cloudwatch_log_group.examplea](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_elasticsearch_domain.examplea](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain) | resource |
| [aws_elasticsearch_domain_policy.examplea](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain_policy) | resource |
| [aws_iam_service_linked_role.examplea](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_service_linked_role) | resource |
| [aws_security_group.examplea](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [advanced\_security\_options](#input\_advanced\_security\_options) | n/a | `bool` | `false` | no |
| [common\_tags](#input\_common\_tags) | n/a | `map(any)` | n/a | yes |
| [cw\_kms\_key\_id](#input\_cw\_kms\_key\_id) | n/a | `any` | n/a | yes |
| [dedicated\_master\_count](#input\_dedicated\_master\_count) | n/a | `number` | `1` | no |
| [dedicated\_master\_enabled](#input\_dedicated\_master\_enabled) | n/a | `bool` | `true` | no |
| [dedicated\_master\_type](#input\_dedicated\_master\_type) | n/a | `string` | `"t2.medium.elasticsearch"` | no |
| [ebs\_volume\_size](#input\_ebs\_volume\_size) | Optionally use EBS volumes for data storage by specifying volume size in GB (default 0) | `number` | `0` | no |
| [ebs\_volume\_type](#input\_ebs\_volume\_type) | Storage type of EBS volumes, if used (default gp2) | `string` | `"gp2"` | no |
| [es\_domain](#input\_es\_domain) | ElasticSearch domain name | `string` | `"elastic"` | no |
| [es\_version](#input\_es\_version) | n/a | `string` | `7.1` | no |
| [es\_zone\_awareness](#input\_es\_zone\_awareness) | n/a | `bool` | `true` | no |
| [instance\_count](#input\_instance\_count) | n/a | `number` | `1` | no |
| [instance\_type](#input\_instance\_type) | n/a | `string` | `""` | no |
| [kms\_key\_id](#input\_kms\_key\_id) | n/a | `string` | `"aws/es"` | no |
| [log\_name](#input\_log\_name) | n/a | `string` | `"elasticsearch"` | no |
| [log\_publishing\_options\_type](#input\_log\_publishing\_options\_type) | n/a | `string` | `"AUDIT_LOGS"` | no |
| [retention](#input\_retention) | n/a | `number` | `90` | no |
| [snapshot\_start\_hour](#input\_snapshot\_start\_hour) | n/a | `string` | `"23"` | no |
| [subnets](#input\_subnets) | List of VPC Subnet IDs to create ElasticSearch Endpoints in | `list(string)` | n/a | yes |
| [vpc](#input\_vpc) | VPC ID where to launch ElasticSearch cluster | `any` | n/a | yes |
| [vpc\_cidr](#input\_vpc\_cidr) | CIDR to allow connections to ElasticSearch | `string` | `"10.0.0.0/16"` | no |
## Outputs
| Name | Description |
|------|-------------|
| [elasticsearch](#output\_elasticsearch) | n/a |
## Policy
This is the policy required to build this project:
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeAccountAttributes",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeSecurityGroups",
"ec2:RevokeSecurityGroupEgress",
"ec2:RevokeSecurityGroupIngress"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"es:AddTags",
"es:CreateDomain",
"es:CreateElasticsearchDomain",
"es:DeleteDomain",
"es:DeleteElasticsearchDomain",
"es:DescribeDomainConfig",
"es:DescribeElasticsearchDomain",
"es:DescribeElasticsearchDomainConfig",
"es:ListTags",
"es:RemoveTags",
"es:UpdateDomainConfig",
"es:UpdateElasticsearchDomainConfig"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"iam:CreateServiceLinkedRole",
"iam:DeleteServiceLinkedRole",
"iam:GetRole",
"iam:GetServiceLinkedRoleDeletionStatus",
"iam:UpdateRoleDescription"
],
"Resource": "*"
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"logs:AssociateKmsKey",
"logs:CreateLogGroup",
"logs:DeleteLogGroup",
"logs:DeleteRetentionPolicy",
"logs:DescribeLogGroups",
"logs:DisassociateKmsKey",
"logs:ListTagsLogGroup",
"logs:PutRetentionPolicy",
"logs:TagLogGroup",
"logs:UntagLogGroup"
],
"Resource": "*"
}
]
})
}
```
## Related Projects
Check out these related projects.
- [terraform-aws-s3](https://github.com/jameswoolfenden/terraform-aws-s3) - S3 buckets
## Help
**Got a question?**
File a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-elastic/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-elastic/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2021-2022 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150