This procedure will create a virtual machine in Azure with GitHub Enterprise Server installed automatically using TerraForm. All the needed resources will be created without interaction.
NOTE: This procedure assumes you have already azure cli and terraform installed and configured with GitHub Azure account. Also it expects there is a RSA public key. If you dont have one create one quickly with the following command:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Edit variables.tf and replace voxsteel
with your GitHub @handle. Or any other prefix, it has to be unique.
Edit main.tf and update the path with the location of your RSA key key_data = file("~/.ssh/unused/id_rsa.pub")
All image versions of GitHub Enterprise available in Azure can be found using this command:
az vm image list --all -f GitHub-Enterprise | grep '"urn":' | sort -V
Run commands:
terraform init
- The terraform init command initializes a working directory containing Terraform configuration files. This is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It is safe to run this command multiple times.terraform plan
- The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructureterraform apply
- Theterraform apply
command executes the actions proposed in a Terraform plan.
After the terraform apply
it will finish with the outputs (as example):
Outputs:
VM-PUBLIC-IP = "20.120.24.233"
VM-admin = "voxsteel"
To destroy resources (when you finish troubleshooting): terraform destroy
and confirm with yes
when ask Enter a value:
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine