From 5639c353894ca3a3cf977565b93ed5d6c8a02a8e Mon Sep 17 00:00:00 2001 From: anton-sidelnikov Date: Wed, 28 Jun 2023 11:34:05 +0200 Subject: [PATCH] validations --- .../dis/resource_opentelekomcloud_dis_stream_v2.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/opentelekomcloud/services/dis/resource_opentelekomcloud_dis_stream_v2.go b/opentelekomcloud/services/dis/resource_opentelekomcloud_dis_stream_v2.go index a92ba103c..1a23c1195 100644 --- a/opentelekomcloud/services/dis/resource_opentelekomcloud_dis_stream_v2.go +++ b/opentelekomcloud/services/dis/resource_opentelekomcloud_dis_stream_v2.go @@ -54,18 +54,27 @@ func ResourceDisStreamV2() *schema.Resource { Computed: true, Optional: true, ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "COMMON", "ADVANCED", + }, false), }, "data_type": { Type: schema.TypeString, Computed: true, Optional: true, ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "BLOB", + }, false), }, "compression_format": { Type: schema.TypeString, Computed: true, Optional: true, ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "snappy", "gzip", "zip", + }, false), }, "auto_scale_min_partition_count": { Type: schema.TypeInt, @@ -152,14 +161,13 @@ func resourceDisStreamV2Create(ctx context.Context, d *schema.ResourceData, meta Tags: common.ExpandResourceTags(d.Get("tags").(map[string]interface{})), } + opts.AutoScaleEnabled = pointerto.Bool(false) autoScaleMinPartitionCount := d.Get("auto_scale_min_partition_count").(int) autoScaleMaxPartitionCount := d.Get("auto_scale_max_partition_count").(int) if autoScaleMinPartitionCount > 0 && autoScaleMaxPartitionCount > 0 { opts.AutoScaleEnabled = pointerto.Bool(true) opts.AutoScaleMinPartitionCount = &autoScaleMinPartitionCount opts.AutoScaleMaxPartitionCount = &autoScaleMaxPartitionCount - } else { - opts.AutoScaleEnabled = pointerto.Bool(false) } log.Printf("[DEBUG] Creating new Stream: %#v", opts)