< Previous Challenge - Home - Next Challenge >
The goals for this challenge include understanding:
- How to create a set of resources based on a list or count (loops), eg iteration
Challenge: Using your existing Terraform manifests, create a new resource that will create additional blob containers in your existing storage account.
- Create a string variable called
containernameprefix
and assign it a default value of your choice. - Using the count meta-argument, create a single blob container resource definition that provisions three containers, naming them prefix-[count#]
Challenge: Using your existing Terraform manifests, create a(nother) blob container, but rather than using the count operator:
- Create a variable called
containersuffixlist
of type list and have it contain the valuesa
,b
, andc
- Use the for_each operator in conjunction with a second blob container resource definition to create three more containers with the names prefix-a, prefix-b, and prefix-c.
- Use the Azure portal or Azure cli to verify new containers were added to the storage account.