@@ -9,63 +9,76 @@ func schemaFeatures(supportLegacyTestSuite bool) *schema.Schema {
9
9
// NOTE: if there's only one nested field these want to be Required (since there's no point
10
10
// specifying the block otherwise) - however for 2+ they should be optional
11
11
features := map [string ]* schema.Schema {
12
- "virtual_machine " : {
12
+ "key_vault " : {
13
13
Type : schema .TypeList ,
14
14
Optional : true ,
15
15
MaxItems : 1 ,
16
16
Elem : & schema.Resource {
17
17
Schema : map [string ]* schema.Schema {
18
- "delete_os_disk_on_deletion " : {
18
+ "recover_soft_deleted_key_vaults " : {
19
19
Type : schema .TypeBool ,
20
- Required : true ,
20
+ Optional : true ,
21
+ },
22
+
23
+ "purge_soft_delete_on_destroy" : {
24
+ Type : schema .TypeBool ,
25
+ Optional : true ,
21
26
},
22
27
},
23
28
},
24
29
},
25
30
26
- "virtual_machine_scale_set " : {
31
+ "network " : {
27
32
Type : schema .TypeList ,
28
33
Optional : true ,
29
34
MaxItems : 1 ,
30
35
Elem : & schema.Resource {
31
36
Schema : map [string ]* schema.Schema {
32
- "roll_instances_when_required " : {
37
+ "relaxed_locking " : {
33
38
Type : schema .TypeBool ,
34
39
Required : true ,
35
40
},
36
41
},
37
42
},
38
43
},
39
44
40
- "key_vault " : {
45
+ "template_deployment " : {
41
46
Type : schema .TypeList ,
42
47
Optional : true ,
43
48
MaxItems : 1 ,
44
49
Elem : & schema.Resource {
45
50
Schema : map [string ]* schema.Schema {
46
- "recover_soft_deleted_key_vaults " : {
51
+ "delete_nested_items_during_deletion " : {
47
52
Type : schema .TypeBool ,
48
- Optional : true ,
53
+ Required : true ,
49
54
},
55
+ },
56
+ },
57
+ },
50
58
51
- "purge_soft_delete_on_destroy" : {
59
+ "virtual_machine" : {
60
+ Type : schema .TypeList ,
61
+ Optional : true ,
62
+ MaxItems : 1 ,
63
+ Elem : & schema.Resource {
64
+ Schema : map [string ]* schema.Schema {
65
+ "delete_os_disk_on_deletion" : {
52
66
Type : schema .TypeBool ,
53
- Optional : true ,
67
+ Required : true ,
54
68
},
55
69
},
56
70
},
57
71
},
58
72
59
- "network " : {
73
+ "virtual_machine_scale_set " : {
60
74
Type : schema .TypeList ,
61
75
Optional : true ,
62
76
MaxItems : 1 ,
63
77
Elem : & schema.Resource {
64
78
Schema : map [string ]* schema.Schema {
65
- "relaxed_locking " : {
79
+ "roll_instances_when_required " : {
66
80
Type : schema .TypeBool ,
67
- Optional : true ,
68
- Default : false ,
81
+ Required : true ,
69
82
},
70
83
},
71
84
},
@@ -99,19 +112,22 @@ func expandFeatures(input []interface{}) features.UserFeatures {
99
112
// these are the defaults if omitted from the config
100
113
features := features.UserFeatures {
101
114
// NOTE: ensure all nested objects are fully populated
102
- VirtualMachine : features.VirtualMachineFeatures {
103
- DeleteOSDiskOnDeletion : true ,
104
- },
105
- VirtualMachineScaleSet : features.VirtualMachineScaleSetFeatures {
106
- RollInstancesWhenRequired : true ,
107
- },
108
115
KeyVault : features.KeyVaultFeatures {
109
116
PurgeSoftDeleteOnDestroy : true ,
110
117
RecoverSoftDeletedKeyVaults : true ,
111
118
},
112
119
Network : features.NetworkFeatures {
113
120
RelaxedLocking : false ,
114
121
},
122
+ TemplateDeployment : features.TemplateDeploymentFeatures {
123
+ DeleteNestedItemsDuringDeletion : true ,
124
+ },
125
+ VirtualMachine : features.VirtualMachineFeatures {
126
+ DeleteOSDiskOnDeletion : true ,
127
+ },
128
+ VirtualMachineScaleSet : features.VirtualMachineScaleSetFeatures {
129
+ RollInstancesWhenRequired : true ,
130
+ },
115
131
}
116
132
117
133
if len (input ) == 0 || input [0 ] == nil {
@@ -133,6 +149,26 @@ func expandFeatures(input []interface{}) features.UserFeatures {
133
149
}
134
150
}
135
151
152
+ if raw , ok := val ["network" ]; ok {
153
+ items := raw .([]interface {})
154
+ if len (items ) > 0 {
155
+ networkRaw := items [0 ].(map [string ]interface {})
156
+ if v , ok := networkRaw ["relaxed_locking" ]; ok {
157
+ features .Network .RelaxedLocking = v .(bool )
158
+ }
159
+ }
160
+ }
161
+
162
+ if raw , ok := val ["template_deployment" ]; ok {
163
+ items := raw .([]interface {})
164
+ if len (items ) > 0 {
165
+ networkRaw := items [0 ].(map [string ]interface {})
166
+ if v , ok := networkRaw ["delete_nested_items_during_deletion" ]; ok {
167
+ features .TemplateDeployment .DeleteNestedItemsDuringDeletion = v .(bool )
168
+ }
169
+ }
170
+ }
171
+
136
172
if raw , ok := val ["virtual_machine" ]; ok {
137
173
items := raw .([]interface {})
138
174
if len (items ) > 0 {
@@ -153,15 +189,5 @@ func expandFeatures(input []interface{}) features.UserFeatures {
153
189
}
154
190
}
155
191
156
- if raw , ok := val ["network" ]; ok {
157
- items := raw .([]interface {})
158
- if len (items ) > 0 {
159
- networkRaw := items [0 ].(map [string ]interface {})
160
- if v , ok := networkRaw ["relaxed_locking" ]; ok {
161
- features .Network .RelaxedLocking = v .(bool )
162
- }
163
- }
164
- }
165
-
166
192
return features
167
193
}
0 commit comments