Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/genzo1977/deploy-azure-spot-vm-nginx-terraform
https://github.com/genzo1977/deploy-azure-spot-vm-nginx-terraform
Last synced: about 8 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/genzo1977/deploy-azure-spot-vm-nginx-terraform
- Owner: genzo1977
- Created: 2024-12-18T00:47:33.000Z (24 days ago)
- Default Branch: main
- Last Pushed: 2024-12-30T01:02:56.000Z (12 days ago)
- Last Synced: 2024-12-30T01:31:23.147Z (12 days ago)
- Language: HCL
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploy an environment with Terraform on Azure running a spot RedHat VM and NGINX
Does what it says on the tin. All you need to do is enter your subscription_id in the first provider block.### Prerequisites:
1. Install Terraform on the local machine`choco install -y terraform`
2. Install Azure CLI
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli3. Authenticate via Azure CLI
4. Clone this repo:
`git clone https://github.com/genzo1977/deploy-azure-spot-vm-nginx-terraform.git`
5. Change directory:
`C:\ProgramFiles\terraform\deploy-azure-spot-vm-nginx-terraform\`
6. Log into Azure:
`az login`
7. Enter a valid Azure subscription id in the `provider` block in `main.tf`.
### Steps to Initialize and Apply:
1. Run `terraform init` to initialize the backend.
2. Run `terraform plan` to see what you are about to apply
3. Run `terraform apply` to apply the infrastructure.
4. Run `terraform output private_key` if you want to connect to the server via ssh
5. Clean up once you are done - `terraform destroy`### Test
Get the VM public IP address and enter it in the address bar of the browser as `http://`
If the NGINX home page is not showing, check the internal firewall`firewall-cmd --state`
If it's running, ensure HTTP (port 80) is allowed. If not, add it:
`firewall-cmd --zone=public --add-service=http --permanent`
`firewall-cmd --reload`
Now it should all work.
4. Clean up once you are done - `terraform destroy`