Skip to content

Commit 42985d4

Browse files
committed
fix
1 parent 746d029 commit 42985d4

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

project-1/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# My First Infrastructure as Code Project
2+
3+
This project creates a simple web application on Azure using Terraform.
4+
5+
## What This Creates
6+
- A resource group (folder for your resources)
7+
- A container instance running a simple web server
8+
- A public IP address so you can access it
9+
10+
## Prerequisites
11+
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
12+
- [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
13+
- An Azure account (free tier works!)
14+
15+
## Step-by-Step Deployment
16+
17+
### 1. Setup
18+
```bash
19+
# Clone or download this project
20+
# Open terminal in the project folder
21+
22+
# Login to Azure
23+
az login
24+
# Follow the browser prompts to login
25+
26+
27+
my-first-infrastructure/
28+
├── main.tf
29+
├── variables.tf
30+
├── terraform.tfvars
31+
└── README.md

project-1/main.tf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file tells Azure what resources to create
2+
3+
# Connect to Azure
4+
terraform {
5+
required_providers {
6+
azurerm = {
7+
source = "hashicorp/azurerm"
8+
version = "~> 3.0"
9+
}
10+
}
11+
}
12+
13+
provider "azurerm" {
14+
features {}
15+
}
16+
17+
# Create a resource group (like a folder for your resources)
18+
resource "azurerm_resource_group" "main" {
19+
name = var.resource_group_name
20+
location = var.location
21+
}
22+
23+
# Create a simple web app
24+
resource "azurerm_container_group" "webapp" {
25+
name = "my-first-webapp"
26+
location = azurerm_resource_group.main.location
27+
resource_group_name = azurerm_resource_group.main.name
28+
ip_address_type = "Public"
29+
os_type = "Linux"
30+
31+
container {
32+
name = "webapp"
33+
image = "mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine"
34+
cpu = "0.5"
35+
memory = "1.5"
36+
37+
ports {
38+
port = 80
39+
protocol = "TCP"
40+
}
41+
}
42+
}

project-1/terraform.tfvars

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Your personal settings (change these!)
2+
resource_group_name = "weekend-project-rg"
3+
location = "East US"

project-1/variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file defines the settings you can change
2+
3+
variable "resource_group_name" {
4+
description = "Name for your resource group"
5+
type = string
6+
default = ""
7+
}
8+
9+
variable "location" {
10+
description = "Azure region"
11+
type = string
12+
default = "East US"
13+
}

0 commit comments

Comments
 (0)