» kubernetes_persistent_volume_claim
This resource allows the user to request for and claim to a persistent volume.
» Example Usage
resource "kubernetes_persistent_volume_claim" "example" {
metadata {
name = "exampleclaimname"
}
spec {
access_modes = ["ReadWriteMany"]
resources {
requests {
storage = "5Gi"
}
}
volume_name = "${kubernetes_persistent_volume.example.metadata.0.name}"
}
}
resource "kubernetes_persistent_volume" "example" {
metadata {
name = "examplevolumename"
}
spec {
capacity {
storage = "10Gi"
}
access_modes = ["ReadWriteMany"]
persistent_volume_source {
gce_persistent_disk {
pd_name = "test-123"
}
}
}
}
» Argument Reference
The following arguments are supported:
-
metadata
- (Required) Standard persistent volume claim's metadata. For more info see Kubernetes reference -
spec
- (Required) Spec defines the desired characteristics of a volume requested by a pod author. For more info see Kubernetes reference -
wait_until_bound
- (Optional) Whether to wait for the claim to reachBound
state (to find volume in which to claim the space)
» Nested Blocks
»
metadata
» Arguments
-
annotations
- (Optional) An unstructured key value map stored with the persistent volume claim that may be used to store arbitrary metadata. For more info see Kubernetes reference -
generate_name
- (Optional) Prefix, used by the server, to generate a unique name ONLY IF thename
field has not been provided. This value will also be combined with a unique suffix. For more info see Kubernetes reference -
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. For more info see Kubernetes reference -
name
- (Optional) Name of the persistent volume claim, must be unique. Cannot be updated. For more info see Kubernetes reference -
namespace
- (Optional) Namespace defines the space within which name of the persistent volume claim must be unique.
» Attributes
-
generation
- A sequence number representing a specific generation of the desired state. -
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. For more info see Kubernetes reference -
self_link
- A URL representing this persistent volume claim. -
uid
- The unique in time and space value for this persistent volume claim. For more info see Kubernetes reference
»
spec
» Arguments
-
access_modes
- (Required) A set of the desired access modes the volume should have. For more info see Kubernetes reference -
resources
- (Required) A list of the minimum resources the volume should have. For more info see Kubernetes reference -
selector
- (Optional) A label query over volumes to consider for binding. -
volume_name
- (Optional) The binding reference to the PersistentVolume backing this claim. -
storage_class_name
- (Optional) Name of the storage class requested by the claim
»
match_expressions
» Arguments
-
key
- (Optional) The label key that the selector applies to. -
operator
- (Optional) A key's relationship to a set of values. Valid operators ardIn
,NotIn
,Exists
andDoesNotExist
. -
values
- (Optional) An array of string values. If the operator isIn
orNotIn
, the values array must be non-empty. If the operator isExists
orDoesNotExist
, the values array must be empty. This array is replaced during a strategic merge patch.
»
resources
» Arguments
-
limits
- (Optional) Map describing the maximum amount of compute resources allowed. For more info see Kubernetes reference/ -
requests
- (Optional) Map describing the minimum amount of compute resources required. If this is omitted for a container, it defaults tolimits
if that is explicitly specified, otherwise to an implementation-defined value. For more info see Kubernetes reference/
»
selector
» Arguments
-
match_expressions
- (Optional) A list of label selector requirements. The requirements are ANDed. -
match_labels
- (Optional) A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element ofmatch_expressions
, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
» Import
Persistent Volume Claim can be imported using its namespace and name, e.g.
$ terraform import kubernetes_persistent_volume_claim.example default/example-name