Ecs Data Disk Kms Key Id Undefined

  • Query id: f262118c-1ac6-4bb3-8495-cc48f1775b85
  • Query name: Ecs Data Disk Kms Key Id Undefined
  • Platform: Terraform
  • Severity: High
  • Category: Encryption
  • URL: Github

Description

Ecs Data Disk Kms Key Id should be set
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - tf file
# Create a new ECS disk.
resource "alicloud_disk" "ecs_disk" {
  # cn-beijing
  availability_zone = "cn-beijing-b"
  name              = "New-disk"
  description       = "Hello ecs disk."
  category          = "cloud_efficiency"
  size              = "30"
  encrypted         = true
  tags = {
    Name = "TerraformTest"
  }
}

Code samples without security vulnerabilities

Negative test num. 1 - tf file
# Create a new ECS disk.
resource "alicloud_disk" "ecs_disk" {
  # cn-beijing
  availability_zone = "cn-beijing-b"
  name              = "New-disk"
  description       = "Hello ecs disk."
  category          = "cloud_efficiency"
  size              = "30"
  encrypted         = true
  kms_key_id        = "2a6767f0-a16c-4679-a60f-13bf*****"
  tags = {
    Name = "TerraformTest"
  }
}