Skip to content

Commit

Permalink
feat(as): [119585998] add new resource (#2814)
Browse files Browse the repository at this point in the history
* add

* add
  • Loading branch information
SevenEarth authored Sep 9, 2024
1 parent 365d6e6 commit 4389a82
Show file tree
Hide file tree
Showing 16 changed files with 2,682 additions and 1,109 deletions.
3 changes: 3 additions & 0 deletions .changelog/2814.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
tencentcloud_as_start_instance_refresh
```
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/api v1.0.285
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apigateway v1.0.763
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.0.825
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.756
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.998
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bi v1.0.824
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cam v1.0.760
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cat v1.0.825
Expand All @@ -46,7 +46,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
Expand Down Expand Up @@ -108,7 +108,9 @@ require (
require (
github.com/hashicorp/go-uuid v1.0.3
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdc v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdwdoris v1.0.993
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdwpg v1.0.772
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dasb v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/oceanus v1.0.831
Expand Down Expand Up @@ -306,8 +308,6 @@ require (
github.com/subosito/gotenv v1.4.1 // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdwdoris v1.0.993 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 // indirect
github.com/tetafro/godot v1.4.11 // indirect
github.com/tidwall/gjson v1.17.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.0.825 h1:yiC2lsZ
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.0.825/go.mod h1:6qtSa8OZKwJOWoOCYWVZd6+T62O96AxbPll0I43d4yw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.756 h1:dx4aBdOWIqAUDQw9A6lU10EAaLpLwI2WRPVbuQgxzck=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.756/go.mod h1:lwWeh6aHg6GlttTMp+VIVtpZOtmpP6DQnnYWpyYW37Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.998 h1:UzDdo1BwE9AiYWVfzbpphiWRN2WMd45kycNcNbKMq+8=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.998/go.mod h1:66+/Rwk5UUl8KkNYpiYjWHaP6SM9PVuJ8JvD9QljCxg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bi v1.0.824 h1:DVKvZ6h+qd7tadUrCjVAkCCmE3TsbK2ZmwGd3AJcpWc=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bi v1.0.824/go.mod h1:DvBpDX/qdJG4KKLeULmRvhAjPYiw8za0HeTSu2y/lFw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cam v1.0.760 h1:Ky9dRsTL2HXKWUrTFpQFZWQ1TrM+o+P35kczR7thalo=
Expand Down Expand Up @@ -931,10 +933,12 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991 h1:0Xg2
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993 h1:+iJMmF0q1MPyhLs0+J7CcJ47w/vq6ICsCxnV4gc0dKw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995 h1:I1l5kl6rdQYDLEk8DqWjZgwMh0+nYnqbwq7KS4bqi/s=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998 h1:FVOc3KPlI9JAFz7A7s19xGoF+t54vzNByRzenTyAKpA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960 h1:Tpz3KVUfaJ7b98wQDYZSbmoKIn0hlH0oHPOzWMzE5Q8=
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ func Provider() *schema.Provider {
"tencentcloud_as_scale_out_instances": as.ResourceTencentCloudAsScaleOutInstances(),
"tencentcloud_as_execute_scaling_policy": as.ResourceTencentCloudAsExecuteScalingPolicy(),
"tencentcloud_as_complete_lifecycle": as.ResourceTencentCloudAsCompleteLifecycle(),
"tencentcloud_as_start_instance_refresh": as.ResourceTencentCloudAsStartInstanceRefresh(),
"tencentcloud_mongodb_instance": mongodb.ResourceTencentCloudMongodbInstance(),
"tencentcloud_mongodb_sharding_instance": mongodb.ResourceTencentCloudMongodbShardingInstance(),
"tencentcloud_mongodb_instance_account": mongodb.ResourceTencentCloudMongodbInstanceAccount(),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Auto Scaling(AS)
tencentcloud_as_scale_out_instances
tencentcloud_as_execute_scaling_policy
tencentcloud_as_complete_lifecycle
tencentcloud_as_start_instance_refresh

Content Delivery Network(CDN)
Data Source
Expand Down
4 changes: 4 additions & 0 deletions tencentcloud/services/as/extension_as.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,7 @@ const (
SCALING_MODE_CLASSIC = "CLASSIC_SCALING"
SCALING_MODE_WAKE_UP_STOPPED = "WAKE_UP_STOPPED_SCALING"
)

const (
REFRESH_ACTIVITIES_SUCCESSFUL = "SUCCESSFUL"
)
185 changes: 185 additions & 0 deletions tencentcloud/services/as/resource_tc_as_start_instance_refresh.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions tencentcloud/services/as/resource_tc_as_start_instance_refresh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Provides a resource to create as instance refresh

Example Usage

```hcl
resource "tencentcloud_as_start_instance_refresh" "example" {
auto_scaling_group_id = "asg-9dn1a5y6"
refresh_mode = "ROLLING_UPDATE_RESET"
refresh_settings {
check_instance_target_health = false
rolling_update_settings {
batch_number = 1
batch_pause = "AUTOMATIC"
}
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package as_test

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"

tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
)

// go test -i; go test -test.run TestAccTencentCloudAsStartInstanceRefreshResource_basic -v
func TestAccTencentCloudAsStartInstanceRefreshResource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
tcacctest.AccPreCheck(t)
},
Providers: tcacctest.AccProviders,
Steps: []resource.TestStep{
{
Config: testAccAsStartInstanceRefresh,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("tencentcloud_as_start_instance_refresh.example", "id"),
),
},
},
})
}

const testAccAsStartInstanceRefresh = `
resource "tencentcloud_as_start_instance_refresh" "example" {
auto_scaling_group_id = "asg-2l55y7u7"
refresh_mode = "ROLLING_UPDATE_RESET"
refresh_settings {
check_instance_target_health = false
rolling_update_settings {
batch_number = 1
batch_pause = "AUTOMATIC"
}
}
}
`
Loading

0 comments on commit 4389a82

Please sign in to comment.