/WebAzure

This repo contains the starter materials for projects from the Udacity Azure Cloud DevOps Nanodegree Program.

Primary LanguageHCLOtherNOASSERTION

Azure Infrastructure Operations Project: Deploying a scalable IaaS web server in Azure

Introduction

For this project, Packer is used to build an image and Terraform is used to deploy infrastructure as code on Azure.

Getting Started

  1. Clone this repository

  2. Create your infrastructure as code

  3. Update this README to reflect how someone would use your code.

Dependencies

  1. Create an Azure Account
  2. Install the Azure command line interface
  3. Install Packer
  4. Install Terraform

Instructions

  1. Log in your Azure account
az login
  1. Deploy azure policy
  • Create a policy definition
az policy definition create --name tagging-policy --rules azurepolicy.rules.json --params azurePolicy.parm.json
  • Create a policy assignment
az policy assignment create --name tagging-policy --policy tagging-policy --params "{ \"tagName\": 
    { \"value\": \"YourTag\"  } }"
  • Check whether your policy assignment is successful
az policy assignment list
  1. Run Packer
packer build
  1. Customize You can customize several things in variables.tf Customize default and description as you like.
variable "prefix" 
{
     description = "The prefix which should be used for all resources in this example"
     type = string
     default = "WebAzureProject-Terraform"
}
  1. Run Terraform
terraform init
terraform apply "solution"

Output

Please check the following docs:

  • Sample Successful Azure Policy assignment is azPolicyOutput1.jpg and azPolicyOutput2.jpg
  • Sample successful terraform apply is terraform apply output