Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GTRekter committed Jul 12, 2024
1 parent 2ee80ab commit 7d7ea57
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
Binary file added README.md
Binary file not shown.
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -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
}
39 changes: 39 additions & 0 deletions output.tf
Original file line number Diff line number Diff line change
@@ -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
}
37 changes: 37 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 7d7ea57

Please sign in to comment.