Beta - CVM instance using default security group
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Id: 93bb2065-63ec-45a2-a466-f106b56f2e32
Cloud Provider: TencentCloud
Platform: Terraform
Severity: Low
Category: Access Control
Learn More
Description
CVM instances (tencentcloud_instance) should not include the default security group. This rule inspects the orderly_security_groups and security_groups attributes for any occurrence of default and flags the resource if found. Relying on the default security group can result in overly permissive network access and should be avoided.
Compliant Code Examples
resource "tencentcloud_security_group" "sg" {
name = "tf-example"
description = "test"
}
resource "tencentcloud_instance" "cvm_postpaid" {
instance_name = "cvm_postpaid"
availability_zone = "ap-guangzhou-7"
image_id = "img-9qrfy1xt"
instance_type = "POSTPAID_BY_HOUR"
system_disk_type = "CLOUD_PREMIUM"
system_disk_size = 50
hostname = "root"
project_id = 0
vpc_id = "vpc-axrsmmrv"
subnet_id = "subnet-861wd75e"
security_groups = [
tencentcloud_security_group.sg.id
]
data_disks {
data_disk_type = "CLOUD_PREMIUM"
data_disk_size = 50
encrypt = false
}
tags = {
tagKey = "tagValue"
}
}
resource "tencentcloud_security_group" "sg" {
name = "tf-example"
description = "test"
}
resource "tencentcloud_instance" "cvm_postpaid" {
instance_name = "cvm_postpaid"
availability_zone = "ap-guangzhou-7"
image_id = "img-9qrfy1xt"
instance_type = "POSTPAID_BY_HOUR"
system_disk_type = "CLOUD_PREMIUM"
system_disk_size = 50
hostname = "root"
project_id = 0
vpc_id = "vpc-axrsmmrv"
subnet_id = "subnet-861wd75e"
orderly_security_groups = [
tencentcloud_security_group.sg.id
]
data_disks {
data_disk_type = "CLOUD_PREMIUM"
data_disk_size = 50
encrypt = false
}
tags = {
tagKey = "tagValue"
}
}
Non-Compliant Code Examples
resource "tencentcloud_security_group" "default" {
name = "tf-example"
description = "test"
}
resource "tencentcloud_instance" "cvm_postpaid" {
instance_name = "cvm_postpaid"
availability_zone = "ap-guangzhou-7"
image_id = "img-9qrfy1xt"
instance_type = "POSTPAID_BY_HOUR"
system_disk_type = "CLOUD_PREMIUM"
system_disk_size = 50
hostname = "root"
project_id = 0
vpc_id = "vpc-axrsmmrv"
subnet_id = "subnet-861wd75e"
security_groups = [tencentcloud_security_group.default.id]
data_disks {
data_disk_type = "CLOUD_PREMIUM"
data_disk_size = 50
encrypt = false
}
tags = {
tagKey = "tagValue"
}
}
resource "tencentcloud_security_group" "default" {
name = "tf-example"
description = "test"
}
resource "tencentcloud_instance" "cvm_postpaid" {
instance_name = "cvm_postpaid"
availability_zone = "ap-guangzhou-7"
image_id = "img-9qrfy1xt"
instance_type = "POSTPAID_BY_HOUR"
system_disk_type = "CLOUD_PREMIUM"
system_disk_size = 50
hostname = "root"
project_id = 0
vpc_id = "vpc-axrsmmrv"
subnet_id = "subnet-861wd75e"
orderly_security_groups = [tencentcloud_security_group.default.id]
data_disks {
data_disk_type = "CLOUD_PREMIUM"
data_disk_size = 50
encrypt = false
}
tags = {
tagKey = "tagValue"
}
}