Skip to content

Conversation

fatmcgav
Copy link
Contributor

@fatmcgav fatmcgav commented Oct 4, 2024

This commit adds a new data source elasticsearch_index_template.

@fatmcgav fatmcgav force-pushed the feat-index-template-ds branch from 1ac9dd3 to 87f2807 Compare October 4, 2024 13:25
This commit adds a new data source `elasticsearch_index_template`.
@fatmcgav fatmcgav force-pushed the feat-index-template-ds branch from 87f2807 to b20430e Compare October 4, 2024 13:25
@fatmcgav fatmcgav force-pushed the feat-index-template-ds branch from c5499e6 to 08c8094 Compare October 5, 2024 17:00
@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 6, 2024

Hmm, I'm confused why the integration tests are failing for new ds?

Unless the ilm-history-7 template doesn't exist in earlier versions maybe?

This template exists across `v7` and `v8`, so should pass the
integration tests... 🤞
@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 6, 2024

Right, I've switched to checking the logs template, as that seems to exist in both v7 and v8. 🤞

@tobio
Copy link
Member

tobio commented Oct 6, 2024

@fatmcgav maybe it would make sense for the acceptance test to first create a template, and then check that the data source can retrieve it instead of relying on default templates being present. WDYT?

@tobio
Copy link
Member

tobio commented Oct 7, 2024

Are you able to add an entry to the CHANGELOG for this one too please?

@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 7, 2024

@fatmcgav maybe it would make sense for the acceptance test to first create a template, and then check that the data source can retrieve it instead of relying on default templates being present. WDYT?

Yeh, that probably makes for the most stable tests... Will rework this morning 👍

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the changelog and acc test improvements.

This commit updates teh `template_data_source_test` to create a randomly
named index template and then use that index template to verify the data
source.
@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 7, 2024

Thanks @tobio... Tweaks pushed 👍

@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 7, 2024

Damn, something it still doesn't like there 😢 ... I'm struggling to run the integration tests locally due to environmental issues... will keep plugging away though...

@tobio
Copy link
Member

tobio commented Oct 7, 2024

@fatmcgav I believe 9e0f7da should fix the tests. Debugging these locally had the data source being executed before the template had been created.

@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 7, 2024

@fatmcgav I believe 9e0f7da should fix the tests. Debugging these locally had the data source being executed before the template had been created.

Ahh, that makes sense... Thanks for pushing the fix there...

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this!

@tobio tobio merged commit 3c8ebfd into elastic:main Oct 7, 2024
20 checks passed
@fatmcgav fatmcgav deleted the feat-index-template-ds branch October 7, 2024 11:28
@fatmcgav
Copy link
Contributor Author

fatmcgav commented Oct 7, 2024

@tobio Could I be cheeky and ask for a release? This ds will be useful in some work we're currently undertaking to manage all our ILM policies and index templates via Terraform... And with Kubernetes integration there's quite a few index templates that need to be copied for https://www.elastic.co/guide/en/fleet/current/data-streams-ilm-tutorial.html

👍

@tobio
Copy link
Member

tobio commented Oct 8, 2024

Could I be cheeky and ask for a release?

Not cheeky at all :) We'll aim to get a release out this week.

I'm not a big fan of leaving community contributions sitting unreleased for ages, you're generally not doing it just for fun.

kjwardy pushed a commit to kjwardy/terraform-provider-elasticstack that referenced this pull request Oct 21, 2024
* feat: Add `elasticsearch_index_template` data source

This commit adds a new data source `elasticsearch_index_template`.

* Fix lint failures

* Update docs template

* Switch to use the existing `logs` index template

This template exists across `v7` and `v8`, so should pass the
integration tests... 🤞

* Refactor acceptance test to create a new index template for testing

This commit updates teh `template_data_source_test` to create a randomly
named index template and then use that index template to verify the data
source.

* Add entry to CHANGELOG.md

* Fix format

* Add missing `fmt` import

* Reference the template resource to setup the right dependencies

---------

Co-authored-by: Toby Brain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants