Challenge 05 - Infrastructure as Code (IaC)

< Previous Challenge - Home - Next Challenge >

Introduction

Now that we have some code, we need an environment to deploy it to! The term Infrastructure as Code (IaC) refers to using templates (code) to repeatedly and consistently create the dev, test, prod (infrastructure) environments. We can automate the process of deploying the Azure services we need with an Azure Resource Manager (ARM) template. invoked from automation in a GitHub Actions workflow

Review the following articles:

Description

We will use GitHub Actions to automate the deployment of our Azure infrastructure. For our application, we will deploy 3 environments: dev, test and prod. Each environment will have its own Web App, however all of our environments will share a single Resource Group, App Service Plan, Application Insights instance, and Azure Container Registry.

NOTE: In real deployments, you will likely not share all of these resources.

If everything worked, we are going to call the Bicep template again, but override the environment parameter in the Bicep template supplying the value of test to override the default dev value that was used before.

You should see now have all three environments in Azure.

Success Criteria

Learning Resources

Advanced Challenges (optional)

Instead of changing the environment variable for each environment that we want to create in the deploy.yaml, you can configure the workflow to prompt the user to enter the environment name before the workflow runs - eliminating the need to hard code the environment name.

NOTE: If you are interested in learning more about Infrastructure as Code, there are multiple What the Hacks that cover it in greater depth:

< Previous Challenge - Home - Next Challenge >