-
Notifications
You must be signed in to change notification settings - Fork 51
/
scaleSet.go
411 lines (374 loc) · 18.9 KB
/
scaleSet.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package compute
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/virtual_machine_scale_set.html.markdown.
type ScaleSet struct {
s *pulumi.ResourceState
}
// NewScaleSet registers a new resource with the given unique name, arguments, and options.
func NewScaleSet(ctx *pulumi.Context,
name string, args *ScaleSetArgs, opts ...pulumi.ResourceOpt) (*ScaleSet, error) {
if args == nil || args.NetworkProfiles == nil {
return nil, errors.New("missing required argument 'NetworkProfiles'")
}
if args == nil || args.OsProfile == nil {
return nil, errors.New("missing required argument 'OsProfile'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil || args.Sku == nil {
return nil, errors.New("missing required argument 'Sku'")
}
if args == nil || args.StorageProfileOsDisk == nil {
return nil, errors.New("missing required argument 'StorageProfileOsDisk'")
}
if args == nil || args.UpgradePolicyMode == nil {
return nil, errors.New("missing required argument 'UpgradePolicyMode'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["automaticOsUpgrade"] = nil
inputs["bootDiagnostics"] = nil
inputs["evictionPolicy"] = nil
inputs["extensions"] = nil
inputs["healthProbeId"] = nil
inputs["identity"] = nil
inputs["licenseType"] = nil
inputs["location"] = nil
inputs["name"] = nil
inputs["networkProfiles"] = nil
inputs["osProfile"] = nil
inputs["osProfileLinuxConfig"] = nil
inputs["osProfileSecrets"] = nil
inputs["osProfileWindowsConfig"] = nil
inputs["overprovision"] = nil
inputs["plan"] = nil
inputs["priority"] = nil
inputs["proximityPlacementGroupId"] = nil
inputs["resourceGroupName"] = nil
inputs["rollingUpgradePolicy"] = nil
inputs["singlePlacementGroup"] = nil
inputs["sku"] = nil
inputs["storageProfileDataDisks"] = nil
inputs["storageProfileImageReference"] = nil
inputs["storageProfileOsDisk"] = nil
inputs["tags"] = nil
inputs["upgradePolicyMode"] = nil
inputs["zones"] = nil
} else {
inputs["automaticOsUpgrade"] = args.AutomaticOsUpgrade
inputs["bootDiagnostics"] = args.BootDiagnostics
inputs["evictionPolicy"] = args.EvictionPolicy
inputs["extensions"] = args.Extensions
inputs["healthProbeId"] = args.HealthProbeId
inputs["identity"] = args.Identity
inputs["licenseType"] = args.LicenseType
inputs["location"] = args.Location
inputs["name"] = args.Name
inputs["networkProfiles"] = args.NetworkProfiles
inputs["osProfile"] = args.OsProfile
inputs["osProfileLinuxConfig"] = args.OsProfileLinuxConfig
inputs["osProfileSecrets"] = args.OsProfileSecrets
inputs["osProfileWindowsConfig"] = args.OsProfileWindowsConfig
inputs["overprovision"] = args.Overprovision
inputs["plan"] = args.Plan
inputs["priority"] = args.Priority
inputs["proximityPlacementGroupId"] = args.ProximityPlacementGroupId
inputs["resourceGroupName"] = args.ResourceGroupName
inputs["rollingUpgradePolicy"] = args.RollingUpgradePolicy
inputs["singlePlacementGroup"] = args.SinglePlacementGroup
inputs["sku"] = args.Sku
inputs["storageProfileDataDisks"] = args.StorageProfileDataDisks
inputs["storageProfileImageReference"] = args.StorageProfileImageReference
inputs["storageProfileOsDisk"] = args.StorageProfileOsDisk
inputs["tags"] = args.Tags
inputs["upgradePolicyMode"] = args.UpgradePolicyMode
inputs["zones"] = args.Zones
}
s, err := ctx.RegisterResource("azure:compute/scaleSet:ScaleSet", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &ScaleSet{s: s}, nil
}
// GetScaleSet gets an existing ScaleSet resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetScaleSet(ctx *pulumi.Context,
name string, id pulumi.ID, state *ScaleSetState, opts ...pulumi.ResourceOpt) (*ScaleSet, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["automaticOsUpgrade"] = state.AutomaticOsUpgrade
inputs["bootDiagnostics"] = state.BootDiagnostics
inputs["evictionPolicy"] = state.EvictionPolicy
inputs["extensions"] = state.Extensions
inputs["healthProbeId"] = state.HealthProbeId
inputs["identity"] = state.Identity
inputs["licenseType"] = state.LicenseType
inputs["location"] = state.Location
inputs["name"] = state.Name
inputs["networkProfiles"] = state.NetworkProfiles
inputs["osProfile"] = state.OsProfile
inputs["osProfileLinuxConfig"] = state.OsProfileLinuxConfig
inputs["osProfileSecrets"] = state.OsProfileSecrets
inputs["osProfileWindowsConfig"] = state.OsProfileWindowsConfig
inputs["overprovision"] = state.Overprovision
inputs["plan"] = state.Plan
inputs["priority"] = state.Priority
inputs["proximityPlacementGroupId"] = state.ProximityPlacementGroupId
inputs["resourceGroupName"] = state.ResourceGroupName
inputs["rollingUpgradePolicy"] = state.RollingUpgradePolicy
inputs["singlePlacementGroup"] = state.SinglePlacementGroup
inputs["sku"] = state.Sku
inputs["storageProfileDataDisks"] = state.StorageProfileDataDisks
inputs["storageProfileImageReference"] = state.StorageProfileImageReference
inputs["storageProfileOsDisk"] = state.StorageProfileOsDisk
inputs["tags"] = state.Tags
inputs["upgradePolicyMode"] = state.UpgradePolicyMode
inputs["zones"] = state.Zones
}
s, err := ctx.ReadResource("azure:compute/scaleSet:ScaleSet", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &ScaleSet{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *ScaleSet) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *ScaleSet) ID() *pulumi.IDOutput {
return r.s.ID()
}
// Automatic OS patches can be applied by Azure to your scaleset. This is particularly useful when `upgradePolicyMode` is set to `Rolling`. Defaults to `false`.
func (r *ScaleSet) AutomaticOsUpgrade() *pulumi.BoolOutput {
return (*pulumi.BoolOutput)(r.s.State["automaticOsUpgrade"])
}
// A boot diagnostics profile block as referenced below.
func (r *ScaleSet) BootDiagnostics() *pulumi.Output {
return r.s.State["bootDiagnostics"]
}
// Specifies the eviction policy for Virtual Machines in this Scale Set. Possible values are `Deallocate` and `Delete`.
func (r *ScaleSet) EvictionPolicy() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["evictionPolicy"])
}
// Can be specified multiple times to add extension profiles to the scale set. Each `extension` block supports the fields documented below.
func (r *ScaleSet) Extensions() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["extensions"])
}
// Specifies the identifier for the load balancer health probe. Required when using `Rolling` as your `upgradePolicyMode`.
func (r *ScaleSet) HealthProbeId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["healthProbeId"])
}
func (r *ScaleSet) Identity() *pulumi.Output {
return r.s.State["identity"]
}
// Specifies the Windows OS license type. If supplied, the only allowed values are `Windows_Client` and `Windows_Server`.
func (r *ScaleSet) LicenseType() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["licenseType"])
}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
func (r *ScaleSet) Location() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["location"])
}
// Specifies the name of the image from the marketplace.
func (r *ScaleSet) Name() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["name"])
}
// A collection of network profile block as documented below.
func (r *ScaleSet) NetworkProfiles() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["networkProfiles"])
}
// A Virtual Machine OS Profile block as documented below.
func (r *ScaleSet) OsProfile() *pulumi.Output {
return r.s.State["osProfile"]
}
// A Linux config block as documented below.
func (r *ScaleSet) OsProfileLinuxConfig() *pulumi.Output {
return r.s.State["osProfileLinuxConfig"]
}
// A collection of Secret blocks as documented below.
func (r *ScaleSet) OsProfileSecrets() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["osProfileSecrets"])
}
// A Windows config block as documented below.
func (r *ScaleSet) OsProfileWindowsConfig() *pulumi.Output {
return r.s.State["osProfileWindowsConfig"]
}
// Specifies whether the virtual machine scale set should be overprovisioned.
func (r *ScaleSet) Overprovision() *pulumi.BoolOutput {
return (*pulumi.BoolOutput)(r.s.State["overprovision"])
}
// A plan block as documented below.
func (r *ScaleSet) Plan() *pulumi.Output {
return r.s.State["plan"]
}
// Specifies the priority for the Virtual Machines in the Scale Set. Defaults to `Regular`. Possible values are `Low` and `Regular`.
func (r *ScaleSet) Priority() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["priority"])
}
// The ID of the Proximity Placement Group to which this Virtual Machine should be assigned. Changing this forces a new resource to be created
func (r *ScaleSet) ProximityPlacementGroupId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["proximityPlacementGroupId"])
}
// The name of the resource group in which to create the virtual machine scale set. Changing this forces a new resource to be created.
func (r *ScaleSet) ResourceGroupName() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["resourceGroupName"])
}
// A `rollingUpgradePolicy` block as defined below. This is only applicable when the `upgradePolicyMode` is `Rolling`.
func (r *ScaleSet) RollingUpgradePolicy() *pulumi.Output {
return r.s.State["rollingUpgradePolicy"]
}
// Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Default is true. Changing this forces a new resource to be created. See [documentation](http://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups) for more information.
func (r *ScaleSet) SinglePlacementGroup() *pulumi.BoolOutput {
return (*pulumi.BoolOutput)(r.s.State["singlePlacementGroup"])
}
// Specifies the SKU of the image used to create the virtual machines.
func (r *ScaleSet) Sku() *pulumi.Output {
return r.s.State["sku"]
}
// A storage profile data disk block as documented below
func (r *ScaleSet) StorageProfileDataDisks() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["storageProfileDataDisks"])
}
// A storage profile image reference block as documented below.
func (r *ScaleSet) StorageProfileImageReference() *pulumi.Output {
return r.s.State["storageProfileImageReference"]
}
// A storage profile os disk block as documented below
func (r *ScaleSet) StorageProfileOsDisk() *pulumi.Output {
return r.s.State["storageProfileOsDisk"]
}
// A mapping of tags to assign to the resource.
func (r *ScaleSet) Tags() *pulumi.MapOutput {
return (*pulumi.MapOutput)(r.s.State["tags"])
}
// Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Rolling`, `Manual`, or `Automatic`. When choosing `Rolling`, you will need to set a health probe.
func (r *ScaleSet) UpgradePolicyMode() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["upgradePolicyMode"])
}
// A collection of availability zones to spread the Virtual Machines over.
func (r *ScaleSet) Zones() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["zones"])
}
// Input properties used for looking up and filtering ScaleSet resources.
type ScaleSetState struct {
// Automatic OS patches can be applied by Azure to your scaleset. This is particularly useful when `upgradePolicyMode` is set to `Rolling`. Defaults to `false`.
AutomaticOsUpgrade interface{}
// A boot diagnostics profile block as referenced below.
BootDiagnostics interface{}
// Specifies the eviction policy for Virtual Machines in this Scale Set. Possible values are `Deallocate` and `Delete`.
EvictionPolicy interface{}
// Can be specified multiple times to add extension profiles to the scale set. Each `extension` block supports the fields documented below.
Extensions interface{}
// Specifies the identifier for the load balancer health probe. Required when using `Rolling` as your `upgradePolicyMode`.
HealthProbeId interface{}
Identity interface{}
// Specifies the Windows OS license type. If supplied, the only allowed values are `Windows_Client` and `Windows_Server`.
LicenseType interface{}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location interface{}
// Specifies the name of the image from the marketplace.
Name interface{}
// A collection of network profile block as documented below.
NetworkProfiles interface{}
// A Virtual Machine OS Profile block as documented below.
OsProfile interface{}
// A Linux config block as documented below.
OsProfileLinuxConfig interface{}
// A collection of Secret blocks as documented below.
OsProfileSecrets interface{}
// A Windows config block as documented below.
OsProfileWindowsConfig interface{}
// Specifies whether the virtual machine scale set should be overprovisioned.
Overprovision interface{}
// A plan block as documented below.
Plan interface{}
// Specifies the priority for the Virtual Machines in the Scale Set. Defaults to `Regular`. Possible values are `Low` and `Regular`.
Priority interface{}
// The ID of the Proximity Placement Group to which this Virtual Machine should be assigned. Changing this forces a new resource to be created
ProximityPlacementGroupId interface{}
// The name of the resource group in which to create the virtual machine scale set. Changing this forces a new resource to be created.
ResourceGroupName interface{}
// A `rollingUpgradePolicy` block as defined below. This is only applicable when the `upgradePolicyMode` is `Rolling`.
RollingUpgradePolicy interface{}
// Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Default is true. Changing this forces a new resource to be created. See [documentation](http://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups) for more information.
SinglePlacementGroup interface{}
// Specifies the SKU of the image used to create the virtual machines.
Sku interface{}
// A storage profile data disk block as documented below
StorageProfileDataDisks interface{}
// A storage profile image reference block as documented below.
StorageProfileImageReference interface{}
// A storage profile os disk block as documented below
StorageProfileOsDisk interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
// Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Rolling`, `Manual`, or `Automatic`. When choosing `Rolling`, you will need to set a health probe.
UpgradePolicyMode interface{}
// A collection of availability zones to spread the Virtual Machines over.
Zones interface{}
}
// The set of arguments for constructing a ScaleSet resource.
type ScaleSetArgs struct {
// Automatic OS patches can be applied by Azure to your scaleset. This is particularly useful when `upgradePolicyMode` is set to `Rolling`. Defaults to `false`.
AutomaticOsUpgrade interface{}
// A boot diagnostics profile block as referenced below.
BootDiagnostics interface{}
// Specifies the eviction policy for Virtual Machines in this Scale Set. Possible values are `Deallocate` and `Delete`.
EvictionPolicy interface{}
// Can be specified multiple times to add extension profiles to the scale set. Each `extension` block supports the fields documented below.
Extensions interface{}
// Specifies the identifier for the load balancer health probe. Required when using `Rolling` as your `upgradePolicyMode`.
HealthProbeId interface{}
Identity interface{}
// Specifies the Windows OS license type. If supplied, the only allowed values are `Windows_Client` and `Windows_Server`.
LicenseType interface{}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location interface{}
// Specifies the name of the image from the marketplace.
Name interface{}
// A collection of network profile block as documented below.
NetworkProfiles interface{}
// A Virtual Machine OS Profile block as documented below.
OsProfile interface{}
// A Linux config block as documented below.
OsProfileLinuxConfig interface{}
// A collection of Secret blocks as documented below.
OsProfileSecrets interface{}
// A Windows config block as documented below.
OsProfileWindowsConfig interface{}
// Specifies whether the virtual machine scale set should be overprovisioned.
Overprovision interface{}
// A plan block as documented below.
Plan interface{}
// Specifies the priority for the Virtual Machines in the Scale Set. Defaults to `Regular`. Possible values are `Low` and `Regular`.
Priority interface{}
// The ID of the Proximity Placement Group to which this Virtual Machine should be assigned. Changing this forces a new resource to be created
ProximityPlacementGroupId interface{}
// The name of the resource group in which to create the virtual machine scale set. Changing this forces a new resource to be created.
ResourceGroupName interface{}
// A `rollingUpgradePolicy` block as defined below. This is only applicable when the `upgradePolicyMode` is `Rolling`.
RollingUpgradePolicy interface{}
// Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Default is true. Changing this forces a new resource to be created. See [documentation](http://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups) for more information.
SinglePlacementGroup interface{}
// Specifies the SKU of the image used to create the virtual machines.
Sku interface{}
// A storage profile data disk block as documented below
StorageProfileDataDisks interface{}
// A storage profile image reference block as documented below.
StorageProfileImageReference interface{}
// A storage profile os disk block as documented below
StorageProfileOsDisk interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
// Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Rolling`, `Manual`, or `Automatic`. When choosing `Rolling`, you will need to set a health probe.
UpgradePolicyMode interface{}
// A collection of availability zones to spread the Virtual Machines over.
Zones interface{}
}