Alright, glad to have you all back with me. Today we will be taking a look at how to create a simple webapp service in Azure using Terraform.
as stated in our previous class, we need to first write the Terraform block for every deployment, which is where the required provider is stated.
Terraform and required provider block

.
The provider block instructs Terraform on how to connect to Azure in order to establish resources such as the Web App, App Service Plan, and Resource Group during an Azure web app deployment.
provider block

.
Terraform is informed by this block:
"In the westus2 region, create a Resource Group in Azure named terraform-lab-rg."
In essence, a Resource Group is a folder or container that houses Azure resources
Resource group block

.
An Azure App Service Plan defines
how much compute you get, what OS you run, how much it costs
Think of it as the server farm your web app runs on.
Service plan block

'
Azure requires web app names to be globally unique (across all Azure customers).
This resource generates a random 6-character lowercase string and avoids name collisions. Example of output: k9f3qa
Random string

.
What this creates: An Azure App Service (Linux) — basically:
Final name example: terraform-lab-webapp-k9f3qa
Main webapp block

.
What this does: After terraform apply, Terraform will print:
web_app_url = terraform-lab-webapp-k9f3qa.azurewebsites.net
That’s the public URL of your web app.
Web output block

.
.

Top comments (1)
Welldone Clinton