forked from hashicorp/terraform
/
schema_volume_source.go
557 lines (554 loc) · 22.2 KB
/
schema_volume_source.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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
package kubernetes
import (
"github.com/hashicorp/terraform/helper/schema"
)
func persistentVolumeSourceSchema() *schema.Resource {
volumeSources["host_path"] = &schema.Schema{
Type: schema.TypeList,
Description: "Represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: http://kubernetes.io/docs/user-guide/volumes#hostpath",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"path": {
Type: schema.TypeString,
Description: "Path of the directory on the host. More info: http://kubernetes.io/docs/user-guide/volumes#hostpath",
Optional: true,
},
},
},
}
return &schema.Resource{
Schema: volumeSources,
}
}
// Common volume sources between Persistent Volumes and Pod Volumes
var volumeSources = map[string]*schema.Schema{
"aws_elastic_block_store": {
Type: schema.TypeList,
Description: "Represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore",
Optional: true,
},
"partition": {
Type: schema.TypeInt,
Description: "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to set the read-only property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore",
Optional: true,
},
"volume_id": {
Type: schema.TypeString,
Description: "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore",
Required: true,
},
},
},
},
"azure_disk": {
Type: schema.TypeList,
Description: "Represents an Azure Data Disk mount on the host and bind mount to the pod.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"caching_mode": {
Type: schema.TypeString,
Description: "Host Caching mode: None, Read Only, Read Write.",
Required: true,
},
"data_disk_uri": {
Type: schema.TypeString,
Description: "The URI the data disk in the blob storage",
Required: true,
},
"disk_name": {
Type: schema.TypeString,
Description: "The Name of the data disk in the blob storage",
Required: true,
},
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).",
Optional: true,
Default: false,
},
},
},
},
"azure_file": {
Type: schema.TypeList,
Description: "Represents an Azure File Service mount on the host and bind mount to the pod.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).",
Optional: true,
},
"secret_name": {
Type: schema.TypeString,
Description: "The name of secret that contains Azure Storage Account Name and Key",
Required: true,
},
"share_name": {
Type: schema.TypeString,
Description: "Share Name",
Required: true,
},
},
},
},
"ceph_fs": {
Type: schema.TypeList,
Description: "Represents a Ceph FS mount on the host that shares a pod's lifetime",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"monitors": {
Type: schema.TypeSet,
Description: "Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it",
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"path": {
Type: schema.TypeString,
Description: "Used as the mounted root, rather than the full Ceph tree, default is /",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to `false` (read/write). More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it",
Optional: true,
},
"secret_file": {
Type: schema.TypeString,
Description: "The path to key ring for User, default is /etc/ceph/user.secret More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it",
Optional: true,
},
"secret_ref": {
Type: schema.TypeList,
Description: "Reference to the authentication secret for User, default is empty. More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
Optional: true,
},
},
},
},
"user": {
Type: schema.TypeString,
Description: "User is the rados user name, default is admin. More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it",
Optional: true,
},
},
},
},
"cinder": {
Type: schema.TypeList,
Description: "Represents a cinder volume attached and mounted on kubelets host machine. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write). More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md",
Optional: true,
},
"volume_id": {
Type: schema.TypeString,
Description: "Volume ID used to identify the volume in Cinder. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md",
Required: true,
},
},
},
},
"fc": {
Type: schema.TypeList,
Description: "Represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
Optional: true,
},
"lun": {
Type: schema.TypeInt,
Description: "FC target lun number",
Required: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).",
Optional: true,
},
"target_ww_ns": {
Type: schema.TypeSet,
Description: "FC target worldwide names (WWNs)",
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
},
},
},
"flex_volume": {
Type: schema.TypeList,
Description: "Represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"driver": {
Type: schema.TypeString,
Description: "Driver is the name of the driver to use for this volume.",
Required: true,
},
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.",
Optional: true,
},
"options": {
Type: schema.TypeMap,
Description: "Extra command options if any.",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the ReadOnly setting in VolumeMounts. Defaults to false (read/write).",
Optional: true,
},
"secret_ref": {
Type: schema.TypeList,
Description: "Reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
Optional: true,
},
},
},
},
},
},
},
"flocker": {
Type: schema.TypeList,
Description: "Represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"dataset_name": {
Type: schema.TypeString,
Description: "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated",
Optional: true,
},
"dataset_uuid": {
Type: schema.TypeString,
Description: "UUID of the dataset. This is unique identifier of a Flocker dataset",
Optional: true,
},
},
},
},
"gce_persistent_disk": {
Type: schema.TypeList,
Description: "Represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk",
Optional: true,
},
"partition": {
Type: schema.TypeInt,
Description: "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk",
Optional: true,
},
"pd_name": {
Type: schema.TypeString,
Description: "Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk",
Required: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the ReadOnly setting in VolumeMounts. Defaults to false. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk",
Optional: true,
},
},
},
},
"glusterfs": {
Type: schema.TypeList,
Description: "Represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"endpoints_name": {
Type: schema.TypeString,
Description: "The endpoint name that details Glusterfs topology. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
Required: true,
},
"path": {
Type: schema.TypeString,
Description: "The Glusterfs volume path. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
Required: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
Optional: true,
},
},
},
},
"iscsi": {
Type: schema.TypeList,
Description: "Represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#iscsi",
Optional: true,
},
"iqn": {
Type: schema.TypeString,
Description: "Target iSCSI Qualified Name.",
Required: true,
},
"iscsi_interface": {
Type: schema.TypeString,
Description: "iSCSI interface name that uses an iSCSI transport. Defaults to 'default' (tcp).",
Optional: true,
Default: "default",
},
"lun": {
Type: schema.TypeInt,
Description: "iSCSI target lun number.",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false.",
Optional: true,
},
"target_portal": {
Type: schema.TypeString,
Description: "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).",
Required: true,
},
},
},
},
"nfs": {
Type: schema.TypeList,
Description: "Represents an NFS mount on the host. Provisioned by an admin. More info: http://kubernetes.io/docs/user-guide/volumes#nfs",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"path": {
Type: schema.TypeString,
Description: "Path that is exported by the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs",
Required: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the NFS export to be mounted with read-only permissions. Defaults to false. More info: http://kubernetes.io/docs/user-guide/volumes#nfs",
Optional: true,
},
"server": {
Type: schema.TypeString,
Description: "Server is the hostname or IP address of the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs",
Required: true,
},
},
},
},
"photon_persistent_disk": {
Type: schema.TypeList,
Description: "Represents a PhotonController persistent disk attached and mounted on kubelets host machine",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
Optional: true,
},
"pd_id": {
Type: schema.TypeString,
Description: "ID that identifies Photon Controller persistent disk",
Required: true,
},
},
},
},
"quobyte": {
Type: schema.TypeList,
Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group": {
Type: schema.TypeString,
Description: "Group to map volume access to Default is no group",
Optional: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the Quobyte volume to be mounted with read-only permissions. Defaults to false.",
Optional: true,
},
"registry": {
Type: schema.TypeString,
Description: "Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes",
Required: true,
},
"user": {
Type: schema.TypeString,
Description: "User to map volume access to Defaults to serivceaccount user",
Optional: true,
},
"volume": {
Type: schema.TypeString,
Description: "Volume is a string that references an already created Quobyte volume by name.",
Required: true,
},
},
},
},
"rbd": {
Type: schema.TypeList,
Description: "Represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ceph_monitors": {
Type: schema.TypeSet,
Description: "A collection of Ceph monitors. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#rbd",
Optional: true,
},
"keyring": {
Type: schema.TypeString,
Description: "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Optional: true,
Computed: true,
},
"rados_user": {
Type: schema.TypeString,
Description: "The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Optional: true,
Default: "admin",
},
"rbd_image": {
Type: schema.TypeString,
Description: "The rados image name. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Required: true,
},
"rbd_pool": {
Type: schema.TypeString,
Description: "The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it.",
Optional: true,
Default: "rbd",
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Optional: true,
Default: false,
},
"secret_ref": {
Type: schema.TypeList,
Description: "Name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
Optional: true,
},
},
},
},
},
},
},
"vsphere_volume": {
Type: schema.TypeList,
Description: "Represents a vSphere volume attached and mounted on kubelets host machine",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fs_type": {
Type: schema.TypeString,
Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
Optional: true,
},
"volume_path": {
Type: schema.TypeString,
Description: "Path that identifies vSphere volume vmdk",
Required: true,
},
},
},
},
}