Skip to content

Instantly share code, notes, and snippets.

View PradeepLoganathan's full-sized avatar

Pradeep Loganathan PradeepLoganathan

View GitHub Profile
#create system node pool
default_node_pool {
name = substr(var.system_node_pool.name, 0, 12)
orchestrator_version = var.kubernetes_version
node_count = var.system_node_pool.node_count
vm_size = var.system_node_pool.vm_size
type = "VirtualMachineScaleSets"
availability_zones = var.system_node_pool.zones
max_pods = 250
os_disk_size_gb = 128
resource "azurerm_kubernetes_cluster" "aks_cluster" {
name = "${var.resource_prefix}-cluster"
location = azurerm_resource_group.aks_res_grp.location
resource_group_name = azurerm_resource_group.aks_res_grp.name
dns_prefix = "${var.resource_prefix}-akscluster"
kubernetes_version = var.kubernetes_version
node_resource_group = "${var.resource_prefix}-worker"
private_cluster_enabled = false
sku_tier = var.sku_tier
}
resource "random_id" "log_analytics_workspace_name_suffix" {
byte_length = 8
}
resource "azurerm_log_analytics_workspace" "insights" {
name = "${var.log_analytics_workspace_name}-${random_id.log_analytics_workspace_name_suffix}"
location = azurerm_resource_group.aks_res_grp.location
resource_group_name = azurerm_resource_group.aks_res_grp.name
retention_in_days = 30
resource "azurerm_virtual_network" "aks_vnet" {
name = "${var.resource_prefix}-vnet"
location = azurerm_resource_group.aks_res_grp.location
resource_group_name = azurerm_resource_group.aks_res_grp.name
address_space = ["10.1.0.0/16"]
}
resource "azurerm_subnet" "aks_subnet" {
name = "${var.resource_prefix}-subnet"
variable "resource_prefix" {
type = string
description = "(Required) Prefix given to all resources within the module."
}
variable "location" {
type = string
description = "(Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created."
}
resource "azurerm_resource_group" "aks_res_grp" {
name = "${var.resource_prefix}-rg"
location = var.location
}
provider "azurerm" {
version = "~>2.35.0"
features {}
}
provider "azuread" {
version = "~>1.0.0"
}
terraform {
backend "azurerm" {}
}
tfstate_rg='remote-tfstate'
tfstate_ac=$(az storage account list --resource-group ${tfstate_rg} | jq .[0])
tfstate_account_name=$(echo $tfstate_ac | jq .name -r)
tfstate_account_key=$(az storage account keys list --resource-group ${tfstate_rg} --account-name ${tfstate_account_name} | jq .[0].value -r)
tf_state_container='terraform_state'
tf_state_keyname='key=myremotetf.tfstate'
terraform init \
-backend-config="storage_account_name=${tfstate_account_name}" \
{
"id": "CU8-16-1458",
"CustomerId": "CU8-16-1458",
"ModifiedDate": "2020-10-10T23:29:22.413755+10:00",
"Title": "Mrs.",
"FirstName": "Elda",
"LastName": "Hyatt",
"MiddleName": "Manuela",
"Suffix": "V",
"CompanyName": "Abernathy, Feeney and Walker",
CosmosContainerResponse container = await this._database.DefineContainer("CustomerContainer", "/CustomerId")
.CreateAsync(5000);