resource "aws_instance" "superset" {
  ami           = "ami-0409b7ddbc59e3222"
  instance_type = "t3.small"
  key_name      = "kp-jay-bastion-datasaker"
  vpc_security_group_ids = [aws_security_group.superset-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 = "superset"
  }
}

resource "aws_eip" "superset_eip" {
  vpc = true
  instance = aws_instance.superset.id

  tags = {
    Name = "superset-eip"
  }
}

resource "aws_ebs_volume" "superset_ebs" {
  availability_zone = aws_instance.superset.availability_zone
  size              = 100

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

resource "aws_volume_attachment" "superset_ebs_attach" {
  device_name = "/dev/xvdf"
  volume_id   = aws_ebs_volume.superset_ebs.id
  instance_id = aws_instance.superset.id
}
