Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Kanzaveli committed Jul 25, 2023
1 parent 6806970 commit 4d3ba16
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 169 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@

<!-- TESTME: require test -->
4. [Simple Terraform lab](https://github.com/Joska99/joska/blob/main/terraform/tf-ex1)
<p align="center">
<img src="https://github.com/Joska99/joska/blob/main/terraform/tf-ex1/diagram.drawio.svg">

</p>

## Terraform-Modules

<!-- TESTME: require test -->
1. [Azure AKS with LogAnalytics and ACR module](https://github.com/Joska99/joska/blob/main/terraform/modules/tf-aks-la)

<!-- TESTME: require test -->
2. [Azure Linux VM module](https://github.com/Joska99/joska/blob/main/terraform/modules/tf-linux-vm)

<!-- TESTME: require test -->
3. [Azure WAN Hub module](https://github.com/Joska99/joska/blob/main/terraform/modules/tf-wan-hub)
5 changes: 2 additions & 3 deletions terraform/tf-ex1/IaC/instances.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
############################################################################################################################################################################################################################################
######################################################################################################################
### INSTANCES
############################################################################################################################################################################################################################################

######################################################################################################################
######################################################################################################################
### VMS FOR PUBLIC SUBNET AND ANOTHER
######################################################################################################################
Expand Down
15 changes: 12 additions & 3 deletions terraform/tf-ex1/IaC/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ terraform {
version = "3.45.0"
}
}
#########################################
# BACKEND FOR .TFSTATE AND LINUXKEY.PEM
#########################################
# backend "azurerm" {
# resource_group_name = var.rg_name
# storage_account_name = var.sa_name
# container_name = var.con_name
# key = "terraform.tfstate"
# }
}

## config provider
Expand All @@ -25,9 +34,9 @@ resource "azurerm_postgresql_server" "serv" {
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name

sku_name = "B_Gen5_2"
storage_mb = 5120
backup_retention_days = 7
sku_name = "B_Gen5_2"
storage_mb = 5120
backup_retention_days = 7


administrator_login = var.login-passwd-for-vm[0]
Expand Down
28 changes: 15 additions & 13 deletions terraform/tf-ex1/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Simple Terraform lab</h1>
<h1>Terraform lab, simple network</h1>
<p align="center">
<img src="https://github.com/Joska99/joska/blob/main/terraform/tf-ex1/diagram.drawio.svg">
</p>
Expand All @@ -11,6 +11,9 @@ az login
```
2. Move to "IaC" folder and init Terraform:
```bash
cd IaC
```
```bash
terraform init
```
3. Check terraform module and output plan:
Expand All @@ -22,39 +25,38 @@ terraform plan -out main.tfplan
terraform apply main.tfplan
```

<h1> Create Storage Account in azure by CLI to store .tfstate</h1>
<h1> Create Storage Account in Azure by CLI to store .tfstate</h1>

1. Create variables
```bash
RG_NAME=aks-rg
SA_NAME=sa4tstfstate
CONTAINER_NAME=tf-state
RG_NAME="resource-groups-name"
SA_NAME="storage-account-name"
CONTAINER_NAME="sa-container-name"
```

2. Create Storage Account
2. Create Storage Account, in Azure CLI run those commands:
```bash
az storage account create --resource-group $RG_NAME --name $SA_NAME --sku Standard_LRS --encryption-services blob
```
3. Create BLOB Container
3. Create BLOB Container:
```bash
az storage container create --name $CONTAINER_NAME --account-name $SA_NAME
```
4. Get key
4. Get key:
```bash
ACCOUNT_KEY=$(az storage account keys list --resource-group aks-rg --account-name $SA_NAME --query '[0].value' -o tsv)
```
5. Add it to ARM
5. Add it to ARM:
```bash
$env:ARM_ACCESS_KEY=$ACCOUNT_KEY
```
6. Init changes and say yes
6. Init changes and say yes :
```bash
terraform init
```

<h1>To delete</h1>

1. Run this command to destroy and add yes
1. Run this command to destroy
```bash
terraform destroy
terraform destroy --auto-approve
```
Loading

0 comments on commit 4d3ba16

Please sign in to comment.