Skip to content

Commit eba85f2

Browse files
author
Nishant Burte
committed
Fix flowlog crash
While creating FlowLog, if logDestnation does not exist then CreateFlowLogsWithContext does not return the error. However, Unsuccessful field in the response is set. FlowLog is not created in aws. Due to this, controller crashes while accessing the flow log id from the response (resp.FlowLogIds[0]). Fixing the issue by checking if FlowLogIds has valid length before accessing it.
1 parent 73fe383 commit eba85f2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/resource/flow_log/sdk.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
if resp.FlowLogIds[0] != nil {
1+
if len(resp.FlowLogIds) > 0 && resp.FlowLogIds[0] != nil {
22
ko.Status.FlowLogID = resp.FlowLogIds[0]
33
}

0 commit comments

Comments
 (0)