driftctl/pkg/resource/aws/aws_route53_record.go

34 lines
1.1 KiB
Go
Raw Normal View History

package aws
2021-05-17 15:03:10 +00:00
import (
"github.com/cloudskiff/driftctl/pkg/resource"
)
2021-03-25 11:13:52 +00:00
const AwsRoute53RecordResourceType = "aws_route53_record"
2021-05-17 15:03:10 +00:00
func initAwsRoute53RecordMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
2021-08-09 14:03:04 +00:00
resourceSchemaRepository.SetNormalizeFunc(AwsRoute53RecordResourceType, func(res *resource.Resource) {
val := res.Attrs
2021-05-17 15:03:10 +00:00
val.DeleteIfDefault("health_check_id")
val.DeleteIfDefault("set_identifier")
val.DeleteIfDefault("ttl")
val.SafeDelete([]string{"name"})
val.SafeDelete([]string{"allow_overwrite"})
})
2021-08-09 14:03:04 +00:00
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsRoute53RecordResourceType, func(res *resource.Resource) map[string]string {
2021-05-21 14:09:45 +00:00
val := res.Attrs
attrs := make(map[string]string)
if fqdn := val.GetString("fqdn"); fqdn != nil && *fqdn != "" {
attrs["Fqdn"] = *fqdn
}
if ty := val.GetString("type"); ty != nil && *ty != "" {
attrs["Type"] = *ty
}
if zoneID := val.GetString("zone_id"); zoneID != nil && *zoneID != "" {
attrs["ZoneId"] = *zoneID
}
return attrs
})
2021-09-17 15:16:06 +00:00
resourceSchemaRepository.SetFlags(AwsRoute53RecordResourceType, resource.FlagDeepMode)
2021-05-17 15:03:10 +00:00
}