Description
Description:
Introduce a new set of capabilities in the Kyma CLI to allow users to manage Kyma environments on SAP BTP using the SAP BTP Terraform provider and the official Kyma Terraform module
Terraform integration
Kyma CLI would delegate provisioning to terraform (based on known main.tf
file, see examples) and store terraform state and metadata in:
~/.kyma/instances/{instance-name}/
Includes:
- Terraform state
- Module/provider cache
- kubeconfig file
New capabilities of CLI
New kyma instance
subcommands:
-
kyma instance list
Lists all Kyma environments from local state. -
kyma instance create {name}
Provisions a new Kyma environment on SAP BTP with the given name and stores the state in the local store.
Support for--dry-run --output-dir
that would only output terraform configuration into the target dir. User can procede with terraform CLI in such case -
kyma instance delete {name}
Deletes the Kyma environment with the specified name and cleans up local store. -
kyma instance get {name}
Reads the Kyma environment metadata from local store and viaterraform output
command, including cluster domain, service instance id, btp subaccount id -
kyma instance kubeconfig get {name}
Reads the kubeconfig for a Kyma environment from a local store
Support--use
flag ininstance kubeconfig
to immediately activate the fetched kubeconfig. -
kyma instance kubeconfig rotate {name}
Rotate access on BTP, stores in local store and outputs the credentials.
Support--use
flag ininstance kubeconfig
to immediately activate the fetched kubeconfig.
Configuration Options
Kyma CLI supports flexible configuration through:
- Command-line flags (highest priority)
kyma instance create my-instance \
--btp-new-subaccount-name "demo-subaccount" \
--btp-kyma-region "europe" \
--env-path ./btp-env.env
.env
file (via--env-path
)
--env-path ./btp-env.env
Configuration Precedence
- Command-line flags
.env
file from--env-path
- Default:
~/.kyma/btp.env
Example .env
File
BTP_NEW_SUBACCOUNT_NAME=""
BTP_NEW_SUBACCOUNT_REGION=""
BTP_GLOBAL_ACCOUNT=""
BTP_USERNAME=""
BTP_PASSWORD=""
BTP_BACKEND_URL=""
BTP_CUSTOM_IAS_TENANT=""
BTP_KYMA_PLAN=""
BTP_KYMA_REGION=""
BTP_KYMA_CUSTOM_ADMINISTRATORS=["",""]
Future Ideas
Instance switching and context awareness:
-
kyma instance use {name}
Sets the specified instance as the current CLI context. Stores context info in~/.kyma/current
. -
kyma instance current
Displays which Kyma instance is currently active (based on kubeconfig context or local CLI context).
Technical considerations
-
CLI will use the Terraform underneath:
- from a host machine ? (good opportunity to start a dev-toolbox)
- via go client ? (like we use
pack already
)
-
Underlying providers: