For this project, you will write a Packer template and a Terraform template to deploy a customizable, scalable web server in Azure.
-
Clone this repository
-
Create your infrastructure as code
-
Update this README to reflect how someone would use your code.
- Create an Azure Account
- Install the Azure command line interface
- Install Packer
- Install Terraform
Prior to running through the steps, open a Terminal & run: az login
- Create a resource group (rg) that your Packer Image will be a part of
- You'll use this rg name & its location within the Packer server.json file Note - You'll want to make sure that when you get to the point of running the TF code that you are creating your resources in the same location as your Packer iamge
- Next, collect the Client ID, Client Secret & Subscription ID and overwrite the FIXME values in the server.json file. Note - These are considered sensitive information & should not be committed to a private/public repo.
- Re-open your terminal & run: packer build
- If all is successful you will find an image file that will be used later when we build out the rest of your infrastructure.
- Update the values found in the terraform/values.tfvars file to your needs/requirements or leave the values as is to test out the code & see what gets created. Additionally, you can review the terraform/variables.tf file which provide a description for each variable.
- Re-open your terminal. (Ensure you are in the directory where the tf code is present)
- run: terraform init
- run: terraform validate
- run: terraform apply -var-file=values.tfvars
- If the TF validation is successful, TF will prompt you asking if you want to proceed. Type "yes" & [enter]
- Allow TF to execute the code
- When TF is finished you should see an "Apply complete!" message
So the TF code ran successful! WooHoo! Now its time to access your Azure portal via a browswer & check out the udacity--resources resource group. You should see:
- Network Security Group (NSG) & NGS1 that created specific rules
- A load balancer
- A Public IP for the LB
- A Network & Subnets
- A NIC for the VM(s)
- A VMSS (Virutal Machine Scal Set)
Note - Don't forget to run: terraform destroy -var-file=values.tfvars after you are done reviewing the items provisioned for you.