diff --git a/lacework/resource_lacework_integration_docker_hub.go b/lacework/resource_lacework_integration_docker_hub.go index c0c85d0b6..0a09943ea 100644 --- a/lacework/resource_lacework_integration_docker_hub.go +++ b/lacework/resource_lacework_integration_docker_hub.go @@ -185,7 +185,9 @@ func resourceLaceworkIntegrationDockerHubRead(d *schema.ResourceData, meta inter d.Set("limit_num_imgs", response.Data.Data.LimitNumImg) d.Set("limit_by_tags", response.Data.Data.LimitByTag) d.Set("limit_by_repositories", response.Data.Data.LimitByRep) - d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + if limitByLabelsLength(response.Data.Data.LimitByLabel) != 0 { + d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + } log.Printf("[INFO] Read %s registry type with guid: %v\n", api.DockerhubContainerRegistry.String(), integration.IntgGuid) return nil diff --git a/lacework/resource_lacework_integration_docker_v2.go b/lacework/resource_lacework_integration_docker_v2.go index b06e8c026..281088c0d 100644 --- a/lacework/resource_lacework_integration_docker_v2.go +++ b/lacework/resource_lacework_integration_docker_v2.go @@ -183,7 +183,9 @@ func resourceLaceworkIntegrationDockerV2Read(d *schema.ResourceData, meta interf d.Set("non_os_package_support", integration.Data.NonOSPackageEval) d.Set("notifications", integration.Data.RegistryNotifications) d.Set("limit_by_tags", response.Data.Data.LimitByTag) - d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + if limitByLabelsLength(response.Data.Data.LimitByLabel) != 0 { + d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + } log.Printf("[INFO] Read %s registry type with guid: %v\n", api.DockerhubV2ContainerRegistry.String(), integration.IntgGuid) return nil diff --git a/lacework/resource_lacework_integration_gar.go b/lacework/resource_lacework_integration_gar.go index 8673306fc..db23aab5e 100644 --- a/lacework/resource_lacework_integration_gar.go +++ b/lacework/resource_lacework_integration_gar.go @@ -273,7 +273,9 @@ func resourceLaceworkIntegrationGarRead(d *schema.ResourceData, meta interface{} d.Set("limit_num_imgs", response.Data.Data.LimitNumImg) d.Set("limit_by_tags", response.Data.Data.LimitByTag) d.Set("limit_by_repositories", response.Data.Data.LimitByRep) - d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + if limitByLabelsLength(response.Data.Data.LimitByLabel) != 0 { + d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + } log.Printf("[INFO] Read ContVulnCfg integration for %s registry type with guid %s\n", api.GcpGarContainerRegistry.String(), response.Data.IntgGuid) diff --git a/lacework/resource_lacework_integration_gcr.go b/lacework/resource_lacework_integration_gcr.go index ec36d1a3b..2e530e2fc 100644 --- a/lacework/resource_lacework_integration_gcr.go +++ b/lacework/resource_lacework_integration_gcr.go @@ -239,7 +239,9 @@ func resourceLaceworkIntegrationGcrRead(d *schema.ResourceData, meta interface{} d.Set("non_os_package_support", integration.Data.NonOSPackageEval) d.Set("limit_by_tags", response.Data.Data.LimitByTag) d.Set("limit_by_repositories", response.Data.Data.LimitByRep) - d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + if limitByLabelsLength(response.Data.Data.LimitByLabel) != 0 { + d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + } log.Printf("[INFO] Read %s registry type with guid: %v\n", api.GcpGcrContainerRegistry.String(), integration.IntgGuid) return nil diff --git a/lacework/resource_lacework_integration_ghcr.go b/lacework/resource_lacework_integration_ghcr.go index 04f36aa0f..86c0cc36f 100644 --- a/lacework/resource_lacework_integration_ghcr.go +++ b/lacework/resource_lacework_integration_ghcr.go @@ -207,7 +207,9 @@ func resourceLaceworkIntegrationGhcrRead(d *schema.ResourceData, meta interface{ d.Set("limit_num_imgs", response.Data.Data.LimitNumImg) d.Set("limit_by_tags", response.Data.Data.LimitByTag) d.Set("limit_by_repositories", response.Data.Data.LimitByRep) - d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + if limitByLabelsLength(response.Data.Data.LimitByLabel) != 0 { + d.Set("limit_by_label", castArrayOfStringKeyMapOfStringsToLimitByLabelSet(response.Data.Data.LimitByLabel)) + } log.Printf("[INFO] Read ContVulnCfg integration for %s registry type with guid %s\n", api.GhcrContainerRegistry.String(), response.Data.IntgGuid)