Create A Website - AZURE - Day15
Create website in azure cloud using terraform

Create A Website - AZURE - Day15

To create a website in Azure using Terraform, you will need to perform the following steps:

  1. Install Terraform on your local machine by following the instructions at https://www.terraform.io/downloads.html
  2. Set up an Azure account and create a service principal for Terraform to use as an authentication method. You can do this by following the instructions at https://www.terraform.io/docs/providers/azurerm/authenticating_via_service_principal.html
  3. Create a Terraform configuration file that defines the resources you want to create in Azure. For example, to create a website, you will need to create a resource group, a storage account, and a web app. You can do this by using the Azure Resource Manager (ARM) provider in Terraform.

Here is an example of a Terraform configuration file that creates a website in Azure:

# Configure the Azure Resource Manager provider
provider "azurerm" {
? subscription_id = "your-subscription-id"
? client_id? ? ? ?= "your-client-id"
? client_secret? ?= "your-client-secret"
? tenant_id? ? ? ?= "your-tenant-id"
}


# Create a resource group
resource "azurerm_resource_group" "example" {
? name? ? ?= "my-resource-group"
? location = "East US"
}


# Create a storage account
resource "azurerm_storage_account" "example" {
? name? ? ? ? ? ? ? ? ? ? ?= "mystorageaccount"
? resource_group_name? ? ? = azurerm_resource_group.example.name
? location? ? ? ? ? ? ? ? ?= azurerm_resource_group.example.location
? account_tier? ? ? ? ? ? ?= "Standard"
? account_replication_type = "LRS"
}


# Create a web app
resource "azurerm_app_service" "example" {
? name? ? ? ? ? ? ? ? = "mywebapp"
? resource_group_name = azurerm_resource_group.example.name
? location? ? ? ? ? ? = azurerm_resource_group.example.location
? app_service_plan_id = azurerm_app_service_plan.example.id


? app_settings = {
? ? "WEBSITE_RUN_FROM_PACKAGE" = "https://${azurerm_storage_account.example.name}.blob.core.windows.net/packages/mywebsite.zip"
? }
}


# Create an App Service plan
resource "azurerm_app_service_plan" "example" {
? name? ? ? ? ? ? ? ? = "myappserviceplan"
? resource_group_name = azurerm_resource_group.example.name
? location? ? ? ? ? ? = azurerm_resource_group.example.location
? sku {
? ? tier = "Standard"
? ? size = "S1"
? }
}        

4. Run the terraform init command to initialize the working directory and download the Azure provider plugin.

5. Run the terraform plan command to see a preview of the resources that will be created.

6. Run the terraform apply command to create the resources in Azure.

You can then visit the URL of the web app to access your website.

I hope this helps! Let me know if you have any questions.

We post regularly on social media about the free live hands-on learning opportunities, Opensource Proof Of Concepts, Solutions Architecture Reviews, Automation live hands-on, Live career Q&A Sessions, and promotions. Do follow and support us via the following links. ??

LinkedIn?|?Twitter?|??LinkedIn Group??|?YouTube

Want to Join Every week Free Terraform Cloud Automation Handson Training?

No alt text provided for this image

Feel free to add me in your LinkedIn connection and send me message for more steps.

"Aiming to create 1000 leaders every year with more confidence"

Are you looking for some life confidence. Feel free to reach me out?Vijayabalan Balakrishnan?not just learning.

Rajesh Kr Mehra

76K+ Followers | 14K+ Newsletter Subscribers | Resume Tips & Career Growth | Developer @DXC Technology | Brand Partnerships Open ??

2 年

cfbr

回复
Bhargav Sandepalli

DevOps Engineer, Building Next-Gen Infra.

2 年

Hi Vijay, Can you share the recordings of Terraform Class -3, I have shared my details in your DM. Thanks in advance.

回复

要查看或添加评论,请登录

Vijayabalan Balakrishnan的更多文章

  • Cancer Free Champs Foundation

    Cancer Free Champs Foundation

    ????I'm bursting with happiness and a sense of accomplishment. From a very early age, I had big dreams of making a…

    63 条评论
  • I am Desktop Engineer. How to Switch Cloud Engineer ?

    I am Desktop Engineer. How to Switch Cloud Engineer ?

    To make a switch from one job to another, you need to have the skill requisites needed for that new job. Since you are…

    6 条评论
  • Is focus the key to success ?

    Is focus the key to success ?

    Being successful at anything takes more intentional efforts than just luck; which is why you must intentionally create…

    12 条评论
  • IT Employee's Confusions

    IT Employee's Confusions

    Based on my experience and interaction with my colleagues, I would like to mention my views: People in any field fear…

    11 条评论
  • Stay humble when you are successful

    Stay humble when you are successful

    With time every human evolve, every person grow, every individual aspire and achieve something. It doesn't matter how…

    8 条评论
  • How important is it to have a Mentor?

    How important is it to have a Mentor?

    I know a few people who are not willing to work hard. Hard work in itself is not the problem.

    38 条评论
  • Is DevOps going to disappear because of AI ?

    Is DevOps going to disappear because of AI ?

    DevOps is a set of practices that help organizations develop, deploy, and manage software more efficiently. This…

    4 条评论
  • How to overcome the fear of coding?

    How to overcome the fear of coding?

    Overcoming the fear of coding can take time and effort, but there are some strategies that can help. Here are a few…

    6 条评论
  • Degree in Distance Education - Day 3

    Degree in Distance Education - Day 3

    1st point The problem a candidate makes is not highlighting his skills in resume and most of the initial screening for…

    5 条评论
  • How can we face defeat with courage?

    How can we face defeat with courage?

    You need to be self-motivated all the time. Nobody understands your dreams better than you.

    10 条评论

社区洞察

其他会员也浏览了