Skip to content

fix(vpc): [123456789] vpn ccn unittest #2907

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

Merged
merged 1 commit into from
Oct 23, 2024
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
2 changes: 1 addition & 1 deletion tencentcloud/services/ccn/resource_tc_ccn.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func resourceTencentCloudCcnUpdate(d *schema.ResourceData, meta interface{}) err

if d.HasChange("description") {
if temp, ok := d.GetOk("description"); ok {
request.CcnName = helper.String(temp.(string))
request.CcnDescription = helper.String(temp.(string))
}

change = true
Expand Down
91 changes: 84 additions & 7 deletions tencentcloud/services/ccn/resource_tc_ccn_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,106 @@ func TestAccTencentCloudCcnRoutesResource_basic(t *testing.T) {
),
},
{
ResourceName: "tencentcloud_ccn_routes.ccn_routes",
ImportState: true,
ImportStateVerify: true,
ResourceName: "tencentcloud_ccn_routes.ccn_routes",
ImportState: true,
},
},
})
}

const testAccVpcCcnRoutes = `
resource "tencentcloud_ccn" "ccn" {
name = "tf-test-routes"
description = "tf-test-routes-des"
qos = "AG"
}

resource "tencentcloud_ccn_route_table" "table" {
ccn_id = tencentcloud_ccn.ccn.id
name = "tf-test-routes"
description = "desc."
}

data "tencentcloud_availability_zones" "zones" {}

resource "tencentcloud_vpc" "vpc" {
name = "vpc-ccn-routes"
cidr_block = "10.0.0.0/16"
}

resource "tencentcloud_subnet" "subnet" {
vpc_id = tencentcloud_vpc.vpc.id
name = "subnet-ccn-routes"
cidr_block = "10.0.0.0/16"
availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name
is_multicast = false
}

resource "tencentcloud_ccn_attachment" "attachment" {
ccn_id = tencentcloud_ccn.ccn.id
instance_type = "VPC"
instance_id = tencentcloud_vpc.vpc.id
instance_region = "ap-guangzhou"
route_table_id = tencentcloud_ccn_route_table.table.id
}

data "tencentcloud_ccn_routes" "routes" {
ccn_id = tencentcloud_ccn.ccn.id
depends_on = [tencentcloud_ccn_attachment.attachment]
}

resource "tencentcloud_ccn_routes" "ccn_routes" {
ccn_id = "ccn-0bbkedsb"
route_id = "ccnr-9sqye2qg"
ccn_id = tencentcloud_ccn.ccn.id
route_id = data.tencentcloud_ccn_routes.routes.route_list.0.route_id
switch = "off"
}

`

const testAccVpcCcnRoutesUpdate = `
resource "tencentcloud_ccn" "ccn" {
name = "tf-test-routes"
description = "tf-test-routes-des"
qos = "AG"
}

resource "tencentcloud_ccn_route_table" "table" {
ccn_id = tencentcloud_ccn.ccn.id
name = "tf-test-routes"
description = "desc."
}

data "tencentcloud_availability_zones" "zones" {}

resource "tencentcloud_vpc" "vpc" {
name = "vpc-ccn-routes"
cidr_block = "10.0.0.0/16"
}

resource "tencentcloud_subnet" "subnet" {
vpc_id = tencentcloud_vpc.vpc.id
name = "subnet-ccn-routes"
cidr_block = "10.0.0.0/16"
availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name
is_multicast = false
}

resource "tencentcloud_ccn_attachment" "attachment" {
ccn_id = tencentcloud_ccn.ccn.id
instance_type = "VPC"
instance_id = tencentcloud_vpc.vpc.id
instance_region = "ap-guangzhou"
route_table_id = tencentcloud_ccn_route_table.table.id
}

data "tencentcloud_ccn_routes" "routes" {
ccn_id = tencentcloud_ccn.ccn.id
depends_on = [tencentcloud_ccn_attachment.attachment]
}

resource "tencentcloud_ccn_routes" "ccn_routes" {
ccn_id = "ccn-0bbkedsb"
route_id = "ccnr-9sqye2qg"
ccn_id = tencentcloud_ccn.ccn.id
route_id = data.tencentcloud_ccn_routes.routes.route_list.0.route_id
switch = "on"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,22 @@ func TestAccTencentCloudVpnDefaultHealthCheckIpDataSource_basic(t *testing.T) {

const testAccVpnDefaultHealthCheckIpDataSource = `

data "tencentcloud_vpc_instances" "foo" {
name = "Default-VPC"
}

resource "tencentcloud_vpn_gateway" "my_cgw" {
name = "terraform_test_health_check"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
bandwidth = 10

tags = {
test = "tf"
}
}

data "tencentcloud_vpn_default_health_check_ip" "default_health_check_ip" {
vpn_gateway_id = "vpngw-gt8bianl"
vpn_gateway_id = tencentcloud_vpn_gateway.my_cgw.id
}

