diff options
Diffstat (limited to 'digitalocean/data_volume')
-rw-r--r-- | digitalocean/data_volume/main.tf | 16 | ||||
-rw-r--r-- | digitalocean/data_volume/outputs.tf | 3 | ||||
-rw-r--r-- | digitalocean/data_volume/providers.tf | 8 | ||||
-rw-r--r-- | digitalocean/data_volume/variables.tf | 14 |
4 files changed, 41 insertions, 0 deletions
diff --git a/digitalocean/data_volume/main.tf b/digitalocean/data_volume/main.tf new file mode 100644 index 0000000..9a58c50 --- /dev/null +++ b/digitalocean/data_volume/main.tf @@ -0,0 +1,16 @@ +resource "digitalocean_volume" "this" { + region = var.region + name = var.name + size = var.size + initial_filesystem_type = "ext4" + initial_filesystem_label = "data" + + lifecycle { + prevent_destroy = true + } +} + +resource "digitalocean_project_resources" "this" { + project = var.project_id + resources = [digitalocean_volume.this.urn] +} diff --git a/digitalocean/data_volume/outputs.tf b/digitalocean/data_volume/outputs.tf new file mode 100644 index 0000000..a0393f3 --- /dev/null +++ b/digitalocean/data_volume/outputs.tf @@ -0,0 +1,3 @@ +output "volume_id" { + value = digitalocean_volume.this.id +} diff --git a/digitalocean/data_volume/providers.tf b/digitalocean/data_volume/providers.tf new file mode 100644 index 0000000..68aba8c --- /dev/null +++ b/digitalocean/data_volume/providers.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = "~> 2.0" + } + } +} diff --git a/digitalocean/data_volume/variables.tf b/digitalocean/data_volume/variables.tf new file mode 100644 index 0000000..2d96a42 --- /dev/null +++ b/digitalocean/data_volume/variables.tf @@ -0,0 +1,14 @@ +variable "region" { + type = string +} +variable "project_id" { + type = string +} + +variable "name" { + type = string +} +variable "size" { + type = number + default = 10 +} |