Skip to content

[WIP]refactor(cvm): [117971511] regenerate some cvm resource #2678

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
17003ae
refactor: regenerate datasource cvm_instance_vnc_url
yhlooo May 13, 2024
a1463e5
refactor: regenerate datasource eip_address_quota
yhlooo May 13, 2024
cae1a25
refactor: regenerate datasource eip_network_account_type
yhlooo May 13, 2024
ba46218
refactor: regenerate datasource cvm_instances_modification
yhlooo May 13, 2024
7767f9f
refactor: regenerate datasource eip_address_quota
yhlooo May 13, 2024
7cce515
refactor: regenerate resource cvm_launch_template_default_version
yhlooo May 13, 2024
5d33f93
refactor: regenerate resource cvm_program_fpga_image
yhlooo May 13, 2024
0da9a26
refactor: regenerate resource cvm_renew_host
yhlooo May 13, 2024
3a19de8
refactor: regenerate resource cvm_reboot_instance
yhlooo May 13, 2024
dffc08f
refactor: regenerate cvm_modify_instance_disk_type
yhlooo May 13, 2024
db3b93c
refactor: regenerate resource cvm_launch_template_version
yhlooo May 13, 2024
93315bc
refactor: regenerate some cvm resources
yhlooo May 13, 2024
3f155ba
test: modify tencentcloud_cvm_instances_modification test
yhlooo Jun 11, 2024
6b87757
test: modify tencentcloud_cvm_instance_vnc_url test
yhlooo Jun 11, 2024
a0c3bfd
test: modify tencentcloud_eip_address_quota test
yhlooo Jun 11, 2024
f41b332
test: modify tencentcloud_eip_network_account_type test
yhlooo Jun 11, 2024
273d9f1
test: modify tencentcloud_cvm_launch_template_version test
yhlooo Jun 12, 2024
c4543be
test: modify tencentcloud_cvm_modify_instance_disk_type test
yhlooo Jun 12, 2024
cbe75b8
test: modify tencentcloud_cvm_reboot_instance test
yhlooo Jun 12, 2024
360853e
fix: tencentcloud_cvm_reboot_instance and tencentcloud_cvm_launch_tem…
yhlooo Jun 12, 2024
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
49 changes: 29 additions & 20 deletions tencentcloud/services/cvm/data_source_tc_cvm_instance_vnc_url.go

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cvm

import (
"context"
"fmt"

tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
)

func dataSourceTencentCloudCvmInstanceVncUrlReadOutputContent(ctx context.Context) interface{} {
d := tccommon.ResourceDataFromContext(ctx)
if d == nil {
return fmt.Errorf("resource data can not be nil")
}
return map[string]interface{}{
"instance_vnc_url": d.Get("instance_vnc_url"),
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cvm_test

import (
"fmt"
"testing"

tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
Expand All @@ -18,15 +19,48 @@ func TestAccTencentCloudCvmInstanceVncUrlDataSource_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccCvmInstanceVncUrlDataSource,
Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_cvm_instance_vnc_url.instance_vnc_url")),
Check: resource.ComposeTestCheckFunc(
tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_cvm_instance_vnc_url.instance_vnc_url"),
resource.TestCheckResourceAttrWith("data.tencentcloud_cvm_instance_vnc_url.instance_vnc_url", "instance_vnc_url", func(value string) error {
if value == "" {
return fmt.Errorf("vnc url is empty")
}
return nil
}),
),
},
},
})
}

const testAccCvmInstanceVncUrlDataSource = tcacctest.DefaultCvmModificationVariable + `
const testAccCvmInstanceVncUrlDataSource = `
data "tencentcloud_images" "default" {
image_type = ["PUBLIC_IMAGE"]
image_name_regex = "Final"
}
data "tencentcloud_instance_types" "default" {
memory_size = 2
exclude_sold_out = true
filter {
name = "instance-family"
values = ["SA2","SA3","SA4","SA5","S2","S3"]
}
filter {
name = "zone"
values = ["ap-guangzhou-7"]
}
cpu_core_count = 2
}

resource "tencentcloud_instance" "test_cvm" {
image_id = data.tencentcloud_images.default.images.0.image_id
availability_zone = "ap-guangzhou-7"
instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
orderly_security_groups = ["sg-5275dorp"]
instance_charge_type = "POSTPAID_BY_HOUR"
}

data "tencentcloud_cvm_instance_vnc_url" "instance_vnc_url" {
instance_id = var.cvm_id
instance_id = tencentcloud_instance.test_cvm.id
}
`
Loading
Loading