Skip to content

Commit 04e535e

Browse files
authored
feat: include Kyma environment to basic setup
2 parents 2669578 + 32658f6 commit 04e535e

File tree

17 files changed

+240
-95
lines changed

17 files changed

+240
-95
lines changed

.wordlist.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,20 @@ js
4242
JS
4343
jq
4444
Kyma
45+
Kubeconfig
46+
kubeconfig
47+
kymaruntime
48+
Kyma
49+
kyma
4550
macOS
4651
md
4752
namings
4853
Namings
4954
NextSteps
5055
OAuth
56+
OpenID
57+
oidc
58+
OIDC
5159
OpenSSF
5260
OpenTofu
5361
PEM

sample-setups/basic-setup/directory-setup/.terraform.lock.hcl

Lines changed: 0 additions & 25 deletions
This file was deleted.

sample-setups/basic-setup/subaccount-setup/.terraform.lock.hcl

Lines changed: 0 additions & 63 deletions
This file was deleted.

sample-setups/basic-setup/subaccount-setup/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,25 @@ To ease the provisioning of entitlements we use the Terraform community module [
4141

4242
The setup of a Cloud Foundry environment is optional. The caller can decide if a Cloud Foundry environment is required or not e.g. when setting up a shared subaccount. The boolean variable is `provision_cf_environment` in the [variables.tf](./variables.tf) file.
4343

44+
The configuration of the setup is done in the corresponding module [`sap-btp-environment/cloudfoundry`](../../modules/sap-btp-environment/cloudfoundry/README.md).
45+
46+
### Setup of Kyma Environment
47+
48+
The setup of a Kyma environment is optional. The caller can decide if a Kyma environment is required or not e.g. when setting up a shared subaccount. The boolean variable is `provision_kyma_environment` in the [variables.tf](./variables.tf) file.
49+
50+
If the Kyma environment is requested, the variable `kyma_administrators` in the [variables.tf](./variables.tf) file must be filled with the users that should be assigned as administrators. This condition is validated
51+
52+
The configuration of the setup is done in the corresponding module [`sap-btp-environment/kyma`](../../modules/sap-btp-environment/kyma/README.md).
4453

4554
### Output
4655

4756
The output defined in the [outputs.tf](./outputs.tf) file returns the main information relevant for the development team namely:
4857

4958
- a link to the subaccount
50-
- The ID of the Cloud Foundry org
51-
- The API endpoint of the Cloud Foundry environment
52-
53-
59+
- The ID of the Cloud Foundry org if a Cloud Foundry environment is created
60+
- The API endpoint of the Cloud Foundry environment if a Cloud Foundry environment is created
61+
- The URL to the Kyma dashboard if a Kyma environment is created
62+
- The URL to the Kubeconfig file for the Kyma runtime if a Kyma environment is created
5463

5564
## SAP BTP Administrator's Guide - References
5665

sample-setups/basic-setup/subaccount-setup/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,21 @@ module "sap_btp_entitlements" {
7070
}
7171

7272
module "cf_environment" {
73-
source = "../../modules/sap-btp-environment/CloudFoundry"
73+
source = "../../modules/sap-btp-environment/cloudfoundry"
7474

7575
count = var.provision_cf_environment ? 1 : 0
7676

7777
subaccount_id = btp_subaccount.self.id
7878
instance_name = module.subaccount_namings.cloudfoundry_org_name
7979
cf_org_name = module.subaccount_namings.cloudfoundry_org_name
8080
}
81+
82+
module "kyma_environment" {
83+
source = "../../modules/sap-btp-environment/kyma"
84+
85+
count = var.provision_kyma_environment ? 1 : 0
86+
87+
subaccount_id = btp_subaccount.self.id
88+
instance_name = module.subaccount_namings.kyma_instance_name
89+
kyma_administrators = var.kyma_administrators
90+
}

sample-setups/basic-setup/subaccount-setup/outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ output "cf_org_id" {
1212
value = var.provision_cf_environment ? module.cf_environment[0].cf_org_id : "No Cloud Foundry environment was requested to be provisioned"
1313
description = "The Cloud Foundry org ID"
1414
}
15+
16+
output "kyma_dashboard_url" {
17+
value = var.provision_kyma_environment ? module.kyma_environment[0].kyma_dashboard_url : "No Kyma environment was requested to be provisioned"
18+
description = "The URL to the Kyma dashboard"
19+
}
20+
21+
output "kyma_kubeconfig_url" {
22+
value = var.provision_kyma_environment ? module.kyma_environment[0].kyma_kubeconfig_url : "No Kyma environment was requested to be provisioned"
23+
description = "The URL to the Kubeconfig file for the Kyma runtime"
24+
}

sample-setups/basic-setup/subaccount-setup/variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,20 @@ variable "provision_cf_environment" {
7676
description = "Provision Cloud Foundry environment in subaccount"
7777
default = true
7878
}
79+
80+
variable "provision_kyma_environment" {
81+
type = bool
82+
description = "Provision Kyma environment in subaccount"
83+
default = false
84+
}
85+
86+
variable "kyma_administrators" {
87+
description = "Users to be assigned as administrators for the Kyma environment."
88+
type = list(string)
89+
default = null
90+
91+
validation {
92+
condition = var.provision_kyma_environment ? length(var.kyma_administrators) > 0 : true
93+
error_message = "Kyma administrators must be provided if a Kyma environment is provisioned"
94+
}
95+
}

sample-setups/modules/sap-btp-environment/CloudFoundry/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SAP BTP - Environment Setup
1+
# SAP BTP - Cloud Foundry Environment Setup
22

33
This module encapsulates the creation of a Cloud Foundry environment in a subaccount on SAP BTP.
44

sample-setups/modules/sap-btp-environment/CloudFoundry/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ variable "subaccount_id" {
22
type = string
33
description = "ID of the subaccount where the Cloud Foundry environment will be created."
44
}
5+
56
variable "instance_name" {
67
type = string
78
description = "Name of the Cloud Foundry environment instance."
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SAP BTP - Kyma Environment Setup
2+
3+
This module encapsulates the creation of a Kyma environment in a subaccount on SAP BTP. The configuration is a basic setup. In a real world scenario, you would likely want to customize the setup further with respect to the available parameters like machine type etc. as described in the [documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/provisioning-and-update-parameters-in-kyma-environment) depending on the stage of the environment (development, test, production).
4+
5+
## Requirements
6+
7+
| Name | Version |
8+
|------|---------|
9+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
10+
| <a name="requirement_btp"></a> [btp](#requirement\_btp) | >= 1.11.0 |
11+
12+
## Providers
13+
14+
| Name | Version |
15+
|------|---------|
16+
| <a name="provider_btp"></a> [btp](#provider\_btp) | >= 1.11.0 |
17+
18+
## Modules
19+
20+
No modules.
21+
22+
## Resources
23+
24+
| Name | Type |
25+
|------|------|
26+
| [btp_subaccount_entitlement.kymaruntime](https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_entitlement) | resource |
27+
| [btp_subaccount_environment_instance.kymaruntime](https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_environment_instance) | resource |
28+
| [btp_regions.all](https://registry.terraform.io/providers/SAP/btp/latest/docs/data-sources/regions) | data source |
29+
| [btp_subaccount.this](https://registry.terraform.io/providers/SAP/btp/latest/docs/data-sources/subaccount) | data source |
30+
31+
## Inputs
32+
33+
| Name | Description | Type | Default | Required |
34+
|------|-------------|------|---------|:--------:|
35+
| <a name="input_instance_name"></a> [instance\_name](#input\_instance\_name) | Name of the Kyma environment instance. | `string` | n/a | yes |
36+
| <a name="input_kyma_administrators"></a> [kyma\_administrators](#input\_kyma\_administrators) | Users to be assigned as administrators. | `list(string)` | `[]` | no |
37+
| <a name="input_oidc"></a> [oidc](#input\_oidc) | Custom OpenID Connect IdP configuration to authenticate users in your Kyma runtime. | <pre>object({<br/> # the URL of the OpenID issuer (use the https schema)<br/> issuer_url = string<br/><br/> # the client ID for the OpenID client<br/> client_id = string<br/><br/> #the name of a custom OpenID Connect claim for specifying user groups<br/> groups_claim = string<br/><br/> # the list of allowed cryptographic algorithms used for token signing. The allowed values are defined by RFC 7518.<br/> signing_algs = set(string)<br/><br/> # the prefix for all usernames. If you don't provide it, username claims other than “email” are prefixed by the issuerURL to avoid clashes. To skip any prefixing, provide the value as -.<br/> username_prefix = string<br/><br/> # the name of a custom OpenID Connect claim for specifying a username<br/> username_claim = string<br/> })</pre> | `null` | no |
38+
| <a name="input_plan_name"></a> [plan\_name](#input\_plan\_name) | Desired service plan for the Kyma environment instance.<br/>If not provided it will be set to the default value of the region. | `string` | `null` | no |
39+
| <a name="input_subaccount_id"></a> [subaccount\_id](#input\_subaccount\_id) | ID of the subaccount where the Cloud Foundry environment will be created. | `string` | n/a | yes |
40+
41+
## Outputs
42+
43+
| Name | Description |
44+
|------|-------------|
45+
| <a name="output_kyma_dashboard_url"></a> [kyma\_dashboard\_url](#output\_kyma\_dashboard\_url) | The URL to the Kyma dashboard |
46+
| <a name="output_kyma_kubeconfig_url"></a> [kyma\_kubeconfig\_url](#output\_kyma\_kubeconfig\_url) | The URL to the Kubeconfig file for the Kyma runtime |

0 commit comments

Comments
 (0)