github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/kubernetes/r/persistent_volume_claim.html.markdown (about) 1 --- 2 layout: "kubernetes" 3 page_title: "Kubernetes: kubernetes_persistent_volume_claim" 4 sidebar_current: "docs-kubernetes-resource-persistent-volume-claim" 5 description: |- 6 This resource allows the user to request for and claim to a persistent volume. 7 --- 8 9 # kubernetes_persistent_volume_claim 10 11 This resource allows the user to request for and claim to a persistent volume. 12 13 ## Example Usage 14 15 ```hcl 16 resource "kubernetes_persistent_volume_claim" "example" { 17 metadata { 18 name = "exampleclaimname" 19 } 20 spec { 21 access_modes = ["ReadWriteMany"] 22 resources { 23 requests { 24 storage = "5Gi" 25 } 26 } 27 volume_name = "${kubernetes_persistent_volume.example.metadata.0.name}" 28 } 29 } 30 31 resource "kubernetes_persistent_volume" "example" { 32 metadata { 33 name = "examplevolumename" 34 } 35 spec { 36 capacity { 37 storage = "10Gi" 38 } 39 access_modes = ["ReadWriteMany"] 40 persistent_volume_source { 41 gce_persistent_disk { 42 pd_name = "test-123" 43 } 44 } 45 } 46 } 47 ``` 48 49 ## Argument Reference 50 51 The following arguments are supported: 52 53 * `metadata` - (Required) Standard persistent volume claim's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata 54 * `spec` - (Required) Spec defines the desired characteristics of a volume requested by a pod author. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims 55 * `wait_until_bound` - (Optional) Whether to wait for the claim to reach `Bound` state (to find volume in which to claim the space) 56 57 ## Nested Blocks 58 59 ### `metadata` 60 61 #### Arguments 62 63 * `annotations` - (Optional) An unstructured key value map stored with the persistent volume claim that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations 64 * `generate_name` - (Optional) Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency 65 * `labels` - (Optional) Map of string keys and values that can be used to organize and categorize (scope and select) the persistent volume claim. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels 66 * `name` - (Optional) Name of the persistent volume claim, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names 67 * `namespace` - (Optional) Namespace defines the space within which name of the persistent volume claim must be unique. 68 69 #### Attributes 70 71 * `generation` - A sequence number representing a specific generation of the desired state. 72 * `resource_version` - An opaque value that represents the internal version of this persistent volume claim that can be used by clients to determine when persistent volume claim has changed. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#concurrency-control-and-consistency 73 * `self_link` - A URL representing this persistent volume claim. 74 * `uid` - The unique in time and space value for this persistent volume claim. More info: http://kubernetes.io/docs/user-guide/identifiers#uids 75 76 ### `spec` 77 78 #### Arguments 79 80 * `access_modes` - (Required) A set of the desired access modes the volume should have. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#access-modes-1 81 * `resources` - (Required) A list of the minimum resources the volume should have. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources 82 * `selector` - (Optional) A label query over volumes to consider for binding. 83 * `volume_name` - (Optional) The binding reference to the PersistentVolume backing this claim. 84 85 ### `match_expressions` 86 87 #### Arguments 88 89 * `key` - (Optional) The label key that the selector applies to. 90 * `operator` - (Optional) A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`. 91 * `values` - (Optional) An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch. 92 93 94 ### `resources` 95 96 #### Arguments 97 98 * `limits` - (Optional) Map describing the maximum amount of compute resources allowed. More info: http://kubernetes.io/docs/user-guide/compute-resources/ 99 * `requests` - (Optional) Map describing the minimum amount of compute resources required. If this is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. More info: http://kubernetes.io/docs/user-guide/compute-resources/ 100 101 ### `selector` 102 103 #### Arguments 104 105 * `match_expressions` - (Optional) A list of label selector requirements. The requirements are ANDed. 106 * `match_labels` - (Optional) A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. 107 108 ## Import 109 110 Persistent Volume Claim can be imported using its name, e.g. 111 112 ``` 113 $ terraform import kubernetes_persistent_volume_claim.example example-name 114 ```