aiven / terraform-provider-aiven

Aiven Terraform Provider
https://registry.terraform.io/providers/aiven/aiven/latest/docs
MIT License
126 stars 69 forks source link

[Opensearch] Index templates configuration in Aiven Terraform #1600

Closed IrfanSali closed 6 months ago

IrfanSali commented 6 months ago

What can we help you with?

I would like to use the Aiven Terraform Registry, but it seems that the index_pattern and the template fields are missing from the ressource, which would prevent me from using the index templates The Opensearch documentation: https://opensearch.org/docs/latest/im-plugin/index-templates/

Where would you expect to find this information?

The respective documentation about this feature: https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/opensearch#nested-schema-for-opensearch_user_configindex_patterns and
https://github.com/aiven/terraform-provider-aiven/blob/main/docs/resources/opensearch.md#nested-schema-for-opensearch_user_configindex_template

Serpentiel commented 6 months ago

Hey, @IrfanSali! ๐Ÿ‘‹

Thank you for raising this concern.

I will check things out and will reach out to you shortly.

Serpentiel commented 6 months ago

Hey, @IrfanSali! ๐Ÿ‘‹

Looks like both index_patterns and index_template are available in the OpenSearch resource.

Here's an example of the usage:

resource "aiven_opensearch" "bar-os" {
  project                 = "test-project"
  cloud_name              = "google-europe-west1"
  plan                    = "startup-4"
  service_name            = "test"
  maintenance_window_dow  = "monday"
  maintenance_window_time = "10:00:00"

  tag {
    key   = "test"
    value = "val"
  }

  opensearch_user_config {
    opensearch_dashboards {
      enabled = true
    }

    public_access {
      opensearch            = true
      opensearch_dashboards = true
    }

    index_patterns {
      pattern           = "logs_*_foo_*"
      max_index_count   = 3
      sorting_algorithm = "creation_date"
    }

    index_patterns {
      pattern           = "logs_*_bar_*"
      max_index_count   = 15
      sorting_algorithm = "creation_date"
    }

    index_template {
      mapping_nested_objects_limit = 12000
    }
  }
}

I will close this issue for now. Please let me know if you have any further questions or concerns.

IrfanSali commented 6 months ago

HI, I've never questionned the presence of the index_template within the provider only the discrepancy between the fields in itself and the ones in the opensearch API

Serpentiel commented 6 months ago

Hey, @IrfanSali! ๐Ÿ‘‹

I'm sorry for any misunderstanding, perhaps I didn't fully understand what you meant by this:

but it seems that the index_pattern and the template fields are missing from the ressource

I will try to give you an answer. Aiven Provider for Terraform provides basic access to the OpenSearch service via the Public API of Aiven. We don't use OpenSearch API directly, and there are no plans to do that. That's the reason why some fields might be missing, or be a bit different from the full configuration that could be available for the service.

If you would like to use Terraform to manage your OpenSearch service, you can combine Aiven Provider for Terraform with the OpenSearch Provider, which would enable for more granular configuration of your OpenSearch service.

This is a good practice, and I would recommend doing that for any service where you would want to do any kind of advanced configuration, or something that is not available in our provider.

Please let me know if this doesn't answers your question, thank you!

IrfanSali commented 6 months ago

Thanks for the answer ๐Ÿ˜„ , I'm going to use the opensearch API for those kinds of calls