Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: can't update iot topic rule with kafka destination #33360

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/33360.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_iot_topic_rule: Fix error when updating topic_rule with destination type kafka.
```
10 changes: 10 additions & 0 deletions internal/service/iot/topic_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -1679,28 +1679,38 @@ func expandKafkaAction(tfList []interface{}) *iot.KafkaAction {
if len(tfList) == 0 || tfList[0] == nil {
return nil
}
empty := true

apiObject := &iot.KafkaAction{}
tfMap := tfList[0].(map[string]interface{})

if v, ok := tfMap["client_properties"].(map[string]interface{}); ok && len(v) > 0 {
apiObject.ClientProperties = flex.ExpandStringMap(v)
empty = false
}

if v, ok := tfMap["destination_arn"].(string); ok && v != "" {
apiObject.DestinationArn = aws.String(v)
empty = false
}

if v, ok := tfMap["key"].(string); ok && v != "" {
apiObject.Key = aws.String(v)
empty = false
}

if v, ok := tfMap["partition"].(string); ok && v != "" {
apiObject.Partition = aws.String(v)
empty = false
}

if v, ok := tfMap["topic"].(string); ok && v != "" {
apiObject.Topic = aws.String(v)
empty = false
}

if empty {
return nil
}

return apiObject
Expand Down
Loading
Loading