Skip to content

Commit

Permalink
docs: add note about data loss on CSI volumes (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgfa29 authored Aug 9, 2023
1 parent 63e446b commit d3ff3d0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
11 changes: 10 additions & 1 deletion website/docs/r/csi_volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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
14 changes: 12 additions & 2 deletions website/docs/r/external_volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit d3ff3d0

Please sign in to comment.