@@ -126,8 +126,8 @@ type Driver struct {
126
126
DisableSSL bool
127
127
UserDataFile string
128
128
EncryptEbsVolume bool
129
-
130
- spotInstanceRequestId string
129
+ spotInstanceRequestId string
130
+ kmsKeyId * string
131
131
}
132
132
133
133
type clientFactory interface {
@@ -299,6 +299,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
299
299
Usage : "Encrypt the EBS volume using the AWS Managed CMK" ,
300
300
EnvVar : "AWS_ENCRYPT_EBS_VOLUME" ,
301
301
},
302
+ mcnflag.StringFlag {
303
+ Name : "amazonec2-kms-key" ,
304
+ Usage : "Custom KMS key using the AWS Managed CMK" ,
305
+ EnvVar : "AWS_KMS_KEY" ,
306
+ },
302
307
}
303
308
}
304
309
@@ -398,6 +403,11 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
398
403
d .UserDataFile = flags .String ("amazonec2-userdata" )
399
404
d .EncryptEbsVolume = flags .Bool ("amazonec2-encrypt-ebs-volume" )
400
405
406
+ kmskeyid := flags .String ("amazonec2-kms-key" )
407
+ if kmskeyid != "" {
408
+ d .kmsKeyId = aws .String (kmskeyid )
409
+ }
410
+
401
411
d .DisableSSL = flags .Bool ("amazonec2-insecure-transport" )
402
412
403
413
if d .DisableSSL && d .Endpoint == "" {
@@ -606,6 +616,7 @@ func (d *Driver) innerCreate() error {
606
616
VolumeType : aws .String (d .VolumeType ),
607
617
DeleteOnTermination : aws .Bool (true ),
608
618
Encrypted : aws .Bool (d .EncryptEbsVolume ),
619
+ KmsKeyId : d .kmsKeyId ,
609
620
},
610
621
}
611
622
netSpecs := []* ec2.InstanceNetworkInterfaceSpecification {{
0 commit comments