-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make postgresql on persistent storage
make data survice even terraform destroy (volume is detached from VM lifecycle) data is not migrated, when volume already populated
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
variable "name" { | ||
type = string | ||
description = "Name of network volume" | ||
} | ||
variable "region" { | ||
type = string | ||
default = "fra1" | ||
description = "Region of network volume. Must match droplet" | ||
} | ||
variable "size" { | ||
default = 1 | ||
type = number | ||
description = "Volume size in GiB" | ||
} | ||
|
||
variable "fs_label" { | ||
default = "example" | ||
type = string | ||
description = "Filesystem label for volume, useful for mounting" | ||
|
||
validation { | ||
condition = length(var.fs_label) <= 16 | ||
error_message = "Max 16 characters for FS label for ext4 filesystem" | ||
} | ||
} | ||
resource "digitalocean_volume" "volume" { | ||
name = var.name | ||
region = var.region | ||
size = var.size | ||
initial_filesystem_type = "ext4" | ||
initial_filesystem_label = var.fs_label | ||
} | ||
|
||
output "volume_id" { | ||
value = digitalocean_volume.volume.id | ||
} |