Skip to content

alimusdu/cloudformazure

 
 

Repository files navigation

                                              Hello! I'm Burak.

About me

  • 💼 Senior DevOps Engineer at Intertech
  • ❤️ I love writing automation scripts and building infrastructures
  • 💬 For contacting me Linkedin

Project Description

This project is used to create a virtual machine, install Prometheus with Grafana on Azure Cloud and monitor current temperature in Tallinn/Estonia.

Pre-requisites

Terraform installed on your system
Az Cli installed on your system

Nice to have

It's nice to have an azure storage for storing tfstate if you would like to store it first of all you should create Azure Storage Account Azure Storage If you don't want to use azure storage you can delete or comment out backend tf.

  • An accessible Azure bucket to store Terraform state (specified in backend.tf).

Variables

  • A Terraform variables file customized for assessment environment, for example:

    • resource_group_name = "my_terraform_rg"
    • resource_group_location = "West Europe"
    • virtual_network_name = "vnetprod019"
    • subnet_name = "subnet019"
    • public_ip_name = "publicip019"
    • network_security_group_name = "nsgprod019"
    • network_interface_name = "nicprod019"
    • linux_virtual_machine_name = "linuxvm019"

Building the Terraform-based infrastructure

First off all you need login azure portal via azure cli
"az login" initialize terraform Azure modules
"terraform init"
plan and save the infra changes into tfplan file
"terraform plan -out tfplan"
apply the plan
"terraform apply tfplan"
delete the infra
"terraform destroy"

Acces Temperature in Grafana

You need to get Public IP of VM from terraform apply output (there is an outputs.tf file on repo)
"terraform output vm_ip"

From web browser VM IP:3000 login Grafana with default password (admin:admin) you can change the password after login. There is a predefined Dashboard called as Weather in Estonia(Tallinn) (weatherestonia.json) Weather is currently based

Github Actions

For automate the flow, github actions is used. There are four workflows for terraform plan and apply.
Terraform Plan runs when a PR created to master branch
Terraform Apply runs when a PR merged to master or a commit pushed.
Terreform Destroy Destroys whole infrastructure with manual trigger
Deploy Weather Project Deploys python code and copies custom dashboard to grafana with manual trigger

Resources

Name Type
Terraform Registry resource
terraform templates resource
weather api resource
prometheus and grana docker-compose repo resource

About

cloudformazure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 88.8%
  • Python 11.2%