-
Notifications
You must be signed in to change notification settings - Fork 140
feat(crs): [122437999] support wan address #3220
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
tencentcloud_redis_wan_address | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
tencentcloud/services/crs/resource_tc_redis_wan_address.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
tencentcloud/services/crs/resource_tc_redis_wan_address.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Provides a resource to create a redis wan_address | ||
|
||
Example Usage | ||
|
||
```hcl | ||
resource "tencentcloud_redis_wan_address" "wan_address" { | ||
instance_id = "crs-dekqpd8v" | ||
} | ||
``` | ||
|
||
Import | ||
|
||
redis wan_address can be imported using the instanceId, e.g. | ||
|
||
``` | ||
terraform import tencentcloud_redis_wan_address.wan_address crs-dekqpd8v | ||
``` |
1 change: 1 addition & 0 deletions
1
tencentcloud/services/crs/resource_tc_redis_wan_address_extension.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package crs |
71 changes: 71 additions & 0 deletions
71
tencentcloud/services/crs/resource_tc_redis_wan_address_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package crs_test | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" | ||
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" | ||
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" | ||
svccrs "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/crs" | ||
) | ||
|
||
func TestAccTencentCloudRedisWanAddressResource_basic(t *testing.T) { | ||
t.Parallel() | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { | ||
tcacctest.AccPreCheck(t) | ||
}, | ||
Providers: tcacctest.AccProviders, | ||
CheckDestroy: testAccTencentCloudRedisInstanceWanAddressDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccRedisWanAddress, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("tencentcloud_redis_wan_address.redis_wan_address", "id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_redis_wan_address.redis_wan_address", "wan_address"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "tencentcloud_redis_wan_address.redis_wan_address", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccTencentCloudRedisInstanceWanAddressDestroy(s *terraform.State) error { | ||
|
||
logId := tccommon.GetLogId(tccommon.ContextNil) | ||
ctx := context.WithValue(context.TODO(), tccommon.LogIdKey, logId) | ||
|
||
service := svccrs.NewRedisService(tcacctest.AccProvider.Meta().(tccommon.ProviderMeta).GetAPIV3Conn()) | ||
for _, rs := range s.RootModule().Resources { | ||
if rs.Type != "tencentcloud_redis_wan_address" { | ||
continue | ||
} | ||
time.Sleep(5 * time.Second) | ||
has, _, instance, err := service.CheckRedisOnlineOk(ctx, rs.Primary.ID, 20*tccommon.ReadRetryTimeout) | ||
if err != nil { | ||
return err | ||
} | ||
if !has { | ||
return fmt.Errorf("failed to get redis") | ||
} | ||
if instance.WanAddress != nil && *instance.WanAddress != "" { | ||
return fmt.Errorf("redis wanAddress close failed: %v", *instance.WanAddress) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
const testAccRedisWanAddress = ` | ||
|
||
resource "tencentcloud_redis_wan_address" "redis_wan_address" { | ||
instance_id = "crs-dekqpd8v" | ||
} | ||
` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
subcategory: "TencentDB for Redis(crs)" | ||
layout: "tencentcloud" | ||
page_title: "TencentCloud: tencentcloud_redis_wan_address" | ||
sidebar_current: "docs-tencentcloud-resource-redis_wan_address" | ||
description: |- | ||
Provides a resource to create a redis wan_address | ||
--- | ||
|
||
# tencentcloud_redis_wan_address | ||
|
||
Provides a resource to create a redis wan_address | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
resource "tencentcloud_redis_wan_address" "wan_address" { | ||
instance_id = "crs-dekqpd8v" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `instance_id` - (Required, String, ForceNew) Instance ID. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - ID of the resource. | ||
* `wan_address` - Allocate Wan Address. | ||
|
||
|
||
## Import | ||
|
||
redis wan_address can be imported using the instanceId, e.g. | ||
|
||
``` | ||
terraform import tencentcloud_redis_wan_address.wan_address crs-dekqpd8v | ||
``` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
1、这个资源感觉设计的有问题,不是应该是一个开启和关闭的逻辑么?
2、是不是直接放在redis_instance资源比较好