driftctl/pkg/resource/aws/aws_sns_topic_policy.go

20 lines
581 B
Go

package aws
import (
"github.com/snyk/driftctl/enumeration/resource"
"github.com/snyk/driftctl/enumeration/resource/aws"
"github.com/snyk/driftctl/pkg/helpers"
)
func initSnsTopicPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
resourceSchemaRepository.SetNormalizeFunc(aws.AwsSnsTopicPolicyResourceType, func(res *resource.Resource) {
val := res.Attrs
val.SafeDelete([]string{"owner"})
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
if err != nil {
return
}
_ = val.SafeSet([]string{"policy"}, jsonString)
})
}