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
| Name | Explaination | Type |
|---|---|---|
subscription_id (required) | Azure subscription id | String |
tenant_id (required) | Azure entra tenant id | String |
resource_group_name (required) | Name of the resource group to be imported | String |
client_id (required) | The Application Client ID. Must be created first before running this module | String |
cluster_name (required) | The name of the existing AKS cluster to import | String |
kosmos_access_key (required) | User access key of Kosmos. Please empty the value when you want to commit to git | String |
fleet_id (required) | Kosmos fleet name where the cluster will be imported to | String |
owner (required) | Owner of the cluster | String |
kosmos_user (required) | Kosmos User which will be added as admin user | String |
kosmos_tier (required) | Tier/Env of Kosmos | String |
Resources created:
- 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: