Review data-disk encryption in Alicloud Launch Templates

Verify encryption for data disks created from an ECS Launch Template.

Description

In alicloud_launch_template, data_disks.encrypted controls encryption requests for data disks on new instances. The system disk has separate settings.

Potential impact

Reusing a template can create more disks without the protection your policy requires. Existing disks keep their encryption settings.

Remediation

Set encrypted = true inside data_disks. Check disk and region support, key permissions and the template version used for launch. Verify encryption on a newly created disk, including the effect of account defaults.

Examples

Supply your image, instance type and network settings. Keep the resource address when editing an existing template. For alicloud_ecs_launch_template, check the data-disk fields in your provider version.

Before

hcl
resource "alicloud_launch_template" "unencrypted_template" {
  name                          = "tf-test-template"
  image_id                      = data.alicloud_images.images.images[0].id
  instance_type                 = data.alicloud_instances.instances.instances[0].instance_type
  system_disk_category          = "cloud_ssd"
  system_disk_size              = 40

  data_disks {
    category  = "cloud_ssd"
    size      = 40
    encrypted = false
  }
}

After

hcl
resource "alicloud_launch_template" "encrypted_template" {
  name                          = "tf-test-template"
  image_id                      = data.alicloud_images.images.images[0].id
  instance_type                 = data.alicloud_instances.instances.instances[0].instance_type
  system_disk_category          = "cloud_ssd"
  system_disk_size              = 40

  data_disks {
    category  = "cloud_ssd"
    size      = 40
    encrypted = true
  }
}

References