Skip to content

Instantly share code, notes, and snippets.

@rivernews
Created December 8, 2019 23:37
Show Gist options
  • Save rivernews/65732ac141edb26389c5c786cddf3e9b to your computer and use it in GitHub Desktop.
Save rivernews/65732ac141edb26389c5c786cddf3e9b to your computer and use it in GitHub Desktop.
# the following config is based on digitalocean doc
# https://www.digitalocean.com/docs/kubernetes/how-to/add-volumes/
#
# other cloud provider may have different convention, i.e., needing to create a `kubernetes_persistent_volume` before creating a claim
#
#
# tf doc: https://www.terraform.io/docs/providers/kubernetes/r/persistent_volume_claim.html
resource "kubernetes_persistent_volume_claim" "app_digitalocean_pvc" {
metadata {
# for digitalocean - name must be lowercase alphanumeric values and dashes (hyphen) only
name = "my-postgres-persistent-volume-claim"
namespace = "my-postgres-namespace"
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "1Gi" # digitalocean: changing the storage value in the resource definition after the volume has been created will have no effect
}
}
storage_class_name = "do-block-storage"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment