driftctl/pkg/resource/aws/aws_kms_key.go

55 lines
1.9 KiB
Go
Raw Normal View History

2021-02-24 17:49:02 +00:00
// GENERATED, DO NOT EDIT THIS FILE
package aws
2021-05-17 10:09:35 +00:00
import (
"github.com/cloudskiff/driftctl/pkg/helpers"
"github.com/cloudskiff/driftctl/pkg/resource"
"github.com/zclconf/go-cty/cty"
)
2021-03-25 11:13:52 +00:00
2021-02-24 17:49:02 +00:00
const AwsKmsKeyResourceType = "aws_kms_key"
type AwsKmsKey struct {
Arn *string `cty:"arn" computed:"true"`
CustomerMasterKeySpec *string `cty:"customer_master_key_spec"`
DeletionWindowInDays *int `cty:"deletion_window_in_days" diff:"-"`
Description *string `cty:"description" computed:"true"`
EnableKeyRotation *bool `cty:"enable_key_rotation"`
Id string `cty:"id" computed:"true"`
IsEnabled *bool `cty:"is_enabled"`
KeyId *string `cty:"key_id" computed:"true"`
KeyUsage *string `cty:"key_usage"`
Policy *string `cty:"policy" jsonstring:"true" computed:"true"`
Tags map[string]string `cty:"tags"`
2021-03-25 11:13:52 +00:00
CtyVal *cty.Value `diff:"-"`
2021-02-24 17:49:02 +00:00
}
func (r *AwsKmsKey) TerraformId() string {
return r.Id
}
func (r *AwsKmsKey) TerraformType() string {
return AwsKmsKeyResourceType
}
2021-03-25 11:13:52 +00:00
func (r *AwsKmsKey) CtyValue() *cty.Value {
return r.CtyVal
}
2021-05-17 10:09:35 +00:00
func initAwsKmsKeyMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
resourceSchemaRepository.UpdateSchema(AwsKmsKeyResourceType, map[string]func(attributeSchema *resource.AttributeSchema){
"policy": func(attributeSchema *resource.AttributeSchema) {
attributeSchema.JsonString = true
},
})
resourceSchemaRepository.SetNormalizeFunc(AwsKmsKeyResourceType, func(res *resource.AbstractResource) {
val := res.Attrs
2021-05-17 10:09:35 +00:00
val.SafeDelete([]string{"deletion_window_in_days"})
jsonString, err := helpers.NormalizeJsonString((*val)["policy"])
if err != nil {
return
}
val.SafeSet([]string{"policy"}, jsonString)
})
}