Import AKS Cluster using Terraform

Prerequisite

This script assumes that you have already created the necessary IAM resources to create AKS related resources through Kosmos.

For more details refer:

Introduction

This is Terraform script for importing existing AKS Cluster using Kosmos-provider into Kosmos fleet. This is triggered by setting the value of kosmos_aksClusters.this.imported to true.

User who runs this script must have required permission on Azure and Kosmos.

Variables and Datasource

NameExplainationType
subscription_id (required)Azure subscription idString
tenant_id (required)Azure entra tenant idString
resource_group_name (required)Name of the resource group to be importedString
client_id (required)The Application Client ID. Must be created first before running this moduleString
cluster_name (required)The name of the existing AKS cluster to importString
kosmos_access_key (required)User access key of Kosmos. Please empty the value when you want to commit to gitString
fleet_id (required)Kosmos fleet name where the cluster will be imported toString
owner (required)Owner of the clusterString
kosmos_user (required)Kosmos User which will be added as admin userString
kosmos_tier (required)Tier/Env of KosmosString

Resources created:

  1. Kosmos AKS Cluster (1)

Prerequisites

You need to register your application into Azure and provide Federated Identity.

Provider

In Kosmos provider configuration you have to specify your own Kosmos accesskey first. You can generate access key from Kosmos Old UI.

Usage

First you need to configure the input variables, you can either use variables.tf or .tfvars file.

Then inside this directory you run

terraform init
terraform plan
terraform apply

Download Resources

For complete examples and the latest updates, refer to:

Edit this page on GitHub