github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/kubernetes/schema_volume_source.go (about) 1 package kubernetes 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 ) 6 7 func persistentVolumeSourceSchema() *schema.Resource { 8 volumeSources["host_path"] = &schema.Schema{ 9 Type: schema.TypeList, 10 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", 11 Optional: true, 12 MaxItems: 1, 13 Elem: &schema.Resource{ 14 Schema: map[string]*schema.Schema{ 15 "path": { 16 Type: schema.TypeString, 17 Description: "Path of the directory on the host. More info: http://kubernetes.io/docs/user-guide/volumes#hostpath", 18 Optional: true, 19 }, 20 }, 21 }, 22 } 23 return &schema.Resource{ 24 Schema: volumeSources, 25 } 26 } 27 28 // Common volume sources between Persistent Volumes and Pod Volumes 29 var volumeSources = map[string]*schema.Schema{ 30 "aws_elastic_block_store": { 31 Type: schema.TypeList, 32 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", 33 Optional: true, 34 MaxItems: 1, 35 Elem: &schema.Resource{ 36 Schema: map[string]*schema.Schema{ 37 "fs_type": { 38 Type: schema.TypeString, 39 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", 40 Optional: true, 41 }, 42 "partition": { 43 Type: schema.TypeInt, 44 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).", 45 Optional: true, 46 }, 47 "read_only": { 48 Type: schema.TypeBool, 49 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", 50 Optional: true, 51 }, 52 "volume_id": { 53 Type: schema.TypeString, 54 Description: "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore", 55 Required: true, 56 }, 57 }, 58 }, 59 }, 60 "azure_disk": { 61 Type: schema.TypeList, 62 Description: "Represents an Azure Data Disk mount on the host and bind mount to the pod.", 63 Optional: true, 64 MaxItems: 1, 65 Elem: &schema.Resource{ 66 Schema: map[string]*schema.Schema{ 67 "caching_mode": { 68 Type: schema.TypeString, 69 Description: "Host Caching mode: None, Read Only, Read Write.", 70 Required: true, 71 }, 72 "data_disk_uri": { 73 Type: schema.TypeString, 74 Description: "The URI the data disk in the blob storage", 75 Required: true, 76 }, 77 "disk_name": { 78 Type: schema.TypeString, 79 Description: "The Name of the data disk in the blob storage", 80 Required: true, 81 }, 82 "fs_type": { 83 Type: schema.TypeString, 84 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.", 85 Optional: true, 86 }, 87 "read_only": { 88 Type: schema.TypeBool, 89 Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).", 90 Optional: true, 91 Default: false, 92 }, 93 }, 94 }, 95 }, 96 "azure_file": { 97 Type: schema.TypeList, 98 Description: "Represents an Azure File Service mount on the host and bind mount to the pod.", 99 Optional: true, 100 MaxItems: 1, 101 Elem: &schema.Resource{ 102 Schema: map[string]*schema.Schema{ 103 "read_only": { 104 Type: schema.TypeBool, 105 Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).", 106 Optional: true, 107 }, 108 "secret_name": { 109 Type: schema.TypeString, 110 Description: "The name of secret that contains Azure Storage Account Name and Key", 111 Required: true, 112 }, 113 "share_name": { 114 Type: schema.TypeString, 115 Description: "Share Name", 116 Required: true, 117 }, 118 }, 119 }, 120 }, 121 "ceph_fs": { 122 Type: schema.TypeList, 123 Description: "Represents a Ceph FS mount on the host that shares a pod's lifetime", 124 Optional: true, 125 MaxItems: 1, 126 Elem: &schema.Resource{ 127 Schema: map[string]*schema.Schema{ 128 "monitors": { 129 Type: schema.TypeSet, 130 Description: "Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", 131 Required: true, 132 Elem: &schema.Schema{Type: schema.TypeString}, 133 Set: schema.HashString, 134 }, 135 "path": { 136 Type: schema.TypeString, 137 Description: "Used as the mounted root, rather than the full Ceph tree, default is /", 138 Optional: true, 139 }, 140 "read_only": { 141 Type: schema.TypeBool, 142 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", 143 Optional: true, 144 }, 145 "secret_file": { 146 Type: schema.TypeString, 147 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", 148 Optional: true, 149 }, 150 "secret_ref": { 151 Type: schema.TypeList, 152 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", 153 Optional: true, 154 MaxItems: 1, 155 Elem: &schema.Resource{ 156 Schema: map[string]*schema.Schema{ 157 "name": { 158 Type: schema.TypeString, 159 Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", 160 Optional: true, 161 }, 162 }, 163 }, 164 }, 165 "user": { 166 Type: schema.TypeString, 167 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", 168 Optional: true, 169 }, 170 }, 171 }, 172 }, 173 "cinder": { 174 Type: schema.TypeList, 175 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", 176 Optional: true, 177 MaxItems: 1, 178 Elem: &schema.Resource{ 179 Schema: map[string]*schema.Schema{ 180 "fs_type": { 181 Type: schema.TypeString, 182 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", 183 Optional: true, 184 }, 185 "read_only": { 186 Type: schema.TypeBool, 187 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", 188 Optional: true, 189 }, 190 "volume_id": { 191 Type: schema.TypeString, 192 Description: "Volume ID used to identify the volume in Cinder. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", 193 Required: true, 194 }, 195 }, 196 }, 197 }, 198 "fc": { 199 Type: schema.TypeList, 200 Description: "Represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", 201 Optional: true, 202 MaxItems: 1, 203 Elem: &schema.Resource{ 204 Schema: map[string]*schema.Schema{ 205 "fs_type": { 206 Type: schema.TypeString, 207 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.", 208 Optional: true, 209 }, 210 "lun": { 211 Type: schema.TypeInt, 212 Description: "FC target lun number", 213 Required: true, 214 }, 215 "read_only": { 216 Type: schema.TypeBool, 217 Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).", 218 Optional: true, 219 }, 220 "target_ww_ns": { 221 Type: schema.TypeSet, 222 Description: "FC target worldwide names (WWNs)", 223 Required: true, 224 Elem: &schema.Schema{Type: schema.TypeString}, 225 Set: schema.HashString, 226 }, 227 }, 228 }, 229 }, 230 "flex_volume": { 231 Type: schema.TypeList, 232 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.", 233 Optional: true, 234 MaxItems: 1, 235 Elem: &schema.Resource{ 236 Schema: map[string]*schema.Schema{ 237 "driver": { 238 Type: schema.TypeString, 239 Description: "Driver is the name of the driver to use for this volume.", 240 Required: true, 241 }, 242 "fs_type": { 243 Type: schema.TypeString, 244 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.", 245 Optional: true, 246 }, 247 "options": { 248 Type: schema.TypeMap, 249 Description: "Extra command options if any.", 250 Optional: true, 251 }, 252 "read_only": { 253 Type: schema.TypeBool, 254 Description: "Whether to force the ReadOnly setting in VolumeMounts. Defaults to false (read/write).", 255 Optional: true, 256 }, 257 "secret_ref": { 258 Type: schema.TypeList, 259 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.", 260 Optional: true, 261 MaxItems: 1, 262 Elem: &schema.Resource{ 263 Schema: map[string]*schema.Schema{ 264 "name": { 265 Type: schema.TypeString, 266 Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", 267 Optional: true, 268 }, 269 }, 270 }, 271 }, 272 }, 273 }, 274 }, 275 "flocker": { 276 Type: schema.TypeList, 277 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", 278 Optional: true, 279 MaxItems: 1, 280 Elem: &schema.Resource{ 281 Schema: map[string]*schema.Schema{ 282 "dataset_name": { 283 Type: schema.TypeString, 284 Description: "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated", 285 Optional: true, 286 }, 287 "dataset_uuid": { 288 Type: schema.TypeString, 289 Description: "UUID of the dataset. This is unique identifier of a Flocker dataset", 290 Optional: true, 291 }, 292 }, 293 }, 294 }, 295 "gce_persistent_disk": { 296 Type: schema.TypeList, 297 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", 298 Optional: true, 299 MaxItems: 1, 300 Elem: &schema.Resource{ 301 Schema: map[string]*schema.Schema{ 302 "fs_type": { 303 Type: schema.TypeString, 304 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", 305 Optional: true, 306 }, 307 "partition": { 308 Type: schema.TypeInt, 309 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", 310 Optional: true, 311 }, 312 "pd_name": { 313 Type: schema.TypeString, 314 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", 315 Required: true, 316 }, 317 "read_only": { 318 Type: schema.TypeBool, 319 Description: "Whether to force the ReadOnly setting in VolumeMounts. Defaults to false. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk", 320 Optional: true, 321 }, 322 }, 323 }, 324 }, 325 "glusterfs": { 326 Type: schema.TypeList, 327 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", 328 Optional: true, 329 MaxItems: 1, 330 Elem: &schema.Resource{ 331 Schema: map[string]*schema.Schema{ 332 "endpoints_name": { 333 Type: schema.TypeString, 334 Description: "The endpoint name that details Glusterfs topology. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", 335 Required: true, 336 }, 337 "path": { 338 Type: schema.TypeString, 339 Description: "The Glusterfs volume path. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", 340 Required: true, 341 }, 342 "read_only": { 343 Type: schema.TypeBool, 344 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", 345 Optional: true, 346 }, 347 }, 348 }, 349 }, 350 "iscsi": { 351 Type: schema.TypeList, 352 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.", 353 Optional: true, 354 MaxItems: 1, 355 Elem: &schema.Resource{ 356 Schema: map[string]*schema.Schema{ 357 "fs_type": { 358 Type: schema.TypeString, 359 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", 360 Optional: true, 361 }, 362 "iqn": { 363 Type: schema.TypeString, 364 Description: "Target iSCSI Qualified Name.", 365 Required: true, 366 }, 367 "iscsi_interface": { 368 Type: schema.TypeString, 369 Description: "iSCSI interface name that uses an iSCSI transport. Defaults to 'default' (tcp).", 370 Optional: true, 371 Default: "default", 372 }, 373 "lun": { 374 Type: schema.TypeInt, 375 Description: "iSCSI target lun number.", 376 Optional: true, 377 }, 378 "read_only": { 379 Type: schema.TypeBool, 380 Description: "Whether to force the read-only setting in VolumeMounts. Defaults to false.", 381 Optional: true, 382 }, 383 "target_portal": { 384 Type: schema.TypeString, 385 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).", 386 Required: true, 387 }, 388 }, 389 }, 390 }, 391 "nfs": { 392 Type: schema.TypeList, 393 Description: "Represents an NFS mount on the host. Provisioned by an admin. More info: http://kubernetes.io/docs/user-guide/volumes#nfs", 394 Optional: true, 395 MaxItems: 1, 396 Elem: &schema.Resource{ 397 Schema: map[string]*schema.Schema{ 398 "path": { 399 Type: schema.TypeString, 400 Description: "Path that is exported by the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs", 401 Required: true, 402 }, 403 "read_only": { 404 Type: schema.TypeBool, 405 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", 406 Optional: true, 407 }, 408 "server": { 409 Type: schema.TypeString, 410 Description: "Server is the hostname or IP address of the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs", 411 Required: true, 412 }, 413 }, 414 }, 415 }, 416 "photon_persistent_disk": { 417 Type: schema.TypeList, 418 Description: "Represents a PhotonController persistent disk attached and mounted on kubelets host machine", 419 Optional: true, 420 MaxItems: 1, 421 Elem: &schema.Resource{ 422 Schema: map[string]*schema.Schema{ 423 "fs_type": { 424 Type: schema.TypeString, 425 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.", 426 Optional: true, 427 }, 428 "pd_id": { 429 Type: schema.TypeString, 430 Description: "ID that identifies Photon Controller persistent disk", 431 Required: true, 432 }, 433 }, 434 }, 435 }, 436 "quobyte": { 437 Type: schema.TypeList, 438 Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", 439 Optional: true, 440 MaxItems: 1, 441 Elem: &schema.Resource{ 442 Schema: map[string]*schema.Schema{ 443 "group": { 444 Type: schema.TypeString, 445 Description: "Group to map volume access to Default is no group", 446 Optional: true, 447 }, 448 "read_only": { 449 Type: schema.TypeBool, 450 Description: "Whether to force the Quobyte volume to be mounted with read-only permissions. Defaults to false.", 451 Optional: true, 452 }, 453 "registry": { 454 Type: schema.TypeString, 455 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", 456 Required: true, 457 }, 458 "user": { 459 Type: schema.TypeString, 460 Description: "User to map volume access to Defaults to serivceaccount user", 461 Optional: true, 462 }, 463 "volume": { 464 Type: schema.TypeString, 465 Description: "Volume is a string that references an already created Quobyte volume by name.", 466 Required: true, 467 }, 468 }, 469 }, 470 }, 471 "rbd": { 472 Type: schema.TypeList, 473 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", 474 Optional: true, 475 MaxItems: 1, 476 Elem: &schema.Resource{ 477 Schema: map[string]*schema.Schema{ 478 "ceph_monitors": { 479 Type: schema.TypeSet, 480 Description: "A collection of Ceph monitors. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", 481 Required: true, 482 Elem: &schema.Schema{Type: schema.TypeString}, 483 Set: schema.HashString, 484 }, 485 "fs_type": { 486 Type: schema.TypeString, 487 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", 488 Optional: true, 489 }, 490 "keyring": { 491 Type: schema.TypeString, 492 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", 493 Optional: true, 494 Computed: true, 495 }, 496 "rados_user": { 497 Type: schema.TypeString, 498 Description: "The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", 499 Optional: true, 500 Default: "admin", 501 }, 502 "rbd_image": { 503 Type: schema.TypeString, 504 Description: "The rados image name. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", 505 Required: true, 506 }, 507 "rbd_pool": { 508 Type: schema.TypeString, 509 Description: "The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it.", 510 Optional: true, 511 Default: "rbd", 512 }, 513 "read_only": { 514 Type: schema.TypeBool, 515 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", 516 Optional: true, 517 Default: false, 518 }, 519 "secret_ref": { 520 Type: schema.TypeList, 521 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", 522 Optional: true, 523 MaxItems: 1, 524 Elem: &schema.Resource{ 525 Schema: map[string]*schema.Schema{ 526 "name": { 527 Type: schema.TypeString, 528 Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", 529 Optional: true, 530 }, 531 }, 532 }, 533 }, 534 }, 535 }, 536 }, 537 "vsphere_volume": { 538 Type: schema.TypeList, 539 Description: "Represents a vSphere volume attached and mounted on kubelets host machine", 540 Optional: true, 541 MaxItems: 1, 542 Elem: &schema.Resource{ 543 Schema: map[string]*schema.Schema{ 544 "fs_type": { 545 Type: schema.TypeString, 546 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.", 547 Optional: true, 548 }, 549 "volume_path": { 550 Type: schema.TypeString, 551 Description: "Path that identifies vSphere volume vmdk", 552 Required: true, 553 }, 554 }, 555 }, 556 }, 557 }