generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Cortey/new-example-case
Added a new example case and support for reusing an existing subaccount
- Loading branch information
Showing
12 changed files
with
204 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Run | ||
|
||
Ensure you have opentofu (or terraform CLI installed). | ||
The sample scripts relly on `tofu` command, but its 100% compatible with `terraform` CLI. | ||
|
||
Ensure the tofu CLI is installed by calling: | ||
```sh | ||
brew install opentofu | ||
``` | ||
|
||
Save a new version of the template file `examples/kyma-on-btp-new-sa/local-template.tfvars` as `examples/kyma-on-btp-new-sa/local.tfvars`. Provide values for input variables. | ||
|
||
Run the example: | ||
|
||
```sh | ||
tofu init | ||
tofu apply -var-file="local.tfvars" -auto-approve | ||
``` | ||
|
||
As a result, a new `kubeconfig.yaml` file was created that you can use to access the newly provisioned kyma runtime on SAP BTP. | ||
|
||
```sh | ||
kubectl get nodes --kubeconfig kubeconfig.yaml | ||
``` | ||
|
||
Last but not least, deprovision all resources via: | ||
|
||
```sh | ||
tofu destroy -var="BTP_NEW_SUBACCOUNT_NAME=foo" -var-file="local.tfvars" -auto-approve | ||
``` |
5 changes: 3 additions & 2 deletions
5
...s/kyma-on-btp-basic/local-template.tfvars → .../kyma-on-btp-new-sa/local-template.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
terraform { | ||
required_providers { | ||
btp = { | ||
source = "SAP/btp" | ||
version = "1.5.0" | ||
} | ||
jq = { | ||
source = "massdriver-cloud/jq" | ||
} | ||
http = { | ||
source = "hashicorp/http" | ||
version = "3.4.4" | ||
} | ||
} | ||
} | ||
|
||
|
||
provider "jq" {} | ||
provider "http" {} | ||
|
||
provider "btp" { | ||
globalaccount = var.BTP_GLOBAL_ACCOUNT | ||
cli_server_url = var.BTP_BACKEND_URL | ||
idp = var.BTP_CUSTOM_IAS_TENANT | ||
username = var.BTP_BOT_USER | ||
password = var.BTP_BOT_PASSWORD | ||
} | ||
|
||
module "kyma" { | ||
source = "../.." | ||
BTP_KYMA_PLAN = var.BTP_KYMA_PLAN | ||
BTP_NEW_SUBACCOUNT_NAME = var.BTP_NEW_SUBACCOUNT_NAME | ||
BTP_CUSTOM_IAS_TENANT = var.BTP_CUSTOM_IAS_TENANT | ||
BTP_CUSTOM_IAS_DOMAIN = var.BTP_CUSTOM_IAS_DOMAIN | ||
BTP_KYMA_REGION = var.BTP_KYMA_REGION | ||
BTP_BOT_USER = var.BTP_BOT_USER | ||
BTP_BOT_PASSWORD = var.BTP_BOT_PASSWORD | ||
BTP_PROVIDER_SUBACCOUNT_ID = var.BTP_PROVIDER_SUBACCOUNT_ID | ||
BTP_NEW_SUBACCOUNT_REGION = var.BTP_NEW_SUBACCOUNT_REGION | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# Mandatory ID of the subaccount to be used | ||
BTP_USE_SUBACCOUNT_ID = "" | ||
|
||
BTP_BOT_USER = "" | ||
BTP_BOT_PASSWORD = "" | ||
BTP_GLOBAL_ACCOUNT = "" | ||
|
||
# optional. will default to `https://cli.btp.cloud.sap`. For Canary landscape use `https://cpcli.cf.sap.hana.ondemand.com` | ||
BTP_BACKEND_URL = "" | ||
|
||
# Mandatory | ||
BTP_CUSTOM_IAS_TENANT = "" | ||
# Optional. Defaults to `accounts.ondemand.com`. For Canary landscape use `accounts400.ondemand.com` | ||
BTP_CUSTOM_IAS_DOMAIN = "" | ||
|
||
# Optional. defaults to `azure`; One of: `azure`, `sap-converged-cloud`, `aws`, `gcp` | ||
BTP_KYMA_PLAN = "" | ||
# Must match options for given plan; i.e `westeurope` is a valid kyma region for kyma plan `azure` | ||
BTP_KYMA_REGION = "" | ||
#optional | ||
BTP_PROVIDER_SUBACCOUNT_ID = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# we're using uppercase variable names, since in some cases (e.g Azure DevOps) the system variables are forced to be uppercase | ||
# TF allows providing variable values as env variables of name name, case sensitive | ||
|
||
variable "BTP_GLOBAL_ACCOUNT" { | ||
type = string | ||
description = "Global account name" | ||
default = "global-account-guid" | ||
} | ||
|
||
variable "BTP_BOT_USER" { | ||
type = string | ||
description = "Bot account name" | ||
default = "email@domain.com" | ||
} | ||
|
||
variable "BTP_BOT_PASSWORD" { | ||
type = string | ||
description = "Bot account password" | ||
default = "password" | ||
} | ||
|
||
variable "BTP_BACKEND_URL" { | ||
type = string | ||
description = "BTP backend URL" | ||
default = "https://cli.btp.cloud.sap" | ||
} | ||
|
||
variable "BTP_USE_SUBACCOUNT_ID" { | ||
type = string | ||
description = "Subaccount name" | ||
default = null | ||
} | ||
|
||
variable "BTP_KYMA_PLAN" { | ||
type = string | ||
description = "Plan name" | ||
default = "azure" | ||
} | ||
|
||
variable "BTP_CUSTOM_IAS_TENANT" { | ||
type = string | ||
description = "Custom IAS tenant" | ||
default = "custon-tenant" | ||
} | ||
|
||
variable "BTP_CUSTOM_IAS_DOMAIN" { | ||
type = string | ||
description = "Custom IAS domain" | ||
default = "accounts.ondemand.com" | ||
} | ||
|
||
variable "BTP_KYMA_REGION" { | ||
type = string | ||
description = "Kyma region" | ||
default = "westeurope" | ||
} | ||
|
||
variable "BTP_PROVIDER_SUBACCOUNT_ID" { | ||
type = string | ||
description = "Subaccount ID" | ||
default = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.