Using provisioner in Terraform

In previous example insert in the end of:

resource "aws_instance" "dev_node" {
..
  provisioner "local-exec" {
    command = templatefile("linux-ssh-config.tpl", {
      hostname = self.public_ip,
      user = "ubuntu",
      identityfile = "~/.ssh/id_rsa"
    })
    interpreter = ["bash", "-c"]
  }
Also add a file linux-ssh-config.tpl with the following contents:
cat << EOF >> ~/.ssh/config

Host ${hostname}
  HostName ${hostname}
  User ${user}
  IdentityFile ${identityfile}
EOF
Run plan and apply. In the end you will have a ~/.ssh/config populated and you will be able to connect to this instance only with:
ssh x.x.x.x
or via other tools like VSCode - Remote SSH plugin