Giter Club home page Giter Club logo

udacity-azure-devops-project1's Introduction

Azure Infrastructure Operations Project: Deploying a scalable IaaS Web Server in Azure

Submitter: Quyet Nguyen

Introduction

For this project, you will write a Packer template and a Terraform template to deploy a customizable, scalable web server in 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

2.1. ✔️ Navigate to your repository

2.2. ✔️ Authenticate to Azure the open Azure portal Bash Cloud Shell to upload project1-tagging-policy.json

2.3. ✔️ Deploy a policy

Create the Policy Definition:

az policy definition create --name 'tagging-policy' --display-name 'deny-creation-untagged-resources' --description 'This policy ensures all indexed resources in your subscription have tags and deny deployment if they do not' --rules ./project1-tagging-policy.json  --mode All

2.4. ✔️ Create the Policy Assignment

az policy assignment create --name 'tagging-policy' --display-name 'deny-creation-untagged-resources' --policy tagging-policy

2.5. ✔️ List the policy assignments to verify

az policy assignment list

alt text

2.6. ✔️ Create a Server Image with Packer

✔️ Open Azure portal Bash Cloud Shell then upload server.json

✔️ Create a Server Image using below packer command

packer build server.json

alt text

✔️ View Images

az image list

alt text

2.7. ✔️ Create the infrastructure with Terraform Template

Go to folder cd project1-IaC/

Our Terraform template will allow us to reliably create, update, and destroy our infrastructure

Customize vars.tf

Variables from vars.tf are called from mains.tf, for example the variable prefix is called as:

${var.prefix}

In vars.tf, the description and value is assigned in the following manner:

variable "prefix" {
  description = "The prefix which should be used for all resources in this example"
  default = "quyetnn-project1"
}

See all variable in vars.tf

2.8. ✔️ Deploy infrastructure

  1. Initializing Working Directories
terraform init
  1. Create infrastructure plan
terraform plan -out solution.plan

alt text

  1. Deploy the infrastructure plan
terraform apply "solution.plan"

alt text

  1. View infrastructure
terraform show

alt text

Azure Portal Azuredevops resource created by terraform ✔️ View in Azure Portal alt text

  1. Destroy infrastructure (when completed) using clean_resources.sh to delete all resources except Azuredevops resource group
terraform state list | while read line
do 
if [[ $line == azurerm_resource_group* ]]; then
echo $line " is a resource group and will not be deleted!"
else
echo "deleting: " $line
terraform destroy -target $line -auto-approve
fi
done

Using terraform state list command to skip destroying azurerm_resource_group which lab user can not delete it.

alt text

  1. Delete images(when completed)
az image delete -g Azuredevops -n MyPackerImage

✔️ Output

We will show all of logs for the command below

az policy assignment list
az image list
terraform plan -out solution.plan
terraform apply "solution.plan"
terraform show

udacity-azure-devops-project1's People

Contributors

quyetnn1102 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.