Skip to content

Instantly share code, notes, and snippets.

View CyprienLecallier's full-sized avatar

CyprienLecallier

View GitHub Profile
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
data "azurerm_user_assigned_identity" "assigned_identity_acr_pull" {
provider = azurerm.acr_sub
name = "User_ACR_pull"
resource_group_name = "MYRG"
}
terraform {
backend "azurerm" {}
}
provider "azurerm" {
# Whilst version is optional, we /strongly recommend/ using it to pin the version of the Provider being used
version = "=2.18.0"
subscription_id = var.acr_subscription_id
features {}
skip_provider_registration = "true"
resource "azurerm_app_service_plan" "my_service_plan" {
name = "my_service_plan"
location = "France central"
resource_group_name = "MYRG"
kind = "Linux"
reserved = true
sku {
tier = "PremiumV2"
size = "P2v2"
locals {
env_variables = {
DOCKER_REGISTRY_SERVER_URL = "https://arc01.azurecr.io"
DOCKER_REGISTRY_SERVER_USERNAME = "ACR01"
DOCKER_REGISTRY_SERVER_PASSWORD = "**************"
}
}
resource "azurerm_app_service" "my_app_service_container" {
name = "my_app_service_container"
location = "France central"
resource_group_name = "MYRG"
app_service_plan_id = azurerm_app_service_plan.my_service_plan.id
https_only = true
client_affinity_enabled = true
site_config {
scm_type = "VSTSRM"
always_on = "true"
resource "azurerm_app_service_slot" "my_app_service_container_staging" {
name = "staging"
app_service_name = azurerm_app_service.my_app_service_container.name
location = "France central"
resource_group_name = "MYRG"
app_service_plan_id = azurerm_app_service_plan.my_service_plan.id
https_only = true
client_affinity_enabled = true
site_config {
scm_type = "VSTSRM"
resource "azurerm_application_insights" "my_app_insight" {
name = "my_app_insight"
location = "France central"
resource_group_name = "MYRG"
application_type = "Node.JS" # Depends on your application
disable_ip_masking = true
retention_in_days = 730
}
AZURE_MONITOR_INSTRUMENTATION_KEY = azurerm_application_insights.my_app_insight.instrumentation_key