driftctl/pkg/resource/aws/aws_cloudformation_stack.go

27 lines
939 B
Go
Raw Normal View History

2021-09-08 09:16:44 +00:00
package aws
import (
"strconv"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/hashicorp/terraform/flatmap"
)
const AwsCloudformationStackResourceType = "aws_cloudformation_stack"
func initAwsCloudformationStackMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
resourceSchemaRepository.SetResolveReadAttributesFunc(AwsCloudformationStackResourceType, func(res *resource.Resource) map[string]string {
attrs := make(map[string]interface{})
if v := res.Attributes().GetMap("parameters"); v != nil {
attrs["parameters.%"] = strconv.FormatInt(int64(len(v)), 10)
attrs["parameters"] = v
}
return flatmap.Flatten(attrs)
})
resourceSchemaRepository.SetNormalizeFunc(AwsCloudformationStackResourceType, func(res *resource.Resource) {
val := res.Attrs
val.SafeDelete([]string{"timeouts"})
})
2021-09-17 15:16:06 +00:00
resourceSchemaRepository.SetFlags(AwsCloudformationStackResourceType, resource.FlagDeepMode)
2021-09-08 09:16:44 +00:00
}