Running terraform plan fails with errors if master_password is set.
Plan: 2 to add, 0 to change, 0 to destroy.
╷
│ Error: Invalid index
│
│ on .terraform/modules/opensearch/main.tf line 28, in resource "aws_ssm_parameter" "opensearch_master_user":
│ 28: value = "${var.master_user_name},${coalesce(var.master_password, random_password.password[0].result)}"
│ ├────────────────
│ │ random_password.password is empty tuple
│
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
╷
│ Error: Invalid index
│
│ on .terraform/modules/opensearch/main.tf line 76, in resource "aws_opensearch_domain" "opensearch":
│ 76: master_user_password = var.internal_user_database_enabled ? coalesce(var.master_password, random_password.password[0].result) : ""
│ ├────────────────
│ │ random_password.password is empty tuple
│
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
terraform plan
fails with errors ifmaster_password
is set.My Code:-