2020-12-09 15:31:34 +00:00
|
|
|
package aws
|
|
|
|
|
2021-04-29 14:36:05 +00:00
|
|
|
import (
|
|
|
|
"github.com/cloudskiff/driftctl/pkg/resource"
|
|
|
|
)
|
2021-03-25 11:13:52 +00:00
|
|
|
|
2020-12-09 15:31:34 +00:00
|
|
|
const AwsS3BucketResourceType = "aws_s3_bucket"
|
|
|
|
|
2021-04-29 14:36:05 +00:00
|
|
|
func initAwsS3BucketMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
|
2021-08-09 15:15:35 +00:00
|
|
|
resourceSchemaRepository.SetResolveReadAttributesFunc(AwsS3BucketResourceType, func(res *resource.Resource) map[string]string {
|
|
|
|
return map[string]string{
|
|
|
|
"alias": *res.Attributes().GetString("region"),
|
|
|
|
}
|
|
|
|
})
|
2021-04-29 14:36:05 +00:00
|
|
|
resourceSchemaRepository.UpdateSchema(AwsS3BucketResourceType, map[string]func(attributeSchema *resource.AttributeSchema){
|
|
|
|
"policy": func(attributeSchema *resource.AttributeSchema) {
|
|
|
|
attributeSchema.JsonString = true
|
|
|
|
},
|
|
|
|
})
|
2021-08-09 14:03:04 +00:00
|
|
|
resourceSchemaRepository.SetNormalizeFunc(AwsS3BucketResourceType, func(res *resource.Resource) {
|
2021-05-24 15:19:06 +00:00
|
|
|
val := res.Attrs
|
2021-04-29 14:36:05 +00:00
|
|
|
val.SafeDelete([]string{"force_destroy"})
|
2021-06-15 16:55:32 +00:00
|
|
|
val.SafeDelete([]string{"bucket_prefix"})
|
2021-04-29 14:36:05 +00:00
|
|
|
})
|
2021-09-17 15:16:06 +00:00
|
|
|
resourceSchemaRepository.SetFlags(AwsS3BucketResourceType, resource.FlagDeepMode)
|
2021-04-29 14:36:05 +00:00
|
|
|
}
|