Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1399.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/tencentcloud_gaap_proxy: fix gaap proxy retry error `DuplicatedRequest`
```
2 changes: 1 addition & 1 deletion tencentcloud/resource_tc_gaap_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func resourceTencentCloudGaapProxy() *schema.Resource {
"tags": {
Type: schema.TypeMap,
Optional: true,
Description: "Tags of the GAAP proxy.",
Description: "Tags of the GAAP proxy. Tags that do not exist are not created automatically.",
},

// computed
Expand Down
12 changes: 6 additions & 6 deletions tencentcloud/service_tencentcloud_gaap.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ func (me *GaapService) CreateProxy(
createRequest.Concurrent = helper.IntUint64(concurrent)
createRequest.AccessRegion = &accessRegion
createRequest.RealServerRegion = &realserverRegion
createRequest.ClientToken = helper.String(helper.BuildToken())
for k, v := range tags {
createRequest.TagSet = append(createRequest.TagSet, &gaap.TagPair{
TagKey: helper.String(k),
Expand All @@ -334,6 +333,7 @@ func (me *GaapService) CreateProxy(

if err := resource.Retry(2*writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(createRequest.GetAction())
createRequest.ClientToken = helper.String(helper.BuildToken())

response, err := client.CreateProxy(createRequest)
if err != nil {
Expand Down Expand Up @@ -412,10 +412,10 @@ func (me *GaapService) EnableProxy(ctx context.Context, id string) error {

enableRequest := gaap.NewOpenProxiesRequest()
enableRequest.ProxyIds = []*string{&id}
enableRequest.ClientToken = helper.String(helper.BuildToken())

if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(enableRequest.GetAction())
enableRequest.ClientToken = helper.String(helper.BuildToken())

response, err := client.OpenProxies(enableRequest)
if err != nil {
Expand Down Expand Up @@ -491,10 +491,10 @@ func (me *GaapService) DisableProxy(ctx context.Context, id string) error {

disableRequest := gaap.NewCloseProxiesRequest()
disableRequest.ProxyIds = []*string{&id}
disableRequest.ClientToken = helper.String(helper.BuildToken())

if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(disableRequest.GetAction())
disableRequest.ClientToken = helper.String(helper.BuildToken())

response, err := client.CloseProxies(disableRequest)
if err != nil {
Expand Down Expand Up @@ -649,10 +649,10 @@ func (me *GaapService) ModifyProxyName(ctx context.Context, id, name string) err
request := gaap.NewModifyProxiesAttributeRequest()
request.ProxyIds = []*string{&id}
request.ProxyName = &name
request.ClientToken = helper.String(helper.BuildToken())

if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
request.ClientToken = helper.String(helper.BuildToken())

if _, err := me.client.UseGaapClient().ModifyProxiesAttribute(request); err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]",
Expand All @@ -674,10 +674,10 @@ func (me *GaapService) ModifyProxyProjectId(ctx context.Context, id string, proj
request := gaap.NewModifyProxiesProjectRequest()
request.ProxyIds = []*string{&id}
request.ProjectId = helper.IntInt64(projectId)
request.ClientToken = helper.String(helper.BuildToken())

if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
request.ClientToken = helper.String(helper.BuildToken())

if _, err := me.client.UseGaapClient().ModifyProxiesProject(request); err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]",
Expand Down Expand Up @@ -705,10 +705,10 @@ func (me *GaapService) ModifyProxyConfiguration(ctx context.Context, id string,
if concurrent != nil {
modifyRequest.Concurrent = helper.IntUint64(*concurrent)
}
modifyRequest.ClientToken = helper.String(helper.BuildToken())

if err := resource.Retry(2*writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(modifyRequest.GetAction())
modifyRequest.ClientToken = helper.String(helper.BuildToken())

if _, err := client.ModifyProxyConfiguration(modifyRequest); err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/gaap_proxy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The following arguments are supported:
* `realserver_region` - (Required, String, ForceNew) Region of the GAAP realserver. Valid value: `NorthChina`, `EastChina`, `SouthChina`, `SouthwestChina`, `Hongkong`, `SL_TAIWAN`, `SoutheastAsia`, `Korea`, `SL_India`, `SL_Australia`, `Europe`, `SL_UK`, `SL_SouthAmerica`, `NorthAmerica`, `SL_MiddleUSA`, `Canada`, `SL_VIET`, `WestIndia`, `Thailand`, `Virginia`, `Russia`, `Japan` and `SL_Indonesia`.
* `enable` - (Optional, Bool) Indicates whether GAAP proxy is enabled, default value is `true`.
* `project_id` - (Optional, Int) ID of the project within the GAAP proxy, `0` means is default project.
* `tags` - (Optional, Map) Tags of the GAAP proxy.
* `tags` - (Optional, Map) Tags of the GAAP proxy. Tags that do not exist are not created automatically.

## Attributes Reference

Expand Down