Skip to content

Commit 38ce5c6

Browse files
shasshsiMaxrovr
authored andcommitted
Bug Fix - Detector_recipe_resource entityMapping fix
1 parent 3140307 commit 38ce5c6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

internal/integrationtest/cloud_guard_detector_recipe_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestCloudGuardDetectorRecipeResource_basic(t *testing.T) {
124124
acctest.GenerateResourceFromRepresentationMap("oci_cloud_guard_detector_recipe", "test_detector_recipe", acctest.Optional, acctest.Create, CloudGuardDetectorRecipeRepresentation), "cloudguard", "detectorRecipe", t)
125125

126126
acctest.ResourceTest(t, testAccCheckCloudGuardDetectorRecipeDestroy, []resource.TestStep{
127-
// verify Create
127+
// verify Create Recipe
128128
{
129129
Config: config + compartmentIdVariableStr + CloudGuardDetectorRecipeResourceDependencies +
130130
acctest.GenerateResourceFromRepresentationMap("oci_cloud_guard_detector_recipe", "test_detector_recipe", acctest.Required, acctest.Create, CloudGuardDetectorRecipeRepresentation),
@@ -140,7 +140,7 @@ func TestCloudGuardDetectorRecipeResource_basic(t *testing.T) {
140140
),
141141
},
142142

143-
// delete before next Create
143+
// Test delete before next Create
144144
{
145145
Config: config + compartmentIdVariableStr + CloudGuardDetectorRecipeResourceDependencies,
146146
},

internal/service/cloud_guard/cloud_guard_detector_recipe_resource.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,5 +1288,19 @@ func (s *CloudGuardDetectorRecipeResourceCrud) mapToConfigValue(fieldKeyFormat s
12881288
func (s *CloudGuardDetectorRecipeResourceCrud) mapToEntitiesMapping(fieldKeyFormat string) (oci_cloud_guard.EntitiesMapping, error) {
12891289
result := oci_cloud_guard.EntitiesMapping{}
12901290

1291+
if displayName, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "display_name")); ok {
1292+
tmp := displayName.(string)
1293+
result.DisplayName = &tmp
1294+
}
1295+
1296+
if queryField, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "query_field")); ok {
1297+
tmp := queryField.(string)
1298+
result.QueryField = &tmp
1299+
}
1300+
1301+
if entityType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "entity_type")); ok {
1302+
result.EntityType = oci_cloud_guard.EntityTypeEnum(entityType.(string))
1303+
}
1304+
12911305
return result, nil
12921306
}

0 commit comments

Comments
 (0)