Review default VPC use by Tencent Cloud CVM

Align network boundaries with workload security requirements.

Description

Check which VPC and subnet the CVM instance uses. Give services with different access requirements separate networks where needed.

Potential impact

Services on a shared network may be able to reach one another. A routing change for one service can also affect others.

Remediation

Create a dedicated tencentcloud_vpc and tencentcloud_subnet. Reference them with vpc_id and subnet_id. Check routes, security groups, and migration steps before moving existing instances.

Examples

The excerpts show network placement. Supply the availability zone, instance settings, and access controls for your environment.

Before

hcl
resource "tencentcloud_instance" "example" {
  instance_name = "cvm-postpaid"
  vpc_id        = tencentcloud_vpc.default.id
  subnet_id     = tencentcloud_subnet.default.id
}

After

hcl
resource "tencentcloud_vpc" "app" {
  name       = "app-vpc"
  cidr_block = "10.0.0.0/16"
}

resource "tencentcloud_subnet" "app" {
  name       = "app-subnet"
  vpc_id     = tencentcloud_vpc.app.id
  cidr_block = "10.0.1.0/24"
}

resource "tencentcloud_instance" "example" {
  instance_name = "cvm-postpaid"
  vpc_id        = tencentcloud_vpc.app.id
  subnet_id     = tencentcloud_subnet.app.id
}

References