From 1f066469dbc392caa34d10a42b6d02b2a4fc3ffa Mon Sep 17 00:00:00 2001 From: Axton Grams Date: Thu, 27 Oct 2022 14:38:03 -0500 Subject: [PATCH] Fix: Panic on data source wiz_cloud_configuration_rules (#33) * fix panic on data wiz_cloud_configuration_rules if a returned rule does not have a control * disabled github action `tests` on push --- .github/workflows/test.yml | 3 --- internal/provider/data_source_cloud_configuration_rules.go | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c787a58..bb4fd71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,6 @@ on: pull_request: paths-ignore: - 'README.md' - push: - paths-ignore: - - 'README.md' jobs: # ensure the code builds... build: diff --git a/internal/provider/data_source_cloud_configuration_rules.go b/internal/provider/data_source_cloud_configuration_rules.go index c4c1b02..3e17a42 100644 --- a/internal/provider/data_source_cloud_configuration_rules.go +++ b/internal/provider/data_source_cloud_configuration_rules.go @@ -721,7 +721,9 @@ func flattenCloudConfigurationRules(ctx context.Context, nodes *[]*vendor.CloudC ruleMap["builtin"] = *b.Builtin ruleMap["opa_policy"] = b.OPAPolicy ruleMap["function_as_control"] = *b.FunctionAsControl - ruleMap["control_id"] = b.Control.ID + if b.Control != nil { + ruleMap["control_id"] = b.Control.ID + } ruleMap["graph_id"] = b.GraphID ruleMap["has_auto_remediation"] = *b.HasAutoRemediation ruleMap["remediation_instructions"] = b.RemediationInstructions