In this lab, we deploy a blob storage container as well as a file share. File shares and blob storage are fundamental parts of any Azure environment. From archival storage for OS images to SMB file shares for on-premises servers and workstaions, Terraform allows for quick deployments of blob and file storage that can be preset to adhere to your department’s requirements and standards.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Log In to the Azure Portal and Set Up the Command Line Interface (CLI) for Use
- In the Azure portal, select the Command Line button at the top of the screen.
- Open the CLI. Here, select Bash when prompted.
- We then want to choose Show Advanced Settings.
- Choose the same location as the lab provided Resource Group.
- Leave both the Resource Group and Storage Account* as the provided defaults. If you are unable to select the existing storage account, choose to create one with a unique name.
- In the File share section, enter a name for the account (for this example, we are using Console) and click the Create Storage button. Once the command prompt completes, we can continue.
- Deploy an Azure Storage Blob Container and File Share
- 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. Use the same location as your lab-provided resource group. 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