resource "aws_instance" "dskdemo" {
  ami           = "ami-0c27244ec9d87b4e8"
  instance_type = "t3.small"
  key_name      = "kp-jay-bastion-datasaker"
  vpc_security_group_ids = [aws_security_group.dskdemo-allow-security.id]
  availability_zone      = "ap-northeast-2c"
  subnet_id     = var.Public_Subnet_ID_3
  
  root_block_device {
    delete_on_termination = true
    volume_size = 30
  }

  tags = {
    Name = "dskdemo"
  }
}

resource "aws_ebs_volume" "dskdemo_ebs" {
  availability_zone = aws_instance.dskdemo.availability_zone
  size              = 100

  tags = {
    Name = "dskdemo-ebs"
  }
}

resource "aws_volume_attachment" "dskdemo_ebs_attach" {
  device_name = "/dev/xvdf"
  volume_id   = aws_ebs_volume.dskdemo_ebs.id
  instance_id = aws_instance.dskdemo.id
}
