In this lab, we will deploy a MySQL database instance.
In the previous lab exercise, we deployed a Web application. It’s almost unheard of to find a Web application that doesn’t have a database backend. MySQL and MariaDB are among the most common types of databases for Web apps being robust and open source.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Log into the Azure Portal and set up the Command Line Interface (CLI) for use.
- Open the CLI.
- Select Bash at the prompt.
- Click Show Advanced Settings. Both the Resource Group and Storage Account should be pre-selected with the lab generated values.
- In the File share section, choose the Create new radio button and enter console.
- Click the Attach Storage button.
- Once the command prompt is initialized, proceed to Task 2.
- Deploy a MySQL Database Instance
To complete this exercise, please make sure you’ve completed Task 1 before completing the following:
- Use the code block found in the Additional Information and Resources section to create a
lab.tf
file and upload it to the CLI. - In the (resource
"azurerm_storage_account" "lab"
) declaration, you’ll need to edit theresource_group_name
value with the name generated by the lab. Additionally, you’ll need to enter a unique name for the storage account that will be used for the file share. The"provider"
statement has been added to the code, so you won’t need to create amain.tf
file to deploy the storage account. - Once the file has been uploaded, run
terraform init
. - Run
terraform plan
and review the output to confirm that Terraform will create the desired resource. Green plus signs will indicate the resources that need to be added. - Run
terraform apply
, answering yes to the prompt to continue. - Once Terraform completes the deployment, check the Azure Portal to confirm.
You’re done! Go ahead and shut down the lab.
- Use the code block found in the Additional Information and Resources section to create a