Skip to content

Latest commit

 

History

History
87 lines (52 loc) · 6.85 KB

File metadata and controls

87 lines (52 loc) · 6.85 KB

Challenge 1: Deploying an Azure App Service using Terraform CLI and the Azure CLI

Astronaut Badger

Watch our introduction video to learn all about #TerraformOnAzure coding challenge!

Description

In this first challenge, you will have to deploy our sample ASP.NET Core application to Azure App Service. You will have to provision all required Azure resources using HashiCorp's Terraform.

We will be running the web application in frontend-only mode. This means that you will be hosting the ASP.NET Core application without a database. As a result, only the home page will be operational. In the following coding challenges you will fix this. Check the paragraph on running the application in frontend-only mode below on how to achieve this.

There are multiple ways to deploy a web application to Azure App Service. In this coding challenge you will use the Azure CLI to configure the Azure App Service Deployment Center continuous deployment. This will configure the App Service to pull the sample application code from a GitHub repo.

Make sure to first fork the sample application to your GitHub account, after which you can then configure continuous deployment from GitHub on your App Service.

TIP: the GitHub deployment setting for an App Service cannot be configured through Terraform. You will need to use another automated way to configure this.

Success criteria 🏆

To successfully complete this challenge, you will

  • Use the Terraform CLI to provision the Azure resources to host 1) an Azure SQL database, 2) a MongoDB database on Azure Container Instances.
  • Use the Azure CLI to deploy the sample application from a GitHub repo, using Azure App Service Deployment Center Continuous Deployment (not using GitHub Actions at this time!).

How to submit your solution?

Within 24 hours of making the coding challenge public, submit your solution as a custom ISSUE to this GitHub repository.

  1. Create your own Github repo with your solution for that challenge.
  2. Create a new Challenge Solution Submission issue in our repo for each challenge and fill all the details.
  3. Submit the issue.

Prerequisites

  • An Azure subscription, where you have permissions to create resource groups. You can get an Azure free account or send us a DM us on Twitter and we'll provide you with an Azure Pass.
  • A GitHub account, allowing you to create a custom issue to submit your solution.
  • Fork the sample application to your GitHub account.

How to get started with Terraform on Azure

There are different ways to get started with Terraform. The easiest is to use the Azure Cloud shell. Alternatively, you can install Terraform on your local machine.

Running the application in frontend mode

To run the application in frontend mode, you need to configure a number of application settings. These need to be specified on the Azure App Service.

Setting Value
WEBSITE_NODE_DEFAULT_VERSION 10.15.2
ApiUrl
ApiUrlShoppingCart
MongoConnectionString
SqlConnectionString
productImagesUrl https://raw.githubusercontent.com/microsoft/TailwindTraders-Backend/master/Deploy/tailwindtraders-images/product-detail
Personalizer__ApiKey
Personalizer__Endpoint

Resources/Tools Used 🚀

A simple App Service and Terraform script should do it for this challenge. Here's a tutorial on how to get started.

More Resources

Questions? Comments? 🙋‍♀️

If you have any questions about the challenges, feel free to open an ISSUE HERE.

Make sure to mention which challenge is problematic. We'll get back to you soon!

I don't have an Azure subscription! 🆘

If you don't have an Azure subscription yet, you can DM us on Twitter and we'll provide you with a 30-day Azure subscription! Alternatively, you can also sign up for an Azure free account.