`
2 changes: 2 additions & 0 deletions tencentcloud/services/vpn/resource_tc_vpn_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ func ResourceTencentCloudVpnConnection() *schema.Resource {
"ike_local_fqdn_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ConflictsWith: []string{"ike_local_address"},
Description: "Local FQDN name of the IKE operation specification.",
},
"ike_remote_fqdn_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ConflictsWith: []string{"ike_remote_address"},
Description: "Remote FQDN name of the IKE operation specification.",
},
Expand Down
59 changes: 57 additions & 2 deletions tencentcloud/services/vpn/resource_tc_vpn_connection_reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,65 @@ func TestAccTencentCloudVpnConnectionResetResource_basic(t *testing.T) {
}

const testAccVpnConnectionReset = `
resource "tencentcloud_vpn_customer_gateway" "cgw" {
name = "terraform_test_reset"
public_ip_address = "1.3.3.3"

}

# Create VPC and Subnet
data "tencentcloud_vpc_instances" "foo" {
name = "Default-VPC"
}

resource "tencentcloud_vpn_gateway" "vpn" {
name = "terraform_test_reset"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
bandwidth = 5
zone = "ap-guangzhou-3"

tags = {
test = "test"
}
}
resource "tencentcloud_vpn_connection" "connection" {
name = "vpn_connection_test_reset"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
vpn_gateway_id = tencentcloud_vpn_gateway.vpn.id
customer_gateway_id = tencentcloud_vpn_customer_gateway.cgw.id
pre_share_key = "test"
ike_proto_encry_algorithm = "3DES-CBC"
ike_proto_authen_algorithm = "MD5"
ike_local_identity = "ADDRESS"
ike_local_address = tencentcloud_vpn_gateway.vpn.public_ip_address
ike_remote_identity = "ADDRESS"
ike_remote_address = tencentcloud_vpn_customer_gateway.cgw.public_ip_address
ike_dh_group_name = "GROUP1"
ike_sa_lifetime_seconds = 86400
ike_version = "IKEV1"
ipsec_encrypt_algorithm = "3DES-CBC"
ipsec_integrity_algorithm = "MD5"
ipsec_sa_lifetime_seconds = 3600
ipsec_pfs_dh_group = "DH-GROUP1"
ipsec_sa_lifetime_traffic = 2560
dpd_enable = 1
dpd_timeout = "30"
dpd_action = "clear"
security_group_policy {
local_cidr_block = "172.16.0.0/16"
remote_cidr_block = ["3.3.3.0/32", ]
}
tags = {
test = "test"
}
enable_health_check = true
health_check_local_ip = "192.168.0.2"
health_check_remote_ip = "3.3.3.2"
}

resource "tencentcloud_vpn_connection_reset" "vpn_connection_reset" {
vpn_gateway_id = "vpngw-gt8bianl"
vpn_connection_id = "vpnx-kme2tx8m"
vpn_gateway_id = tencentcloud_vpn_gateway.vpn.id
vpn_connection_id = tencentcloud_vpn_connection.connection.id
}

`
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,65 @@ func TestAccTencentCloudVpnCustomerGatewayConfigurationDownloadResource_basic(t
}

const testAccVpcVpnCustomerGatewayConfigurationDownload = `
resource "tencentcloud_vpn_customer_gateway" "cgw" {
name = "terraform_test_download"
public_ip_address = "1.3.3.3"

}

# Create VPC and Subnet
data "tencentcloud_vpc_instances" "foo" {
name = "Default-VPC"
}

resource "tencentcloud_vpn_gateway" "vpn" {
name = "terraform_test_download"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
bandwidth = 5
zone = "ap-guangzhou-3"

tags = {
test = "test"
}
}
resource "tencentcloud_vpn_connection" "connection" {
name = "test_download"
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
vpn_gateway_id = tencentcloud_vpn_gateway.vpn.id
customer_gateway_id = tencentcloud_vpn_customer_gateway.cgw.id
pre_share_key = "test"
ike_proto_encry_algorithm = "3DES-CBC"
ike_proto_authen_algorithm = "MD5"
ike_local_identity = "ADDRESS"
ike_local_address = tencentcloud_vpn_gateway.vpn.public_ip_address
ike_remote_identity = "ADDRESS"
ike_remote_address = tencentcloud_vpn_customer_gateway.cgw.public_ip_address
ike_dh_group_name = "GROUP1"
ike_sa_lifetime_seconds = 86400
ike_version = "IKEV1"
ipsec_encrypt_algorithm = "3DES-CBC"
ipsec_integrity_algorithm = "MD5"
ipsec_sa_lifetime_seconds = 3600
ipsec_pfs_dh_group = "DH-GROUP1"
ipsec_sa_lifetime_traffic = 2560
dpd_enable = 1
dpd_timeout = "30"
dpd_action = "clear"
security_group_policy {
local_cidr_block = "172.16.0.0/16"
remote_cidr_block = ["3.3.3.0/32", ]
}
tags = {
test = "test"
}
enable_health_check = true
health_check_local_ip = "192.168.0.2"
health_check_remote_ip = "3.3.3.2"
}

resource "tencentcloud_vpn_customer_gateway_configuration_download" "vpn_customer_gateway_configuration_download" {
vpn_gateway_id = "vpngw-gt8bianl"
vpn_connection_id = "vpnx-kme2tx8m"
vpn_gateway_id = tencentcloud_vpn_gateway.vpn.id
vpn_connection_id = tencentcloud_vpn_connection.connection.id
customer_gateway_vendor {
platform = "comware"
software_version = "V1.0"
Expand Down
Loading
Loading