Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend elasticsearch_index resource capabilities + fix issue #38 #39

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

Amos-85
Copy link
Contributor

@Amos-85 Amos-85 commented May 27, 2023

This PR solve issue #38 and extend capabilities of elasticsearch_index

The problem of var.indices as map(any) lead terraform raising an exception when defining nested maps in mappings attribute or any other string JSON that converted by jsonencode function from map(any) to string.

Terraform issue mentioned here about nested maps within map(any) variable .

Terraform Error:

  • cannot find a common base type for all elements

Expected behavior:

  • Defining nested maps inside JSON string attribute of terraform resource elasticsearch_index schema

Required Configuration E.g:

indices = {
    example-index-1 = {
      number_of_shards   = 2
      number_of_replicas = 1
    }
    example-index-2 = {
      number_of_shards   = 2
      number_of_replicas = 1
      mappings           =<<-EOF
      {
        "properties": {
          "id": {
            "type": "text"
          },
          "name": {
            "type": "text"
          },
          "containerType": {
            "type": "text"
          },
          "containerIds": {
            "type": "text"
          },
          "synonyms": {
            "type": "text"
          },
          "parentEvents": {
            "type": "text"
          },
          "valueType": {
            "type": "text"
          }
        }
      }
    EOF
    }
  }

Suggested Solution:

@steveteuber
Copy link
Member

Hi @Amos-85, thanks for your pull request.

That's really cool, i like it! But it's a breaking change.
This change will replace all indices in already existing clusters.

I think we should merge it when we switch to the new Terraform provider for OpenSearch.

@amontalban
Copy link
Contributor

Hi @Amos-85, thanks for your pull request.

That's really cool, i like it! But it's a breaking change. This change will replace all indices in already existing clusters.

I think we should merge it when we switch to the new Terraform provider for OpenSearch.

@steveteuber do you have a timeline for the OpenSearch provider migration? I have some needs that unfortunately this module doesn't offer and would like to help with the migration but not sure if it is an undergoing effort or it hasn't started yet.

Thanks!

@steveteuber
Copy link
Member

Hi @amontalban, I will start the migration next week.

@steveteuber steveteuber merged commit 43c7233 into idealo:main Dec 5, 2023
1 check passed
Copy link
Contributor

github-actions bot commented Dec 5, 2023

🎉 This PR is included in version 2.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants