Project: KICS (Provisioning / Security & Compliance)
File: 1455cb21-1d48-46d6-8ae3-cef911b71fd5.md

title: Launch Template Is Not Encrypted hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 1455cb21-1d48-46d6-8ae3-cef911b71fd5 Query name: Launch Template Is Not Encrypted Platform: Terraform Severity: <span style="color:#bb2124">High</span> Category: Encryption URL: ECS Launch Template should have the data in the disk encrypted. To encrypt the data, the 'encrypted' argument should be set to true.<br> ```tf title="Positive test num. 1 - tf file" hl_lines="36" data "alicloud_images" "images" { owners = "system" } data "alicloud_instances" "instances" { } resource "alicloudlaunchtemplate" "templatepos1" { name = "tf-test-template" description = "test1" imageid = data.alicloudimages.images.images[0].id host_name = "tf-test-host" instancechargetype = "PrePaid" instance_name = "tf-instance-name" instancetype = data.alicloudinstances.instances.instances[0].instance_type internetchargetype = "PayByBandwidth" internetmaxbandwidth_in = 5 internetmaxbandwidth_out = 0 io_optimized = "none" keypairname = "test-key-pair" ramrolename = "xxxxx" network_type = "vpc" securityenhancementstrategy = "Active" spotpricelimit = 5 spot_strategy = "SpotWithPriceLimit" securitygroupid = "sg-zxcvj0lasdf102350asdf9a" systemdiskcategory = "cloud_ssd" systemdiskdescription = "test disk" systemdiskname = "hello" systemdisksize = 40 resourcegroupid = "rg-zkdfjahg9zxncv0" userdata = "xxxxxxxxxxxxxx" vswitch_id = "sw-ljkngaksdjfj0nnasdf" vpc_id = "vpc-asdfnbg0as8dfk1nb2" zone_id = "beijing-a" encrypted = false tags = { tag1 = "hello" tag2 = "world" } network_interfaces { name = "eth0" description = "hello1" primary_ip = "10.0.0.2" securitygroupid = "xxxx" vswitch_id = "xxxxxxx" } data_disks { name = "disk1" description = "test1" } data_disks { name = "disk2" description = "test2" } } ``` ```tf title="Positive test num. 2 - tf file" hl_lines="8" data "alicloud_images" "images" { owners = "system" } data "alicloud_instances" "instances" { } resource "alicloudlaunchtemplate" "templatepos2" { name = "tf-test-template" description = "test1" imageid = data.alicloudimages.images.images[0].id host_name = "tf-test-host" instancechargetype = "PrePaid" instance_name = "tf-instance-name" instancetype = data.alicloudinstances.instances.instances[0].instance_type internetchargetype = "PayByBandwidth" internetmaxbandwidth_in = 5 internetmaxbandwidth_out = 0 io_optimized = "none" keypairname = "test-key-pair" ramrolename = "xxxxx" network_type = "vpc" securityenhancementstrategy = "Active" spotpricelimit = 5 spot_strategy = "SpotWithPriceLimit" securitygroupid = "sg-zxcvj0lasdf102350asdf9a" systemdiskcategory = "cloud_ssd" systemdiskdescription = "test disk" systemdiskname = "hello" systemdisksize = 40 resourcegroupid = "rg-zkdfjahg9zxncv0" userdata = "xxxxxxxxxxxxxx" vswitch_id = "sw-ljkngaksdjfj0nnasdf" vpc_id = "vpc-asdfnbg0as8dfk1nb2" zone_id = "beijing-a" tags = { tag1 = "hello" tag2 = "world" } network_interfaces { name = "eth0" description = "hello1" primary_ip = "10.0.0.2" securitygroupid = "xxxx" vswitch_id = "xxxxxxx" } data_disks { name = "disk1" description = "test1" } data_disks { name = "disk2" description = "test2" } } ``` ```tf title="Negative test num. 1 - tf file" data "alicloud_images" "images" { owners = "system" } data "alicloud_instances" "instances" { } resource "alicloudlaunchtemplate" "templateneg1" { name = "tf-test-template" description = "test1" imageid = data.alicloudimages.images.images[0].id host_name = "tf-test-host" instancechargetype = "PrePaid" instance_name = "tf-instance-name" instancetype = data.alicloudinstances.instances.instances[0].instance_type internetchargetype = "PayByBandwidth" internetmaxbandwidth_in = 5 internetmaxbandwidth_out = 0 io_optimized = "none" keypairname = "test-key-pair" ramrolename = "xxxxx" network_type = "vpc" securityenhancementstrategy = "Active" spotpricelimit = 5 spot_strategy = "SpotWithPriceLimit" securitygroupid = "sg-zxcvj0lasdf102350asdf9a" systemdiskcategory = "cloud_ssd" systemdiskdescription = "test disk" systemdiskname = "hello" systemdisksize = 40 resourcegroupid = "rg-zkdfjahg9zxncv0" userdata = "xxxxxxxxxxxxxx" vswitch_id = "sw-ljkngaksdjfj0nnasdf" vpc_id = "vpc-asdfnbg0as8dfk1nb2" zone_id = "beijing-a" encrypted = true tags = { tag1 = "hello" tag2 = "world" } network_interfaces { name = "eth0" description = "hello1" primary_ip = "10.0.0.2" securitygroupid = "xxxx" vswitch_id = "xxxxxxx" } data_disks { name = "disk1" description = "test1" } data_disks { name = "disk2" description = "test2" } } ```