terraform-provider-mongodbatlas
terraform-provider-mongodbatlas copied to clipboard
mongodbatlas_search_index does not allow for name changing
Terraform CLI and Terraform MongoDB Atlas Provider Version
Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v4.67.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.23.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/mongodb/mongodbatlas v1.12.2
+ provider registry.terraform.io/sumologic/sumologic v2.27.0
Terraform Configuration File
resource "mongodbatlas_search_index" "v2_initiative_props_search_index" {
name = "test"
project_id = var.atlas_project_id
cluster_name = "test"
database = "time-service"
collection_name = "initiative_props"
analyzer = "lucene.standard"
search_analyzer = "lucene.standard"
mappings_dynamic = false
mappings_fields = jsonencode(
{
initiative = {
dynamic = false
fields = {
client = {
dynamic = false
fields = {
callSign = local.atlas_search_string_index_definition
name = local.atlas_search_string_index_definition
}
type = "document"
}
callSign = local.atlas_search_string_index_definition
name = local.atlas_search_string_index_definition
}
type = "document"
}
nickname = local.atlas_search_string_index_definition
customerId = {
type = "objectId"
}
userId = {
type = "objectId"
}
}
)
analyzers = jsonencode(local.atlas_search_analyzers)
}
locals {
laurel_standard_atlas_search_analyzer = {
charFilters = [
{
type = "icuNormalize"
},
{
mappings = {
"(" = " "
")" = " "
"," = " "
"-" = " "
"." = " "
"/" = " "
":" = " "
";" = " "
"\\" = " "
"_" = " "
"|" = " "
},
type = "mapping"
}
]
name = "laurel.standard",
tokenFilters = [
{
type = "icuFolding"
},
{
type = "englishPossessive"
},
{
type = "lowercase"
},
{
type = "kStemming"
}
],
tokenizer = {
type = "standard"
}
}
laurel_standard_egrams_atlas_search_analyzer = {
charFilters = [
{
type = "icuNormalize"
},
{
mappings = {
"(" = " "
")" = " "
"," = " "
"-" = " "
"." = " "
"/" = " "
":" = " "
";" = " "
"\\" = " "
"_" = " "
"|" = " "
},
type = "mapping"
}
]
name = "laurel.standard-egrams",
tokenFilters = [
{
type = "icuFolding"
},
{
type = "englishPossessive"
},
{
type = "lowercase"
},
{
type = "kStemming"
},
{
maxGram = 10,
minGram = 2,
termNotInBounds = "include",
type = "edgeGram"
}
],
tokenizer = {
type = "standard"
}
}
laurel_exact_atlas_search_analyzer = {
charFilters = [
{
type = "icuNormalize"
}
]
name = "laurel.exact"
tokenFilters = [
{
type = "icuFolding"
},
{
type = "lowercase"
}
]
tokenizer = {
type = "whitespace"
}
}
laurel_exact_egrams_atlas_search_analyzer = {
charFilters = [
{
type = "icuNormalize"
}
]
name = "laurel.exact-egrams",
tokenFilters = [
{
type = "icuFolding"
},
{
type = "lowercase"
},
{
maxGram = 15,
minGram = 5,
termNotInBounds = "include",
type = "edgeGram"
}
],
tokenizer = {
type = "whitespace"
}
}
atlas_search_analyzers = [
local.laurel_standard_atlas_search_analyzer,
local.laurel_standard_egrams_atlas_search_analyzer,
local.laurel_exact_atlas_search_analyzer,
local.laurel_exact_egrams_atlas_search_analyzer,
]
atlas_search_string_index_definition = {
analyzer = "laurel.standard-egrams"
multi = {
exact = {
analyzer = "laurel.exact-egrams"
searchAnalyzer = "laurel.exact"
type = "string"
}
}
searchAnalyzer = "laurel.standard"
type = "string"
}
}
Steps to Reproduce
- Create a search index using the above code (or any other search index, doesn't matter in our experience)
- Change the name of the search index ("test_v2" for example)
- Apply
Expected Behavior
Either the search index should be recreated with the new name or the name should be changed.
Actual Behavior
It says it's going to change the name and doesn't.
Debug Output
N/A
Crash Output
N/A
Additional Context
N/A
References
N/A
Thanks for opening this issue! Please make sure you've followed our guidelines when opening the issue. In short, to help us reproduce the issue we need:
- Terraform configuration file used to reproduce the issue
- Terraform log files from the run where the issue occurred
- Terraform Atlas provider version used to reproduce the issue
- Terraform version used to reproduce the issue
- Confirmation if Terraform OSS, Terraform Cloud, or Terraform Enterprise deployment
The ticket INTMDB-1275 was created for internal tracking.
Hi @icco Thanks for opening the issue. I was able to reproduce the bug. The issue is related to a bug with the Atlas endpoint rather than a bug with the provider. I am going to follow up internally to fix the endpoint. I will add an update as soon as the bug is fixed. Thanks
Adding https://jira.mongodb.org/browse/CLOUDP-210605 for internal tracking purposes. As an update we are working on fix but this one is likely going to be several months away. Thanks for raising issue and will share next update when we can.