'I want to create 2 azure vm and install jenkins and Sonarqube using terraform does anyone know how to do that?

I have to deploy dot net core and React application on those one of those virtual machines



Solution 1:[1]

You can create the infrastructure using Terraform.
Use Ansible to configure Jenkins and Sonarqube to have a cleaner approach

refer below Code Snippet

  provisioner "remote-exec" {
    inline = ["sudo apt -y install python"]

    connection {
      type        = "ssh"
      user        = "ubuntu"
      private_key = "${file(var.ssh_key_private)}"
    }
  }

  provisioner "local-exec" {
    command = "ansible-playbook -u ubuntu -i '${self.public_ip},' --private-key ${var.ssh_key_private} provision.yml" 
  }

Second Way would be to create a shell script and execute it using Terraform

 provisioner "local-exec" {
    command = "/bin/bash provision.sh"
 }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ajinkya