Skip to content

jmahen/terraform-azure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here are the commands used

Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

az login

az account list

az account set --subscription ""

#Service Principal

az ad sp create-for-rbac -n tfadminc91826c0 --role="Contributor" --scopes="/subscriptions/"

Set ENV Values for Azure Authentication

$Env:ARM_CLIENT_ID = "" $Env:ARM_CLIENT_SECRET = "" $Env:ARM_SUBSCRIPTION_ID = "" $Env:ARM_TENANT_ID = "" $Env:ARM_ACCESS_KEY = "" # Storage AC Key

------------------------------------------------

New-Item -Path "." -Name "learn-terraform-azure" -ItemType "directory"

CD learn-terraform-azure

Create main.tf

terraform init

terraform fmt

terraform validate

terraform plan

terraform apply

terraform apply -auto-approve

terraform apply -var-file prd-vaiables.tfvars -auto-approve

terraform apply -replace="azurerm_virtual_network.vnet2"

terraform show

terraform state list

terraform destroy

terraform import azurerm_windows_web_app.mjtfdemoapp /subscriptions//resourceGroups/terraform-rg/providers/Microsoft.Web/sites/mjtfdemoapp

terraform import azurerm_service_plan.app_plan /subscriptions//resourceGroups/terraform-rg/providers/Microsoft.Web/serverfarms/app-service-plan-free

terraform init -reconfigure

terraform init -migrate-state

Any chnage in backend requires terraform init

Git Commands

-----Initial Checkin git init git add . git commit -m "Terraform azure example" git status git remote add origin <your-giturl.git> git push -u origin master

------Add New files

git pull

git status git add . git commit -m "Changes from local" git push -u origin master

About

terraform-azure-sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages