Skip to content

Commit

Permalink
Adds on-destroy to change persistent volume claimpolicy to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
jlerche committed May 15, 2019
1 parent 15eeed6 commit f7f49ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions deploy/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ resource "null_resource" "get-credentials" {
KUBECONFIG = "${local.kubeconfig}"
}
}
provisioner "local-exec" {
when = "destroy"
command = <<EOS
kubectl get pvc -n tidb -o jsonpath='{.items[*].spec.volumeName}'|fmt -1 | xargs -I {} kubectl patch pv {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}'
kubectl delete namespace tidb
EOS
environment {
KUBECONFIG = "${local.kubeconfig}"
}
}
}

resource "local_file" "tidb-cluster-values" {
Expand Down

0 comments on commit f7f49ec

Please sign in to comment.