diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9740b95..c5d925c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer
- id: check-added-large-files
- id: detect-aws-credentials
-- repo: git://github.com/antonbabenko/pre-commit-terraform
+- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.49.0 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
diff --git a/README.md b/README.md
index 6699660..d7b91f2 100644
--- a/README.md
+++ b/README.md
@@ -125,12 +125,14 @@ module "aws_es" {
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.12.9 |
| [aws](#requirement\_aws) | >= 3.35.0 |
+| [random](#requirement\_random) | >=3.1.2 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 3.35.0 |
+| [aws](#provider\_aws) | 4.6.0 |
+| [random](#provider\_random) | 3.1.2 |
## Modules
@@ -144,6 +146,7 @@ No modules.
| [aws_cloudwatch_log_resource_policy.es_aws_cloudwatch_log_resource_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_resource_policy) | resource |
| [aws_elasticsearch_domain.es_domain](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain) | resource |
| [aws_iam_service_linked_role.es](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_service_linked_role) | resource |
+| [random_password.master_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
| [aws_kms_key.aws_es](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source |
## Inputs
@@ -153,13 +156,13 @@ No modules.
| [access\_policies](#input\_access\_policies) | IAM policy document specifying the access policies for the domain | `string` | `""` | no |
| [advanced\_options](#input\_advanced\_options) | Key-value string pairs to specify advanced configuration options. Note that the values for these configuration options must be strings (wrapped in quotes) or they may be wrong and cause a perpetual diff, causing Terraform to want to recreate your Elasticsearch domain on every apply | `map(string)` | `{}` | no |
| [advanced\_security\_options](#input\_advanced\_security\_options) | Options for fine-grained access control | `any` | `{}` | no |
+| [advanced\_security\_options\_create\_random\_master\_password](#input\_advanced\_security\_options\_create\_random\_master\_password) | Whether to create random master password for Elasticsearch master user | `bool` | `false` | no |
| [advanced\_security\_options\_enabled](#input\_advanced\_security\_options\_enabled) | Whether advanced security is enabled (Forces new resource) | `bool` | `false` | no |
| [advanced\_security\_options\_internal\_user\_database\_enabled](#input\_advanced\_security\_options\_internal\_user\_database\_enabled) | Whether the internal user database is enabled. If not set, defaults to false by the AWS API. | `bool` | `false` | no |
| [advanced\_security\_options\_master\_user\_arn](#input\_advanced\_security\_options\_master\_user\_arn) | ARN for the master user. Only specify if `internal_user_database_enabled` is not set or set to `false`) | `string` | `null` | no |
| [advanced\_security\_options\_master\_user\_password](#input\_advanced\_security\_options\_master\_user\_password) | The master user's password, which is stored in the Amazon Elasticsearch Service domain's internal database. Only specify if `internal_user_database_enabled` is set to `true`. | `string` | `null` | no |
| [advanced\_security\_options\_master\_user\_username](#input\_advanced\_security\_options\_master\_user\_username) | The master user's username, which is stored in the Amazon Elasticsearch Service domain's internal database. Only specify if `internal_user_database_enabled` is set to `true`. | `string` | `null` | no |
-| [advanced\_security\_options\_create\_random\_master\_password](#input\_advanced\_security\_options\_create\_random\_master\_password) | Whether to create random master password for Elasticsearch master user | `bool` | `false` | no |
-| [advanced\_security\_options\_random\_master\_password\_length](#advanced\_security\_options\_random\_master\_password\_length) | Length of random master password to create | `number` | `16` | no |
+| [advanced\_security\_options\_random\_master\_password\_length](#input\_advanced\_security\_options\_random\_master\_password\_length) | Length of random master password to create | `number` | `16` | no |
| [cloudwatch\_log\_enabled](#input\_cloudwatch\_log\_enabled) | Change to false to avoid deploying any Cloudwatch Logs resources | `bool` | `true` | no |
| [cluster\_config](#input\_cluster\_config) | Cluster configuration of the domain | `any` | `{}` | no |
| [cluster\_config\_availability\_zone\_count](#input\_cluster\_config\_availability\_zone\_count) | Number of Availability Zones for the domain to use with | `number` | `3` | no |
@@ -215,9 +218,9 @@ No modules.
| [arn](#output\_arn) | Amazon Resource Name (ARN) of the domain |
| [domain\_id](#output\_domain\_id) | Unique identifier for the domain |
| [endpoint](#output\_endpoint) | Domain-specific endpoint used to submit index, search, and data upload requests |
-| [master_username](#master\_username) | Master username (if internal database master user enabled) |
-| [master_password](#master\_password) | Master password (if internal database master user enabled) |
| [kibana\_endpoint](#output\_kibana\_endpoint) | Domain-specific endpoint for kibana without https scheme |
+| [master\_password](#output\_master\_password) | Master password |
+| [master\_username](#output\_master\_username) | Master username |
| [vpc\_options\_availability\_zones](#output\_vpc\_options\_availability\_zones) | If the domain was created inside a VPC, the names of the availability zones the configured subnet\_ids were created inside |
| [vpc\_options\_vpc\_id](#output\_vpc\_options\_vpc\_id) | If the domain was created inside a VPC, the ID of the VPC |
diff --git a/main.tf b/main.tf
index c492e56..e9a8afb 100644
--- a/main.tf
+++ b/main.tf
@@ -161,9 +161,9 @@ locals {
# advanced_security_options
# Create subblock master_user_options
create_random_master_password = var.advanced_security_options_enabled && var.advanced_security_options_internal_user_database_enabled && var.advanced_security_options_create_random_master_password
- master_user_arn = var.advanced_security_options_internal_user_database_enabled == false ? var.advanced_security_options_master_user_arn : null
- master_user_name = var.advanced_security_options_internal_user_database_enabled == true ? var.advanced_security_options_master_user_username : null
- master_user_password = local.create_random_master_password == true ? random_password.master_password[0].result : var.advanced_security_options_master_user_password
+ master_user_arn = var.advanced_security_options_internal_user_database_enabled == false ? var.advanced_security_options_master_user_arn : null
+ master_user_name = var.advanced_security_options_internal_user_database_enabled == true ? var.advanced_security_options_master_user_username : null
+ master_user_password = local.create_random_master_password == true ? random_password.master_password[0].result : var.advanced_security_options_master_user_password
master_user_options = lookup(var.advanced_security_options, "master_user_options", null) != null ? lookup(var.advanced_security_options, "master_user_options") : {
master_user_arn = local.master_user_arn
diff --git a/outputs.tf b/outputs.tf
index 72da2e3..1226411 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -26,7 +26,7 @@ output "master_username" {
output "master_password" {
description = "Master password"
value = local.master_user_password
- sensitive = true
+ sensitive = true
}
output "vpc_options_availability_zones" {
diff --git a/versions.tf b/versions.tf
index 22045d5..5ff9b69 100644
--- a/versions.tf
+++ b/versions.tf
@@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.12.9"
required_providers {
- aws = ">= 3.35.0"
+ aws = ">= 3.35.0"
random = ">=3.1.2"
}
}