AaronWard / mlops-practice

Practice repo for MLOps on Azure using terraform.
1 stars 0 forks source link

mlops-practice

Practice repo for MLOps on Azure using terraform.

Terraform

Terraform Concepts:

Basic commands:

Resources:

resource "<type>: "<name>" {
    ...
}
resource "azurerm_resource_group" "rg" {
  name      = "${var.resource_group_name}_${var.environment}"
  location  = var.location
}

resource "azurerm_virtual_network" "vnet" {
  name                = "vnet"
  location            = var.location
  address_space       = ["10.0.0.0/16"]
  resource_group_name = azurerm_resource_group.rg.name
  dns_servers         = []
}

variables can be cross refences by resource_type.resource_name.key pr resource_type.resource_name.id (some use IDs)

Data blocks:

If a resource already exists in the statefile, or if you want to reference that exists but your didn't create you can do that in a data block.

Providers:

Helper functions the terraform uses to interact with external sercices/resouces. IE: local docker server, Cloud provider (Azure).

provider "aws" {
  alias  = "west"
  region = "us-west-2"
}

Variables: Variables are common values that can be declared and referenced elsewhere

variable "location" { }

terraform.tfvars: terraform.tfvars holds the common values, is referrenced in variables.tf

location = "centralus"

Statefile:

Terraform Modules:

module "name" {
  source = "./some_path"
  servers = 5
}

Terraform graph:

Terraform Import:


How-To's:

Azure CLI

Github Setup

Terraform Docs


Links


Deploying Azure Functions

zip -r test_app.zip ./test_app/
az functionapp deployment source config-zip   -g aw-rg-2-dev   -n awazfunctionapp-dev   --src ./test_app.zip

https://learn.microsoft.com/en-us/answers/questions/1401268/azure-functions-with-fastapi-and-openai-streaming