Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new resource alicloud_gpdb_elastic_instance and no longer supports to create new alicloud_gpdb_instance resource #3727

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

PrinceHenson
Copy link
Contributor

No description provided.

@PrinceHenson PrinceHenson force-pushed the gpdb_develop branch 3 times, most recently from 012ec9d to a03a449 Compare July 15, 2021 05:42
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"Postpaid", "Prepaid"}, false),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

payment_type 属性参考 alicloud_tsdb_instance 资源的方式处理下

d.Set("seg_node_num", instance["SegNodeNum"])
d.Set("storage_size", instance["StorageSize"])
d.Set("payment_type", instance["PayType"])
d.Set("instance_spec", convertDBInstanceClassToInstanceSpec(instance["DBInstanceClass"].(string)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance_spec 属性查询接口要支持返回, 不能通过 DBInstanceClass 去特殊处理获取

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance_spec 属性查询接口要支持返回, 不能通过 DBInstanceClass 去特殊处理获取

先这么搞,下周api修改发布之后再把特殊处理去掉。

@@ -19,6 +19,9 @@ You can see detail product introduction [here](https://www.alibabacloud.com/help

-> **NOTE:** Create instance or change instance would cost 10~15 minutes. Please make full preparation.

-> **NOTE:** This resource is used to manage a Reserved Storage Mode instance, and creating new reserved storage mode instance is no longer supported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标明从哪个版本开始不再支持


The following arguments are supported:

* `engine` (Required) Database engine: `gpdb`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ForceNew 的属性也需要标识

"DBInstanceDescription": d.Get("description"),
"SourceIp": client.SourceIp,
}
response, err := conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &util.RuntimeOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 common 调用的接口, 对 err 都需要用 NeedRetry 函数判断进行重试

runtime.SetAutoretry(true)
request["ClientToken"] = buildClientToken("CreateECSDBInstance")
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &runtime)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NeedRetry 重试

var response map[string]interface{}
runtime := util.RuntimeOptions{}
runtime.SetAutoretry(true)
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2016-05-03"), StringPointer("AK"), nil, request, &runtime)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NeedRetry 重试


import (
"fmt"
util "github.com/alibabacloud-go/tea-utils/service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

运行 make fmt 格式化下代码

}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{
"description": fmt.Sprintf("tf-testAccGpdbInstance_6.0"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

查询接口返回的属性都需要 Check 一下

"seg_node_num": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the seg_node_num has validate values or some limitations?

ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false),
},
"period": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the specific resource attribute payment_duration_unit instead period

Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the specific resource attribute payment_duration instead used_time

"storage_size": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the storage_size has validate values or some limitations?

Computed: true,
},
"security_ip_list": {
Type: schema.TypeSet,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the security_ip_list type should be schema.TypeList.

if err != nil {
return WrapError(err)
}
if d.HasChange("description") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description has been set in the Create API and there should check the d.IsNewResource()

if d.IsNewResource() {
d.Partial(false)
return resourceAlicloudGpdbElasticInstanceRead(d, meta)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block 272-275 is needless and it should be removed.

"security_ip_list.#": "1",
"security_ip_list.4095458986": "10.168.1.12",
}),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There missing the updating all attributes testcase.

return WrapErrorf(err, IdMsg, d.Id())
}
return resourceAlicloudGpdbInstanceUpdate(d, meta)
return Error("Sorry, creating new reserved storage mode instance is no longer supported since v1.127.0, you can use alicloud_gpdb_elastic_instance to create a flexible storage mode instance instead.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the OpenAPI does not offline, there can not offline this resource. You can add the statement in its docs by a NOTE

@@ -108,7 +108,7 @@ func testSweepGpdbInstances(region string) error {
return nil
}

func TestAccAlicloudGpdbInstance_classic(t *testing.T) {
func _TestAccAlicloudGpdbInstance_classic(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to skip the testcase, you can add a prefix Skip in the testcase name.

@PrinceHenson PrinceHenson force-pushed the gpdb_develop branch 3 times, most recently from 35aed56 to f81946c Compare July 16, 2021 09:13
…s to create new alicloud_gpdb_instance resource
@xiaozhu36 xiaozhu36 merged commit fdf7b83 into aliyun:master Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants