Skip to content

Conversation

@shinsj4653
Copy link

Description

Fixes a panic that occurs when the notifications list in case or third_party_case blocks contains nil or empty values.

Closes #3322

Changes

  • Modified parseStringArray() to use safe type assertion pattern
  • Added nil check before type conversion to prevent runtime panic
  • Added unit tests to verify the fix

Root Cause

The parseStringArray() function used direct type assertion (value.(string)) which panics when the value is nil. This happens when users specify notifications = [""] or notifications = [null] in their Terraform configuration.

Solution

Applied safe type assertion pattern with nil check:

// Before (panic prone)
parsed[idx] = value.(string)

// After (safe)
if value == nil {
    continue
}
if strVal, ok := value.(string); ok {
    parsed = append(parsed, strVal)
}

Testing

  • Unit tests for parseStringArray() - all pass
  • Existing acceptance tests - no regression

@shinsj4653 shinsj4653 requested review from a team as code owners January 4, 2026 02:05
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.

Terraform provider panics when case notifications list contains an empty entry

1 participant