Skip to content

Conversation

@vsinghal13
Copy link
Collaborator

@vsinghal13 vsinghal13 commented Jan 14, 2026

Description

Fixes a bug where hosted collector creation would show an error to the user despite the collector being successfully created.

Problem

The resourceSumologicCollectorCreate function was using a two-step process:

  1. Create a minimal collector (only name and collectorType)
  2. Call resourceSumologicCollectorUpdate to set remaining fields

If step 2 failed (due to ETag issues, timing problems, or API errors), the function would return an error even though the collector was already created in step 1. This led to:

  • Confusing error messages for users
  • Collectors existing in Sumo Logic but not in Terraform state
  • Potential issues with retry attempts creating duplicate collectors

Solution

Changed resourceSumologicCollectorCreate to include all fields in the initial CreateCollector API call:

  • name
  • description
  • category
  • timezone (with default "Etc/UTC")
  • fields

The function now calls resourceSumologicCollectorRead directly instead of going through resourceSumologicCollectorUpdate.

Backward Compatibility

This change is fully backward compatible:

  • Optional fields use omitempty JSON tags, so empty values aren't sent to the API
  • The Sumo Logic API accepts all these fields during collector creation
  • Behavior is identical to the previous implementation, just without the separate update step

Check list

@vsinghal13 vsinghal13 requested a review from maimaisie as a code owner January 14, 2026 17:41
@github-actions
Copy link

⚠️ Warning: Please update CHANGELOG.md with your changes.

@vsinghal13 vsinghal13 added the collection Item is related to data collection aspect of Sumo Logic. label Jan 14, 2026
@vsinghal13 vsinghal13 requested a review from a team as a code owner January 14, 2026 17:46
Copy link
Collaborator

@rishabhkhatri09 rishabhkhatri09 left a comment

Choose a reason for hiding this comment

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

Let's also check if any acceptance test also needs to be updated, otherwise LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

collection Item is related to data collection aspect of Sumo Logic.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants