Skip to content

Commit 0fe42c5

Browse files
Terraform Team AutomationMaxrovr
authored andcommitted
Bug Fix - Fix function batching terraform bug
1 parent 11e5c91 commit 0fe42c5

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

examples/service_connector_hub/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,16 @@ resource "oci_sch_service_connector" "test_service_connector" {
138138
"Department" = "Accounting"
139139
}
140140

141-
/* source {
142-
kind = "logging"
141+
/* source {
142+
kind = "logging"
143143
144-
log_sources {
145-
compartment_id = var.compartment_ocid
146-
log_group_id = oci_logging_log_group.test_log_group.id
147-
log_id = oci_logging_log.test_log.id
148-
}
149-
}
150-
*/
144+
log_sources {
145+
compartment_id = var.compartment_ocid
146+
log_group_id = oci_logging_log_group.test_log_group.id
147+
log_id = oci_logging_log.test_log.id
148+
}
149+
}
150+
*/
151151

152152
// If using streaming source
153153
source {
@@ -243,6 +243,6 @@ resource "oci_sch_service_connector" "test_connector_plugins" {
243243
// Optional
244244
batch_size_in_kbs = "5000"
245245
// Optional
246-
batch_time_in_sec = "61"
246+
batch_time_in_sec = "62"
247247
}
248248
}

internal/service/sch/sch_service_connector_resource.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,15 +1551,18 @@ func (s *SchServiceConnectorResourceCrud) mapToTargetDetails(fieldKeyFormat stri
15511551
switch strings.ToLower(kind) {
15521552
case strings.ToLower("functions"):
15531553
details := oci_sch.FunctionsTargetDetails{}
1554-
if batchSizeInKbs, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_size_in_kbs")); ok {
1554+
batchSizeInKbs, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_size_in_kbs"))
1555+
if ok && batchSizeInKbs != 0 {
15551556
tmp := batchSizeInKbs.(int)
15561557
details.BatchSizeInKbs = &tmp
15571558
}
1558-
if batchSizeInNum, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_size_in_num")); ok {
1559+
batchSizeInNum, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_size_in_num"))
1560+
if ok && batchSizeInNum != 0 {
15591561
tmp := batchSizeInNum.(int)
15601562
details.BatchSizeInNum = &tmp
15611563
}
1562-
if batchTimeInSec, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_time_in_sec")); ok {
1564+
batchTimeInSec, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "batch_time_in_sec"))
1565+
if ok && batchTimeInSec != 0 {
15631566
tmp := batchTimeInSec.(int)
15641567
details.BatchTimeInSec = &tmp
15651568
}

0 commit comments

Comments
 (0)