From d3ff3d0dd23fdf834feb5ff4a91080d6fad50211 Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Wed, 9 Aug 2023 14:31:17 -0400 Subject: [PATCH] docs: add note about data loss on CSI volumes (#366) --- website/docs/r/csi_volume.html.markdown | 11 ++++++++++- website/docs/r/external_volume.html.markdown | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/website/docs/r/csi_volume.html.markdown b/website/docs/r/csi_volume.html.markdown index c63cfd45..e18016f3 100644 --- a/website/docs/r/csi_volume.html.markdown +++ b/website/docs/r/csi_volume.html.markdown @@ -12,10 +12,14 @@ Creates and registers a CSI volume in Nomad. This can be used to create and register CSI volumes in a Nomad cluster. -~> **Warning:** this resource will store any sensitive values placed in +~> **Warning:** This resource will store any sensitive values placed in `secrets` or `mount_options` in the Terraform's state file. Take care to [protect your state file](/docs/state/sensitive-data.html). +~> **Warning:** Destroying this resource **will result in data loss**. Use the + [`prevent_destroy`][tf_docs_prevent_destroy] directive to avoid accidental + deletions. + ## Example Usage Creating a volume: @@ -30,6 +34,10 @@ data "nomad_plugin" "ebs" { resource "nomad_csi_volume" "mysql_volume" { depends_on = [data.nomad_plugin.ebs] + lifecycle { + prevent_destroy = true + } + plugin_id = "aws-ebs0" volume_id = "mysql_volume" name = "mysql_volume" @@ -130,3 +138,4 @@ configuration options. - `delete` `(string: "10m")` - Timeout when deleting a CSI volume. [tf_docs_timeouts]: https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts +[tf_docs_prevent_destroy]: https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#prevent_destroy diff --git a/website/docs/r/external_volume.html.markdown b/website/docs/r/external_volume.html.markdown index 047d3d83..f4303084 100644 --- a/website/docs/r/external_volume.html.markdown +++ b/website/docs/r/external_volume.html.markdown @@ -15,10 +15,14 @@ Creates and registers an external volume in Nomad. This can be used to create and register external volumes in a Nomad cluster. -~> **Warning:** this resource will store any sensitive values placed in +~> **Warning:** This resource will store any sensitive values placed in `secrets` or `mount_options` in the Terraform's state file. Take care to [protect your state file](/docs/state/sensitive-data.html). +~> **Warning:** Destroying this resource **will result in data loss**. Use the + [`prevent_destroy`][tf_docs_prevent_destroy] directive to avoid accidental + deletions. + ## Example Usage Creating a volume: @@ -31,7 +35,12 @@ data "nomad_plugin" "ebs" { } resource "nomad_external_volume" "mysql_volume" { - depends_on = [data.nomad_plugin.ebs] + depends_on = [data.nomad_plugin.ebs] + + lifecycle { + prevent_destroy = true + } + type = "csi" plugin_id = "aws-ebs0" volume_id = "mysql_volume" @@ -134,3 +143,4 @@ configuration options. - `delete` `(string: "10m")` - Timeout when deleting a volume. [tf_docs_timeouts]: https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts +[tf_docs_prevent_destroy]: https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#prevent_destroy