diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc08fd4 Binary files /dev/null and b/README.md differ diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..df859d2 --- /dev/null +++ b/main.tf @@ -0,0 +1,8 @@ +resource "ncloud_block_storage" "block_storage" { + size = var.size + server_instance_no = var.server_instance_no + name = var.name + description = var.description + disk_detail_type = var.disk_detail_type + stop_instance_before_detaching = var.stop_instance_before_detaching +} \ No newline at end of file diff --git a/output.tf b/output.tf new file mode 100644 index 0000000..4db5e12 --- /dev/null +++ b/output.tf @@ -0,0 +1,39 @@ +output "id" { + description = "The ID of Block storage instance." + value = ncloud_block_storage.block_storage.id +} + +output "block_storage_no" { + description = "The ID of Block storage instance. (It is the same result as id)" + value = ncloud_block_storage.block_storage.block_storage_no +} + +output "server_name" { + description = "Server name." + value = ncloud_block_storage.block_storage.server_name +} + +output "type" { + description = "Block storage type code." + value = ncloud_block_storage.block_storage.type +} + +output "device_name" { + description = "Device name." + value = ncloud_block_storage.block_storage.device_name +} + +output "product_code" { + description = "Block storage product code." + value = ncloud_block_storage.block_storage.product_code +} + +output "status" { + description = "Block storage instance status code." + value = ncloud_block_storage.block_storage.status +} + +output "disk_type" { + description = "Disk type code." + value = ncloud_block_storage.block_storage.disk_type +} \ No newline at end of file diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..d3b88be --- /dev/null +++ b/variables.tf @@ -0,0 +1,37 @@ +variable "size" { + description = "(Required) The size of the block storage to create. It is automatically set when you take a snapshot." + type = string +} + +variable "server_instance_no" { + description = "(Required) When first created. (Optional) After creation. Server instance ID to which you want to assign the block storage." + type = string +} + +variable "name" { + description = "(Optional) The name to create. If omitted, Terraform will assign a random, unique name." + type = string + default = null +} + +variable "description" { + description = "(Optional) description to create." + type = string + default = null +} + +variable "disk_detail_type" { + description = "(Optional) Type of block storage disk detail to create. Default SSD. Accepted values: SSD | HDD" + type = string + default = "SSD" + validation { + condition = can(regex("^(SSD|HDD)$", var.disk_detail_type)) + error_message = "disk_detail_type must be either SSD or HDD." + } +} + +variable "stop_instance_before_detaching" { + description = "(Optional, Boolean) Set this to true to ensure that the target instance is stopped before trying to detach the block storage. It stops the instance, if it is not already stopped. > If stop_instance_before_detaching is true, server will be stopped and will not start automatically. User must start server instance manually via NCLOUD console or API." + type = bool + default = false +} \ No newline at end of file