resource "ncloud_login_key" "dsk-key" { // 인증키 설정
  key_name = "dsk-key"
}

resource "local_file" "ssh_key" {
  filename = "${ncloud_login_key.dsk-key.key_name}.pem"
  content = ncloud_login_key.dsk-key.private_key
}

resource "ncloud_server" "exem-dsk-bastion" {
  subnet_no = ncloud_subnet.exem-dsk-subnet-public.id
  name = "bastion"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}

resource "ncloud_server" "exem-dsk-master-1" {
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
  name = "master-1"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}

resource "ncloud_server" "exem-dsk-master-2" {
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
  name = "master-2"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}

resource "ncloud_server" "exem-dsk-master-3" {
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
  name = "master-3"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}

resource "ncloud_server" "exem-dsk-worker-1" {
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
  name = "worker-1"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}

resource "ncloud_server" "exem-dsk-worker-2" {
  subnet_no = ncloud_subnet.exem-dsk-subnet.id
  name = "worker-2"
  #server_image_product_code = "SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050"
  member_server_image_no = 20109481
  server_product_code = "SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002"
  login_key_name = ncloud_login_key.dsk-key.key_name
}