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:

Nested Blocks

metadata

Arguments

Attributes

spec

Arguments

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 ard In, NotIn, Exists and DoesNotExist.
  • 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.

resources

Arguments

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 of match_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

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/kubernetes/r/persistent_volume_claim.html