Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mmv1/products/cloudsecuritycompliance/Framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ properties:
type: Array
description: The supported enforcement modes of the framework.
output: true
custom_flatten: templates/terraform/custom_flatten/cloudsecuritycompliance_framework_supported_enforcement_modes.go.tmpl
item_type:
type: String
- name: supportedTargetResourceTypes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
rawConfigValue := d.Get("supported_enforcement_modes")

// Convert config value to []string
configValue, err := tpgresource.InterfaceSliceToStringSlice(rawConfigValue)
if err != nil {
log.Printf("[ERROR] Failed to convert config value: %s", err)
return v
}

// Convert v to []string
apiStringValue, err := tpgresource.InterfaceSliceToStringSlice(v)
if err != nil {
log.Printf("[ERROR] Failed to convert API value: %s", err)
return v
}

sortedStrings, err := tpgresource.SortStringsByConfigOrder(configValue, apiStringValue)
if err != nil {
log.Printf("[ERROR] Could not sort API response value: %s", err)
return v
}

return sortedStrings
}