-
Notifications
You must be signed in to change notification settings - Fork 536
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
Conversation
012ec9d
to
a03a449
Compare
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validation.StringInSlice([]string{"Postpaid", "Prepaid"}, false), |
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance_spec
属性查询接口要支持返回, 不能通过 DBInstanceClass
去特殊处理获取
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 common 调用的接口, 对 err 都需要用 NeedRetry 函数判断进行重试
a03a449
to
8216b00
Compare
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NeedRetry 重试
alicloud/service_alicloud_gpdb.go
Outdated
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) |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
运行 make fmt 格式化下代码
8216b00
to
4ea4001
Compare
}), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheck(map[string]string{ | ||
"description": fmt.Sprintf("tf-testAccGpdbInstance_6.0"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
查询接口返回的属性都需要 Check 一下
4ea4001
to
7efb92a
Compare
"seg_node_num": { | ||
Type: schema.TypeInt, | ||
Required: true, | ||
ForceNew: true, |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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) | ||
} |
There was a problem hiding this comment.
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", | ||
}), | ||
), |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
35aed56
to
f81946c
Compare
…s to create new alicloud_gpdb_instance resource
f81946c
to
65f4e54
Compare
No description provided.