NashTech Blog

How to use AGIC through terraform ?

Table of Contents
close up photo of programming of codes
Photo by luis gomes on Pexels.com

Here In this blog, we will talk about AGIC which stands for application gateway ingress controller. We will see how we can integrate AGIC addon withkubernetes cluster using terraform. Before going forward let’s understand what is AGIC?

What is AGIC ?

The term “Application Gateway Ingress Controller” (AGIC) refers to a specific component used in Kubernetes clusters and is associated with Azure Kubernetes Service (AKS) in Microsoft Azure .

The “Application Gateway Ingress Controller” is essentially a Kubernetes Ingress Controller that integrates with Azure Application Gateway. It enables you to use Azure Application Gateway as the ingress point for your Kubernetes cluster, allowing you to manage and secure traffic to your Kubernetes services using Azure’s Application Gateway features.

AGIC simplifies the process of configuring and managing external access to your applications running in Azure Kubernetes Service by leveraging the capabilities of Azure’s Application Gateway. It helps route traffic from external sources to the appropriate services within your AKS cluster while providing features like SSL termination, path-based routing, and more.

How to enable AGIC using terraform ?

There are two ways in which you can enable this add-on in AKS cluster using terraform. First one is to create application gateway automatically while enabling this add on. Second method is, if you have already application gateway then use its id only to integrate with AGIC

First Method: If you don’t have application gateway already created

Inside azurerm_kuberentes_cluster resource block add this part:

ingress_application_gateway {
    gateway_name = application_gateway
    subnet_cidr = 10.1.1.0/24
}

// optionally instead of subnet_cidr you can use subnet_id . and pass this is using data block. 
// this block create a new application_gateway inside this subnet with agic enables on aks

Second Method: If you have application gateway already created

if you have already application_gateway with you can simply use its id to integrate it with aks

//use data block to get application gateway
data "azurerm_application_gateway" "example" {
  name                = "existing-app-gateway"
  resource_group_name = "existing-resources"
}

ingress_application_gateway {
    gateway_id = data.azurerm_application_gateway.example.id
  }

That all for this blog, I hope you have enjoyed this . To know more about this you can refer documentation here . To explore more about such blogs visit our blogs page .

Picture of Saumya

Saumya

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article

Scroll to Top