Support migration of log indexes without Flex tier#333
Merged
michael-richey merged 3 commits intomainfrom Mar 20, 2025
Merged
Conversation
The Log Indexes API returns `num_flex_logs_retention_days` as `0` instead of `null` for indexes without the Flex tier, causing migration failures. This change removes the field when its value is `0` to prevent unnecessary Flex log-related parameters.
6 tasks
michael-richey
approved these changes
Mar 20, 2025
Collaborator
michael-richey
left a comment
There was a problem hiding this comment.
Thanks for the fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #328 to resolve CI issues related to forked PRs.
Closes #332
Requirements for Contributing to this repository
What does this PR do?
The Log Indexes API currently returns
num_flex_logs_retention_daysas 0 instead of null for indexes without the Flex tier, leading to migration failures when attempting to create or update log indexes in an organization where Flex logs are not enabled.This PR ensures that when
num_flex_logs_retention_daysis 0, the field is removed from the imported resource, preventing unnecessary Flex log-related parameters from being included in migration requests.Description of the Change
num_flex_logs_retention_dayswhen its value is 0.Alternate Designs
An alternative approach considered was to add a check in both the
create_resourceandupdate_resourcemethods to removenum_flex_logs_retention_dayswhen its value is 0.However, this was discarded because the issue originates from the Log Indexes API's get all indexes response, which returns
num_flex_logs_retention_daysas0instead ofnull. The create and update APIs do not have this issue, so modifying those methods would introduce unnecessary logic for a problem that only occurs in the retrieval step.Verification Process
Since an existing test for log index migration behavior is currently skipped, no new tests were added or modified.
Instead, manual verification was performed using the import command:
num_flex_logs_retention_daysfor indexes without the Flex tier.Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.