Create the App Service
Now that we have defined where to store our state files and are setup to create Azure resources, we are able to provision infrastructure with Terraform in the main.tf
. Our objective for this lab is to deploy an App Service.
App Service resource block¶
An App Service (docs) is a fully managed platform for building and running web apps in Azure. It is a core PaaS offering that is widely used across Azure customers. Below is the Terraform starter code snippet for creating an App Service resource using the Azure resource manager provider.
resource "azurerm_app_service" "dojo_app_service" {
arguments
}
resource
is a block keyword telling Terraform that we want to create a resourceazurerm_app_service
is one of the resource templates made available by theazurerm
providerdojo_app_service
is a label to better identify this resource throughout our Terraform.*- We will define various key-value pair arguments throughout the lab using Terraform's documentation.
Feel free to replace
dojo
in any of the resource *labels** with your team's name throughout the lab.
Check the documentation¶
Let's use Terraform's docs to complete the setup for App Services. Terraform has great documentation for available resources with each cloud provider. Remember that we are using the azurerm
provider, so we will look at the App Service resource within that registry.
Time to read the docs. Try googling or visiting Terraform's registry (or go here if you're lazy!)
As we find out, creating the azurerm_app_service
resource requires two additional resource definitions: the azurerm_resource_group
and azurerm_app_service_plan
resource. Before we finish the App Service definition, let's define the other dependent Azure resources.