📌 Azure Monitoring with Linux Web App
Published: 2024-01-06 08:00:00

## I. Description 📝

This scenario addresses the monitoring services you can use and describes a dataflow model for use with multiple data sources. When it comes to monitoring, many tools and services work with Azure deployments. In this scenario, we choose readily available services precisely because they are easy to consume.

## II. Architecture components 🏛️

Let's break down each resource:

- azurerm_resource_group: This resource creates a Resource Group named "rg-main". Resource Groups in Azure are a fundamental entity used to group related resources for an application, making management, deployment, and monitoring easier.
- azurerm_virtual_network: Defines a Virtual Network (VNet) named "vnet-kube". VNets enable Azure resources to securely communicate with each other, the internet, and on-premises networks.
- azurerm_subnet: There are three subnet resources defined - subnet_webapp, subnet_db, and subnet_monitoring. Each subnet is a range of IP addresses in the VNet. They enable you to segment the network, improving security and performance. The subnets are named accordingly based on their intended use (for web apps, databases, and monitoring).
- azurerm_public_ip: Creates a public IP address named "pip-kubernetes". Public IP addresses allow Azure resources to communicate with the internet and other Azure services.
- azurerm_mariadb_server: This resource sets up a MariaDB server, which is a fully managed database service. The configuration includes version, storage size, administrator login details, and other settings.
- azurerm_mariadb_database: Defines a MariaDB database named "mariadb_database" within the above MariaDB server. It specifies the character set and collation for the database.
- azurerm_application_insights: Creates an Application Insights resource for monitoring the performance and usage of your apps. It's essential for diagnostics and telemetry.
- azurerm_log_analytics_workspace: Sets up a Log Analytics workspace named "acctest-01". This workspace is used for managing and analyzing data logs collected by Azure services.
- azurerm_linux_web_app: Creates a Linux-based web app service. It's part of the Azure App Service platform, which is used for hosting web applications.
- azurerm_service_plan: Defines a service plan named "serviceplan", which specifies the hosting tier for the Azure web app. Service plans determine the location, features, cost, and compute resources associated with your web app.
- azurerm_storage_account: Sets up a storage account named "storageaccountname". Azure Storage Accounts provide scalable cloud storage for data objects, file systems, messaging stores, and NoSQL stores.
- azurerm_monitor_action_group: Creates an action group for Azure Monitor, which is used to define a set of actions to be executed when an alert is triggered.
- azurerm_portal_dashboard: Establishes a custom dashboard in the Azure Portal named "my-dashboard". Dashboards are used for monitoring resources and data visualization.
- azurerm_monitor_diagnostic_setting: Configures diagnostic settings for the MariaDB server. It specifies how metrics and logs are collected and stored, including integration with Log Analytics and a storage account.

## III. Variables

In Terraform, a variable is a way to store and reuse values throughout your Terraform code. Variables are defined using the variable block and can be used to parameterize your Terraform code, making it more flexible and reusable.

![Variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49p6idxni9v6xcpv0jm4.png)

## IV. Readme
The readme file refers to a text file that provides information about the architecture, its features, requirements, installation instructions, and usage instructions.

![Readme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xpa3rr8uasqtmrxjhg3v.png)

- The readme file will be displayed on the templates description when you publish your architecture.
- The readme file will be pushed in git when you are using git as your repository.
- The readme file will be cloned along with the design of your architecture.

## V. How to use the architecture
To use this architecture, clone it within your project and change the following components:

Change the configuration of the cloud provider. In order to use the architecture you need to have a kubernetes cluster in place and change the resource group and name of the kubernetes cluster inside the configuration. Then change the variables:

![How to use the architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcd456pt8c5h7lghm5gd.png)

## VI. CI/CD
😍 You also have a complete CI/CD engine that allows you to check the security posture, estimate the cost of the infrastructure before deploying it and make sure that it respects your requirements.

![CI/CD](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0f0br19afpsk1cjqep61.png)

👉 You can use the template here: https://app.brainboard.co