@@ -270,6 +270,12 @@ func resourceComputeDisk() *schema.Resource {
270
270
MaxItems : 1 ,
271
271
Elem : & schema.Resource {
272
272
Schema : map [string ]* schema.Schema {
273
+ "kms_key_self_link" : {
274
+ Type : schema .TypeString ,
275
+ Optional : true ,
276
+ ForceNew : true ,
277
+ DiffSuppressFunc : compareSelfLinkRelativePaths ,
278
+ },
273
279
"raw_key" : {
274
280
Type : schema .TypeString ,
275
281
Optional : true ,
@@ -311,6 +317,12 @@ func resourceComputeDisk() *schema.Resource {
311
317
MaxItems : 1 ,
312
318
Elem : & schema.Resource {
313
319
Schema : map [string ]* schema.Schema {
320
+ "kms_key_self_link" : {
321
+ Type : schema .TypeString ,
322
+ Optional : true ,
323
+ ForceNew : true ,
324
+ DiffSuppressFunc : compareSelfLinkRelativePaths ,
325
+ },
314
326
"raw_key" : {
315
327
Type : schema .TypeString ,
316
328
Optional : true ,
@@ -330,6 +342,12 @@ func resourceComputeDisk() *schema.Resource {
330
342
MaxItems : 1 ,
331
343
Elem : & schema.Resource {
332
344
Schema : map [string ]* schema.Schema {
345
+ "kms_key_self_link" : {
346
+ Type : schema .TypeString ,
347
+ Optional : true ,
348
+ ForceNew : true ,
349
+ DiffSuppressFunc : compareSelfLinkRelativePaths ,
350
+ },
333
351
"raw_key" : {
334
352
Type : schema .TypeString ,
335
353
Optional : true ,
@@ -899,6 +917,8 @@ func flattenComputeDiskSourceImageEncryptionKey(v interface{}, d *schema.Resourc
899
917
flattenComputeDiskSourceImageEncryptionKeyRawKey (original ["rawKey" ], d )
900
918
transformed ["sha256" ] =
901
919
flattenComputeDiskSourceImageEncryptionKeySha256 (original ["sha256" ], d )
920
+ transformed ["kms_key_self_link" ] =
921
+ flattenComputeDiskSourceImageEncryptionKeyKmsKeySelfLink (original ["kmsKeyName" ], d )
902
922
return []interface {}{transformed }
903
923
}
904
924
func flattenComputeDiskSourceImageEncryptionKeyRawKey (v interface {}, d * schema.ResourceData ) interface {} {
@@ -909,6 +929,10 @@ func flattenComputeDiskSourceImageEncryptionKeySha256(v interface{}, d *schema.R
909
929
return v
910
930
}
911
931
932
+ func flattenComputeDiskSourceImageEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData ) interface {} {
933
+ return v
934
+ }
935
+
912
936
func flattenComputeDiskSourceImageId (v interface {}, d * schema.ResourceData ) interface {} {
913
937
return v
914
938
}
@@ -926,6 +950,8 @@ func flattenComputeDiskDiskEncryptionKey(v interface{}, d *schema.ResourceData)
926
950
flattenComputeDiskDiskEncryptionKeyRawKey (original ["rawKey" ], d )
927
951
transformed ["sha256" ] =
928
952
flattenComputeDiskDiskEncryptionKeySha256 (original ["sha256" ], d )
953
+ transformed ["kms_key_self_link" ] =
954
+ flattenComputeDiskDiskEncryptionKeyKmsKeySelfLink (original ["kmsKeyName" ], d )
929
955
return []interface {}{transformed }
930
956
}
931
957
func flattenComputeDiskDiskEncryptionKeyRawKey (v interface {}, d * schema.ResourceData ) interface {} {
@@ -936,6 +962,10 @@ func flattenComputeDiskDiskEncryptionKeySha256(v interface{}, d *schema.Resource
936
962
return v
937
963
}
938
964
965
+ func flattenComputeDiskDiskEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData ) interface {} {
966
+ return v
967
+ }
968
+
939
969
func flattenComputeDiskSnapshot (v interface {}, d * schema.ResourceData ) interface {} {
940
970
if v == nil {
941
971
return v
@@ -954,6 +984,8 @@ func flattenComputeDiskSourceSnapshotEncryptionKey(v interface{}, d *schema.Reso
954
984
transformed := make (map [string ]interface {})
955
985
transformed ["raw_key" ] =
956
986
flattenComputeDiskSourceSnapshotEncryptionKeyRawKey (original ["rawKey" ], d )
987
+ transformed ["kms_key_self_link" ] =
988
+ flattenComputeDiskSourceSnapshotEncryptionKeyKmsKeySelfLink (original ["kmsKeyName" ], d )
957
989
transformed ["sha256" ] =
958
990
flattenComputeDiskSourceSnapshotEncryptionKeySha256 (original ["sha256" ], d )
959
991
return []interface {}{transformed }
@@ -962,6 +994,10 @@ func flattenComputeDiskSourceSnapshotEncryptionKeyRawKey(v interface{}, d *schem
962
994
return v
963
995
}
964
996
997
+ func flattenComputeDiskSourceSnapshotEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData ) interface {} {
998
+ return v
999
+ }
1000
+
965
1001
func flattenComputeDiskSourceSnapshotEncryptionKeySha256 (v interface {}, d * schema.ResourceData ) interface {} {
966
1002
return v
967
1003
}
@@ -1040,6 +1076,13 @@ func expandComputeDiskSourceImageEncryptionKey(v interface{}, d *schema.Resource
1040
1076
transformed ["sha256" ] = transformedSha256
1041
1077
}
1042
1078
1079
+ transformedKmsKeySelfLink , err := expandComputeDiskSourceImageEncryptionKeyKmsKeySelfLink (original ["kms_key_self_link" ], d , config )
1080
+ if err != nil {
1081
+ return nil , err
1082
+ } else if val := reflect .ValueOf (transformedKmsKeySelfLink ); val .IsValid () && ! isEmptyValue (val ) {
1083
+ transformed ["kmsKeyName" ] = transformedKmsKeySelfLink
1084
+ }
1085
+
1043
1086
return transformed , nil
1044
1087
}
1045
1088
@@ -1051,6 +1094,10 @@ func expandComputeDiskSourceImageEncryptionKeySha256(v interface{}, d *schema.Re
1051
1094
return v , nil
1052
1095
}
1053
1096
1097
+ func expandComputeDiskSourceImageEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1098
+ return v , nil
1099
+ }
1100
+
1054
1101
func expandComputeDiskDiskEncryptionKey (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1055
1102
l := v .([]interface {})
1056
1103
if len (l ) == 0 || l [0 ] == nil {
@@ -1074,6 +1121,13 @@ func expandComputeDiskDiskEncryptionKey(v interface{}, d *schema.ResourceData, c
1074
1121
transformed ["sha256" ] = transformedSha256
1075
1122
}
1076
1123
1124
+ transformedKmsKeySelfLink , err := expandComputeDiskDiskEncryptionKeyKmsKeySelfLink (original ["kms_key_self_link" ], d , config )
1125
+ if err != nil {
1126
+ return nil , err
1127
+ } else if val := reflect .ValueOf (transformedKmsKeySelfLink ); val .IsValid () && ! isEmptyValue (val ) {
1128
+ transformed ["kmsKeyName" ] = transformedKmsKeySelfLink
1129
+ }
1130
+
1077
1131
return transformed , nil
1078
1132
}
1079
1133
@@ -1085,6 +1139,10 @@ func expandComputeDiskDiskEncryptionKeySha256(v interface{}, d *schema.ResourceD
1085
1139
return v , nil
1086
1140
}
1087
1141
1142
+ func expandComputeDiskDiskEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1143
+ return v , nil
1144
+ }
1145
+
1088
1146
func expandComputeDiskSnapshot (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1089
1147
f , err := parseGlobalFieldValue ("snapshots" , v .(string ), "project" , d , config , true )
1090
1148
if err != nil {
@@ -1109,6 +1167,13 @@ func expandComputeDiskSourceSnapshotEncryptionKey(v interface{}, d *schema.Resou
1109
1167
transformed ["rawKey" ] = transformedRawKey
1110
1168
}
1111
1169
1170
+ transformedKmsKeySelfLink , err := expandComputeDiskSourceSnapshotEncryptionKeyKmsKeySelfLink (original ["kms_key_self_link" ], d , config )
1171
+ if err != nil {
1172
+ return nil , err
1173
+ } else if val := reflect .ValueOf (transformedKmsKeySelfLink ); val .IsValid () && ! isEmptyValue (val ) {
1174
+ transformed ["kmsKeyName" ] = transformedKmsKeySelfLink
1175
+ }
1176
+
1112
1177
transformedSha256 , err := expandComputeDiskSourceSnapshotEncryptionKeySha256 (original ["sha256" ], d , config )
1113
1178
if err != nil {
1114
1179
return nil , err
@@ -1123,6 +1188,10 @@ func expandComputeDiskSourceSnapshotEncryptionKeyRawKey(v interface{}, d *schema
1123
1188
return v , nil
1124
1189
}
1125
1190
1191
+ func expandComputeDiskSourceSnapshotEncryptionKeyKmsKeySelfLink (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1192
+ return v , nil
1193
+ }
1194
+
1126
1195
func expandComputeDiskSourceSnapshotEncryptionKeySha256 (v interface {}, d * schema.ResourceData , config * Config ) (interface {}, error ) {
1127
1196
return v , nil
1128
1197
}
0 commit comments