From e34b4a32181e89af775cf89294baa991d4e9be19 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 10:12:14 +0200 Subject: [PATCH 1/9] add second step --- .../mission_3585/{ => step1}/README.md | 0 .../mission_3585/{ => step1}/main.tf | 23 +++++++++- .../mission_3585/{ => step1}/outputs.tf | 7 ++- .../mission_3585/{ => step1}/provider.tf | 0 .../mission_3585/{ => step1}/sample.tfvars | 0 .../mission_3585/{ => step1}/variables.tf | 46 +++++++++++++------ .../mission_3585/step2/main.tf | 32 +++++++++++++ .../mission_3585/step2/provider.tf | 15 ++++++ .../mission_3585/step2/sample.tfvars | 10 ++++ .../mission_3585/step2/variables.tf | 34 ++++++++++++++ 10 files changed, 152 insertions(+), 15 deletions(-) rename released/discovery_center/mission_3585/{ => step1}/README.md (100%) rename released/discovery_center/mission_3585/{ => step1}/main.tf (90%) rename released/discovery_center/mission_3585/{ => step1}/outputs.tf (86%) rename released/discovery_center/mission_3585/{ => step1}/provider.tf (100%) rename released/discovery_center/mission_3585/{ => step1}/sample.tfvars (100%) rename released/discovery_center/mission_3585/{ => step1}/variables.tf (83%) create mode 100644 released/discovery_center/mission_3585/step2/main.tf create mode 100644 released/discovery_center/mission_3585/step2/provider.tf create mode 100644 released/discovery_center/mission_3585/step2/sample.tfvars create mode 100644 released/discovery_center/mission_3585/step2/variables.tf diff --git a/released/discovery_center/mission_3585/README.md b/released/discovery_center/mission_3585/step1/README.md similarity index 100% rename from released/discovery_center/mission_3585/README.md rename to released/discovery_center/mission_3585/step1/README.md diff --git a/released/discovery_center/mission_3585/main.tf b/released/discovery_center/mission_3585/step1/main.tf similarity index 90% rename from released/discovery_center/mission_3585/main.tf rename to released/discovery_center/mission_3585/step1/main.tf index e9ad399e..59cc9299 100644 --- a/released/discovery_center/mission_3585/main.tf +++ b/released/discovery_center/mission_3585/step1/main.tf @@ -27,7 +27,7 @@ data "btp_subaccount_environments" "all" { # (this replaces the previous null_resource) # ------------------------------------------------------------------------------------------------------ resource "terraform_data" "replacement" { - input = length(var.cf_environment_label) > 0 ? var.cf_environment_label : [for env in data.btp_subaccount_environments.all.values : env if env.service_name == "cloudfoundry" && env.environment_type == "cloudfoundry"][0].landscape_label + input = length(var.cf_landscape_label) > 0 ? var.cf_landscape_label : [for env in data.btp_subaccount_environments.all.values : env if env.service_name == "cloudfoundry" && env.environment_type == "cloudfoundry"][0].landscape_label } # ------------------------------------------------------------------------------------------------------ # Create the Cloud Foundry environment instance @@ -206,3 +206,24 @@ resource "btp_subaccount_role_collection_assignment" "cicd_developers" { user_name = each.value depends_on = [btp_subaccount_subscription.cicd_app] } + + +# ------------------------------------------------------------------------------------------------------ +# Create tfvars file for step 2 (if variable `create_tfvars_file_for_step2` is set to true) +# ------------------------------------------------------------------------------------------------------ +resource "local_file" "output_vars_step1" { + count = var.create_tfvars_file_for_next_step ? 1 : 0 + content = <<-EOT + cf_api_url = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["API Endpoint"]}" + + cf_org_id = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["Org ID"]}" + + cf_origin = "${var.cf_origin}" + + cf_space_name = "${var.cf_space_name}" + + cf_org_admins = ${jsonencode(var.cf_org_admins)} + + EOT + filename = "../step2/terraform.tfvars" +} \ No newline at end of file diff --git a/released/discovery_center/mission_3585/outputs.tf b/released/discovery_center/mission_3585/step1/outputs.tf similarity index 86% rename from released/discovery_center/mission_3585/outputs.tf rename to released/discovery_center/mission_3585/step1/outputs.tf index a70a5402..a076c14d 100644 --- a/released/discovery_center/mission_3585/outputs.tf +++ b/released/discovery_center/mission_3585/step1/outputs.tf @@ -13,11 +13,16 @@ output "subaccount_id" { description = "The Global Account subdomain id." } -output "cf_api_endpoint" { +output "cf_api_url" { value = jsondecode(btp_subaccount_environment_instance.cf.labels)["API Endpoint"] description = "The Cloudfoundry API endpoint." } +output "cf_landscape_label" { + value = terraform_data.replacement.output + description = "The Cloudfoundry landscape label." +} + output "cf_org_id" { value = jsondecode(btp_subaccount_environment_instance.cf.labels)["Org ID"] description = "The Cloudfoundry org id." diff --git a/released/discovery_center/mission_3585/provider.tf b/released/discovery_center/mission_3585/step1/provider.tf similarity index 100% rename from released/discovery_center/mission_3585/provider.tf rename to released/discovery_center/mission_3585/step1/provider.tf diff --git a/released/discovery_center/mission_3585/sample.tfvars b/released/discovery_center/mission_3585/step1/sample.tfvars similarity index 100% rename from released/discovery_center/mission_3585/sample.tfvars rename to released/discovery_center/mission_3585/step1/sample.tfvars diff --git a/released/discovery_center/mission_3585/variables.tf b/released/discovery_center/mission_3585/step1/variables.tf similarity index 83% rename from released/discovery_center/mission_3585/variables.tf rename to released/discovery_center/mission_3585/step1/variables.tf index f50c334a..05207b1a 100644 --- a/released/discovery_center/mission_3585/variables.tf +++ b/released/discovery_center/mission_3585/step1/variables.tf @@ -32,17 +32,6 @@ variable "subaccount_admins" { } } -variable "cf_org_admins" { - type = list(string) - description = "List of users to set as Cloudfoundry org administrators." - - # add validation to check if admins contains a list of valid email addresses - validation { - condition = length([for email in var.cf_org_admins : can(regex("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", email))]) == length(var.cf_org_admins) - error_message = "Please enter a valid email address for the CF Org admins." - } -} - variable "launchpad_admins" { type = list(string) description = "Defines the colleagues who are Launchpad Admins." @@ -98,14 +87,45 @@ variable "cicd_admins" { } } -variable "cf_environment_label" { +variable "cf_org_admins" { + type = list(string) + description = "List of users to set as Cloudfoundry org administrators." + + # add validation to check if admins contains a list of valid email addresses + validation { + condition = length([for email in var.cf_org_admins : can(regex("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", email))]) == length(var.cf_org_admins) + error_message = "Please enter a valid email address for the CF Org admins." + } +} + +variable "cf_origin" { type = string - description = "In case there are multiple environments available for a subaccount, you can use this label to choose with which one you want to go. If nothing is given, we take by default the first available." + description = "Defines the origin key of the identity provider" + default = "sap.ids" + # The value for the cf_origin can be defined + # but are normally set to "sap.ids", "sap.default" or "sap.custom" +} + +variable "cf_landscape_label" { + type = string + description = "In case there are multiple landscapes available for a subaccount, you can use this label to choose with which one you want to go. If nothing is given, we take by default the first available." default = "" } +variable "cf_space_name" { + type = string + description = "The Cloud Foundry space name to use" + default = "DEV" +} + variable "custom_idp" { type = string description = "The custom identity provider for the subaccount." default = "sap.ids" } + +variable "create_tfvars_file_for_next_step" { + type = bool + description = "Switch to enable the creation of the tfvars file for step 2." + default = false +} \ No newline at end of file diff --git a/released/discovery_center/mission_3585/step2/main.tf b/released/discovery_center/mission_3585/step2/main.tf new file mode 100644 index 00000000..1a6c4fbc --- /dev/null +++ b/released/discovery_center/mission_3585/step2/main.tf @@ -0,0 +1,32 @@ +# ------------------------------------------------------------------------------------------------------ +# Create the Cloud Foundry space +# ------------------------------------------------------------------------------------------------------ +resource "cloudfoundry_space" "space" { + name = var.cf_space_name + org = var.cf_org_id +} + +# ------------------------------------------------------------------------------------------------------ +# USERS AND ROLES +# ------------------------------------------------------------------------------------------------------ +# +# ------------------------------------------------------------------------------------------------------ +# Assign CF Org roles to the admin users +# ------------------------------------------------------------------------------------------------------ +# Define Org User role +resource "cloudfoundry_org_role" "organization_user" { + for_each = toset("${var.cf_org_admins}") + username = each.value + type = "organization_user" + org = var.cf_org_id + origin = var.cf_origin +} +# Define Org Manager role +resource "cloudfoundry_org_role" "organization_manager" { + for_each = toset("${var.cf_org_admins}") + username = each.value + type = "organization_manager" + org = var.cf_org_id + origin = var.cf_origin + depends_on = [cloudfoundry_org_role.organization_user] +} \ No newline at end of file diff --git a/released/discovery_center/mission_3585/step2/provider.tf b/released/discovery_center/mission_3585/step2/provider.tf new file mode 100644 index 00000000..17b6ff94 --- /dev/null +++ b/released/discovery_center/mission_3585/step2/provider.tf @@ -0,0 +1,15 @@ +### +# Define the required providers for this module +### +terraform { + required_providers { + cloudfoundry = { + source = "SAP/cloudfoundry" + version = "0.2.1-beta" + } + } +} + +provider "cloudfoundry" { + api_url = var.cf_api_url +} \ No newline at end of file diff --git a/released/discovery_center/mission_3585/step2/sample.tfvars b/released/discovery_center/mission_3585/step2/sample.tfvars new file mode 100644 index 00000000..3223949b --- /dev/null +++ b/released/discovery_center/mission_3585/step2/sample.tfvars @@ -0,0 +1,10 @@ +# ------------------------------------------------------------------------------------------------------ +# Provider configuration (this file will be either created automatically in step 1 or manually in step 2) +# ------------------------------------------------------------------------------------------------------ +cf_origin = "sap.ids" + +cf_api_url = "https://api.cf.us10.hana.ondemand.com" +cf_org_id = "your_cf_org_id" +cf_space_name = "dev" + +cf_org_admins = ["another.user@test.com"] diff --git a/released/discovery_center/mission_3585/step2/variables.tf b/released/discovery_center/mission_3585/step2/variables.tf new file mode 100644 index 00000000..c422d86d --- /dev/null +++ b/released/discovery_center/mission_3585/step2/variables.tf @@ -0,0 +1,34 @@ +variable "cf_api_url" { + type = string + description = "The API URL of the Cloud Foundry environment instance." +} + +variable "cf_org_admins" { + type = list(string) + description = "List of users to set as Cloudfoundry org administrators." + + # add validation to check if admins contains a list of valid email addresses + validation { + condition = length([for email in var.cf_org_admins : can(regex("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", email))]) == length(var.cf_org_admins) + error_message = "Please enter a valid email address for the CF Org admins." + } +} + +variable "cf_org_id" { + type = string + description = "The Cloud Foundry Org ID to use." +} + +variable "cf_origin" { + type = string + description = "Defines the origin key of the identity provider" + default = "sap.ids" + # The value for the cf_origin can be defined + # but are normally set to "sap.ids", "sap.default" or "sap.custom" +} + +variable "cf_space_name" { + type = string + description = "The Cloud Foundry Space name to use." + default = "dev" +} \ No newline at end of file From 59f106ca1f1f8e656bd8b1b3c6802fd7ef896034 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 10:49:21 +0200 Subject: [PATCH 2/9] remove output --- released/discovery_center/mission_3585/step1/outputs.tf | 5 ----- released/discovery_center/mission_3585/step2/sample.tfvars | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/released/discovery_center/mission_3585/step1/outputs.tf b/released/discovery_center/mission_3585/step1/outputs.tf index a076c14d..db09ecc8 100644 --- a/released/discovery_center/mission_3585/step1/outputs.tf +++ b/released/discovery_center/mission_3585/step1/outputs.tf @@ -3,11 +3,6 @@ output "globalaccount" { description = "The Global Account subdomain." } -output "cli_server_url" { - value = var.cli_server_url - description = "The BTP CLI server URL." -} - output "subaccount_id" { value = btp_subaccount.dc_mission.id description = "The Global Account subdomain id." diff --git a/released/discovery_center/mission_3585/step2/sample.tfvars b/released/discovery_center/mission_3585/step2/sample.tfvars index 3223949b..64a1cc80 100644 --- a/released/discovery_center/mission_3585/step2/sample.tfvars +++ b/released/discovery_center/mission_3585/step2/sample.tfvars @@ -7,4 +7,4 @@ cf_api_url = "https://api.cf.us10.hana.ondemand.com" cf_org_id = "your_cf_org_id" cf_space_name = "dev" -cf_org_admins = ["another.user@test.com"] +cf_org_admins = ["another.user@test.com"] From 9516c55efff06f228617c822b1614cb30123a4ca Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 11:07:46 +0200 Subject: [PATCH 3/9] adjust README --- .../mission_3585/step1/README.md | 29 +++++----- .../mission_3585/step1/sample.tfvars | 3 + .../mission_3585/step2/README.md | 58 +++++++++++++++++++ 3 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 released/discovery_center/mission_3585/step2/README.md diff --git a/released/discovery_center/mission_3585/step1/README.md b/released/discovery_center/mission_3585/step1/README.md index 59551b0c..844811d7 100644 --- a/released/discovery_center/mission_3585/step1/README.md +++ b/released/discovery_center/mission_3585/step1/README.md @@ -1,8 +1,8 @@ -# Discovery Center mission - Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App +# Discovery Center mission - Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App (Step 1) ## Overview -This sample shows how to set up your SAP BTP account for the Discovery Center Mission - [Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App](https://discovery-center.cloud.sap/missiondetail/3585/) +Step 1 of this sample shows how to set up your SAP BTP account for the Discovery Center Mission - [Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App](https://discovery-center.cloud.sap/missiondetail/3585/) ## Content of setup @@ -23,25 +23,20 @@ Make sure that you are familiar with SAP BTP and know both the [Get Started with To deploy the resources you must: -1. Create a file `secret.auto.tfvars` and maintain the credentials for the BTP provider +1. Set the environment variables BTP_USERNAME and BTP_PASSWORD to pass credentials to the BTP provider to authenticate and interact with your BTP environments. - ```hcl - user_email = "" - password = "" - ``` - as an alternative you can set these credentials also as environment variables - ```bash - export user_email ='' - export password ='' + export BTP_USERNAME= + export BTP_PASSWORD= ``` -3. Change the variables in the `sample.tfvars` file to meet your requirements +2. Change the variables in the `sample.tfvars` file to meet your requirements - > The minimal set of parameters you should specify (besides user_email and password) is global account (i.e. its subdomain) and the used custom_idp and all user assignments + > The minimal set of parameters you should specify (besides user email and password) is global account (i.e. its subdomain) and the used custom_idp and all user assignments > ⚠ NOTE: You should pay attention **specifically** to the users defined in the samples.tfvars whether they already exist in your SAP BTP accounts. Otherwise, you might get error messages like, e.g., `Error: The user could not be found: jane.doe@test.com`. +3. The outputs of this `step1` will be needed for the `step2` of this use case. In case you want to create a file with the content of the variables, you should set the variable `create_tfvars_file_for_next_step` to `true`. This will create a `terraform.tfvars` file in the `step2` folder. 4. Initialize your workspace: @@ -60,3 +55,11 @@ To deploy the resources you must: ```bash terraform apply -var-file="sample.tfvars" ``` + +## When finished + +You probably want to remove the assets after trying them out to avoid unnecessary costs. To do so execute the following command: + +```bash +terraform destroy -var-file="sample.tfvars" +``` diff --git a/released/discovery_center/mission_3585/step1/sample.tfvars b/released/discovery_center/mission_3585/step1/sample.tfvars index a643f540..accda4a8 100644 --- a/released/discovery_center/mission_3585/step1/sample.tfvars +++ b/released/discovery_center/mission_3585/step1/sample.tfvars @@ -26,3 +26,6 @@ cicd_developers = ["another.user@test.com", "you@test.com"] bas_admins = ["another.user@test.com", "you@test.com"] bas_developers = ["another.user@test.com", "you@test.com"] + +# Create variables file for step 2 (disabled by default) +create_tfvars_file_for_next_step = true diff --git a/released/discovery_center/mission_3585/step2/README.md b/released/discovery_center/mission_3585/step2/README.md new file mode 100644 index 00000000..b4c8657f --- /dev/null +++ b/released/discovery_center/mission_3585/step2/README.md @@ -0,0 +1,58 @@ +# Discovery Center mission - Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App (Step 2) + +## Overview + +Step 2 of this sample shows how to Cloud Foundry environment for the Discovery Center Mission - [Get Started on SAP BTP with SAPUI5/Fiori - Create a Hello World App](https://discovery-center.cloud.sap/missiondetail/3585/) + +## Content of setup + +This setup step comprises the following resources: + +- Creation of a Cloud Foundry space +- Cloud Foundry role assignments to users + +## Deploying the resources + +Make sure that you are familiar with SAP BTP and know both the [Get Started with btp-terraform-samples](https://github.com/SAP-samples/btp-terraform-samples/blob/main/GET_STARTED.md) and the [Get Started with the Terraform Provider for BTP](https://developers.sap.com/tutorials/btp-terraform-get-started.html) + +To deploy the resources you must: + +1. Set the environment variables CF_USER and CF_PASSWORD to pass credentials to the Cloud Foundry provider to authenticate and interact with your BTP environments. + + ```bash + export CF_USER= + export CF_PASSWORD= + ``` + +2. Change the variables in the `sample.tfvars` file to meet your requirements + + > The minimal set of parameters you should specify (besides user_email and password) is Cloud Foundry API URL and all Cloud Foundry user assignments + + > ⚠ NOTE: You should pay attention **specifically** to the users defined in the samples.tfvars whether they already exist in your SAP BTP accounts. Otherwise, you might get error messages like, e.g., `Error: The user could not be found: jane.doe@test.com`. + + +3. Initialize your workspace: + + ```bash + terraform init + ``` + +4. You can check what Terraform plans to apply based on your configuration: + + ```bash + terraform plan -var-file="sample.tfvars" + ``` + +5. Apply your configuration to provision the resources: + + ```bash + terraform apply -var-file="sample.tfvars" + ``` + +## When finished + +You probably want to remove the assets after trying them out to avoid unnecessary costs. To do so execute the following command: + +```bash +terraform destroy -var-file="sample.tfvars" +``` From ad0432a30cb058ce28db560d59b4ad9fb83f78d6 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 11:08:12 +0200 Subject: [PATCH 4/9] Update main.tf --- released/discovery_center/mission_3585/step1/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/released/discovery_center/mission_3585/step1/main.tf b/released/discovery_center/mission_3585/step1/main.tf index 59cc9299..a70fa1ca 100644 --- a/released/discovery_center/mission_3585/step1/main.tf +++ b/released/discovery_center/mission_3585/step1/main.tf @@ -226,4 +226,4 @@ resource "local_file" "output_vars_step1" { EOT filename = "../step2/terraform.tfvars" -} \ No newline at end of file +} From e5ef04896d9acdd44cd35996046b2cf2442f4fcf Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 11:09:22 +0200 Subject: [PATCH 5/9] Update README.md --- released/discovery_center/mission_3585/step2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/released/discovery_center/mission_3585/step2/README.md b/released/discovery_center/mission_3585/step2/README.md index b4c8657f..cf5a0467 100644 --- a/released/discovery_center/mission_3585/step2/README.md +++ b/released/discovery_center/mission_3585/step2/README.md @@ -17,7 +17,7 @@ Make sure that you are familiar with SAP BTP and know both the [Get Started with To deploy the resources you must: -1. Set the environment variables CF_USER and CF_PASSWORD to pass credentials to the Cloud Foundry provider to authenticate and interact with your BTP environments. +1. Set the environment variables CF_USER and CF_PASSWORD to pass credentials to the Cloud Foundry provider to authenticate and interact with your Cloud Foundry environment instance. ```bash export CF_USER= From eb281b9de3d0919ffd16a09438ef9165d998bf86 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 11:12:00 +0200 Subject: [PATCH 6/9] minor whitespace fixes --- released/discovery_center/mission_3585/step1/variables.tf | 4 ++-- released/discovery_center/mission_3585/step2/main.tf | 2 +- released/discovery_center/mission_3585/step2/provider.tf | 2 +- released/discovery_center/mission_3585/step2/variables.tf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/released/discovery_center/mission_3585/step1/variables.tf b/released/discovery_center/mission_3585/step1/variables.tf index 05207b1a..83a00076 100644 --- a/released/discovery_center/mission_3585/step1/variables.tf +++ b/released/discovery_center/mission_3585/step1/variables.tf @@ -115,7 +115,7 @@ variable "cf_landscape_label" { variable "cf_space_name" { type = string description = "The Cloud Foundry space name to use" - default = "DEV" + default = "dev" } variable "custom_idp" { @@ -128,4 +128,4 @@ variable "create_tfvars_file_for_next_step" { type = bool description = "Switch to enable the creation of the tfvars file for step 2." default = false -} \ No newline at end of file +} diff --git a/released/discovery_center/mission_3585/step2/main.tf b/released/discovery_center/mission_3585/step2/main.tf index 1a6c4fbc..843b7207 100644 --- a/released/discovery_center/mission_3585/step2/main.tf +++ b/released/discovery_center/mission_3585/step2/main.tf @@ -29,4 +29,4 @@ resource "cloudfoundry_org_role" "organization_manager" { org = var.cf_org_id origin = var.cf_origin depends_on = [cloudfoundry_org_role.organization_user] -} \ No newline at end of file +} diff --git a/released/discovery_center/mission_3585/step2/provider.tf b/released/discovery_center/mission_3585/step2/provider.tf index 17b6ff94..554e0843 100644 --- a/released/discovery_center/mission_3585/step2/provider.tf +++ b/released/discovery_center/mission_3585/step2/provider.tf @@ -12,4 +12,4 @@ terraform { provider "cloudfoundry" { api_url = var.cf_api_url -} \ No newline at end of file +} diff --git a/released/discovery_center/mission_3585/step2/variables.tf b/released/discovery_center/mission_3585/step2/variables.tf index c422d86d..7f08b545 100644 --- a/released/discovery_center/mission_3585/step2/variables.tf +++ b/released/discovery_center/mission_3585/step2/variables.tf @@ -31,4 +31,4 @@ variable "cf_space_name" { type = string description = "The Cloud Foundry Space name to use." default = "dev" -} \ No newline at end of file +} From c2033dc4cf781e64d0d464e2e35168cf1664d7e5 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 11:19:43 +0200 Subject: [PATCH 7/9] Update provider.tf --- released/discovery_center/mission_3585/step1/provider.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/released/discovery_center/mission_3585/step1/provider.tf b/released/discovery_center/mission_3585/step1/provider.tf index 7ceab97d..529cc83b 100644 --- a/released/discovery_center/mission_3585/step1/provider.tf +++ b/released/discovery_center/mission_3585/step1/provider.tf @@ -8,6 +8,9 @@ terraform { } provider "btp" { +# Comment out the idp in case you need it to connect to your global account +# ------------------------------------------------------------------------- +# idp = var.custom_idp globalaccount = var.globalaccount cli_server_url = var.cli_server_url } From 8a6cb0c81ea8e4df71284ad87e2421a34c3640f5 Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 15:00:19 +0200 Subject: [PATCH 8/9] Update main.tf --- released/discovery_center/mission_3585/step1/main.tf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/released/discovery_center/mission_3585/step1/main.tf b/released/discovery_center/mission_3585/step1/main.tf index a70fa1ca..bbaec2f0 100644 --- a/released/discovery_center/mission_3585/step1/main.tf +++ b/released/discovery_center/mission_3585/step1/main.tf @@ -45,6 +45,18 @@ resource "btp_subaccount_environment_instance" "cf" { }) } +############################################################################################### +# Prepare CF +############################################################################################### +# Entitle subaccount for usage of cf runtime + +resource "btp_subaccount_entitlement" "cf_runtime" { + subaccount_id = btp_subaccount.dc_mission.id + service_name = "APPLICATION_RUNTIME" + plan_name = "MEMORY" + amount = 1 +} + # ------------------------------------------------------------------------------------------------------ # SERVICES # ------------------------------------------------------------------------------------------------------ From 2d15cd6b12abfb424313d82abbc13d80d8354fcb Mon Sep 17 00:00:00 2001 From: Markus Balsam Date: Mon, 1 Jul 2024 15:25:29 +0200 Subject: [PATCH 9/9] fix issues --- released/discovery_center/mission_3585/step1/main.tf | 6 +++--- released/discovery_center/mission_3585/step1/provider.tf | 6 +++--- released/discovery_center/mission_3585/step2/sample.tfvars | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/released/discovery_center/mission_3585/step1/main.tf b/released/discovery_center/mission_3585/step1/main.tf index bbaec2f0..3fe5e731 100644 --- a/released/discovery_center/mission_3585/step1/main.tf +++ b/released/discovery_center/mission_3585/step1/main.tf @@ -226,11 +226,11 @@ resource "btp_subaccount_role_collection_assignment" "cicd_developers" { resource "local_file" "output_vars_step1" { count = var.create_tfvars_file_for_next_step ? 1 : 0 content = <<-EOT - cf_api_url = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["API Endpoint"]}" + cf_api_url = "${jsondecode(btp_subaccount_environment_instance.cf.labels)["API Endpoint"]}" - cf_org_id = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["Org ID"]}" + cf_org_id = "${jsondecode(btp_subaccount_environment_instance.cf.labels)["Org ID"]}" - cf_origin = "${var.cf_origin}" + cf_origin = "${var.cf_origin}" cf_space_name = "${var.cf_space_name}" diff --git a/released/discovery_center/mission_3585/step1/provider.tf b/released/discovery_center/mission_3585/step1/provider.tf index 529cc83b..27f11abc 100644 --- a/released/discovery_center/mission_3585/step1/provider.tf +++ b/released/discovery_center/mission_3585/step1/provider.tf @@ -8,9 +8,9 @@ terraform { } provider "btp" { -# Comment out the idp in case you need it to connect to your global account -# ------------------------------------------------------------------------- -# idp = var.custom_idp + # Comment out the idp in case you need it to connect to your global account + # ------------------------------------------------------------------------- + # idp = var.custom_idp globalaccount = var.globalaccount cli_server_url = var.cli_server_url } diff --git a/released/discovery_center/mission_3585/step2/sample.tfvars b/released/discovery_center/mission_3585/step2/sample.tfvars index 64a1cc80..e6ae97e4 100644 --- a/released/discovery_center/mission_3585/step2/sample.tfvars +++ b/released/discovery_center/mission_3585/step2/sample.tfvars @@ -2,9 +2,7 @@ # Provider configuration (this file will be either created automatically in step 1 or manually in step 2) # ------------------------------------------------------------------------------------------------------ cf_origin = "sap.ids" - cf_api_url = "https://api.cf.us10.hana.ondemand.com" cf_org_id = "your_cf_org_id" cf_space_name = "dev" - cf_org_admins = ["another.user@test.com"]