driftctl/pkg/resource/aws/aws_s3_bucket_policy.go

45 lines
1.3 KiB
Go

// GENERATED, DO NOT EDIT THIS FILE
package aws
import (
"github.com/cloudskiff/driftctl/pkg/helpers"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/zclconf/go-cty/cty"
)
const AwsS3BucketPolicyResourceType = "aws_s3_bucket_policy"
type AwsS3BucketPolicy struct {
Bucket *string `cty:"bucket" diff:"-"`
Id string `cty:"id" diff:"-" computed:"true"`
Policy *string `cty:"policy" jsonstring:"true"`
CtyVal *cty.Value `diff:"-"`
}
func (r *AwsS3BucketPolicy) TerraformId() string {
return r.Id
}
func (r *AwsS3BucketPolicy) TerraformType() string {
return AwsS3BucketPolicyResourceType
}
func (r *AwsS3BucketPolicy) CtyValue() *cty.Value {
return r.CtyVal
}
func initAwsS3BucketPolicyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
resourceSchemaRepository.UpdateSchema(AwsS3BucketPolicyResourceType, map[string]func(attributeSchema *resource.AttributeSchema){
"policy": func(attributeSchema *resource.AttributeSchema) {
attributeSchema.JsonString = true
},
})
resourceSchemaRepository.SetNormalizeFunc(AwsS3BucketPolicyResourceType, func(val *resource.Attributes) {
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
if err != nil {
return
}
val.SafeSet([]string{"policy"}, jsonString)
})
}