Skip to content

DC Mission 3945 - Polished for QAS #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions released/discovery_center/mission_3945/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To deploy the resources you must:
$env:BTP_PASSWORD=<your_password>
```

2. Change the variables in the `samples.tfvars` file to meet your requirements
2. Change the variables in the `sample.tfvars` file to meet your requirements

> ⚠ 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`.

Expand All @@ -34,13 +34,13 @@ To deploy the resources you must:
4. You can check what Terraform plans to apply based on your configuration:

```bash
terraform plan -var-file="samples.tfvars"
terraform plan -var-file="sample.tfvars"
```

5. Apply your configuration to provision the resources:

```bash
terraform apply -var-file="samples.tfvars"
terraform apply -var-file="sample.tfvars"
```

## In the end
Expand Down
3 changes: 0 additions & 3 deletions released/discovery_center/mission_3945/locals.tf

This file was deleted.

11 changes: 11 additions & 0 deletions released/discovery_center/mission_3945/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ locals {
subaccount_domain = lower(replace("mission-3945-${local.random_uuid}", "_", "-"))
}

locals {
service_name__sap_analytics_cloud = "analytics-planning-osb"
}

# ------------------------------------------------------------------------------------------------------
# Creation of subaccount
# ------------------------------------------------------------------------------------------------------
Expand All @@ -33,6 +37,11 @@ resource "btp_subaccount_trust_configuration" "fully_customized" {
identity_provider = var.custom_idp
}

locals {
custom_idp_tenant = var.custom_idp != "" ? element(split(".", var.custom_idp), 0) : ""
origin_key = local.custom_idp_tenant != "" ? "${local.custom_idp_tenant}-platform" : "sap.default"
origin_key_app_users = var.custom_idp != "" ? var.custom_idp_apps_origin_key : "sap.default"
}

# ------------------------------------------------------------------------------------------------------
# Assignment of users as sub account administrators
Expand All @@ -41,6 +50,7 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-admins" {
for_each = toset(var.subaccount_admins)
subaccount_id = data.btp_subaccount.dc_mission.id
role_collection_name = "Subaccount Administrator"
origin = local.origin_key
user_name = each.value
}

Expand All @@ -51,6 +61,7 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-service-admins"
for_each = toset(var.subaccount_service_admins)
subaccount_id = data.btp_subaccount.dc_mission.id
role_collection_name = "Subaccount Service Administrator"
origin = local.origin_key
user_name = each.value
}

Expand Down
4 changes: 4 additions & 0 deletions released/discovery_center/mission_3945/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ output "subaccount_id" {
value = data.btp_subaccount.dc_mission.id
description = "The ID of the subaccount."
}

output "sac_instance_dashboard_url" {
value = btp_subaccount_service_instance.sac.dashboard_url
}
2 changes: 1 addition & 1 deletion released/discovery_center/mission_3945/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
btp = {
source = "sap/btp"
version = "~> 1.5.0"
version = "~> 1.6.0"
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions released/discovery_center/mission_3945/sample.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# Provider configuration
# ------------------------------------------------------------------------------------------------------
# Your global account subdomain
globalaccount = "youraccount"
region = "us10"
subaccount_name = "SAP Discovery Center Mission 3945"
cf_environment_label = "cf-us10"
cf_space_name = "dev"
globalaccount = "youraccount"
region = "us10"
subaccount_name = "SAP Discovery Center Mission 3945"
custom_idp = "<your-idp>.accounts.ondemand.com"

# ------------------------------------------------------------------------------------------------------
# Project specific configuration (please adapt!)
Expand Down
8 changes: 6 additions & 2 deletions released/discovery_center/mission_3945/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ variable "custom_idp" {
default = ""
}

variable "custom_idp_apps_origin_key" {
type = string
description = "The custom identity provider for the subaccount."
default = "sap.custom"
}

variable "subaccount_admins" {
type = list(string)
description = "Defines the colleagues who are added to each subaccount as subaccount administrators."
default = ["jane.doe@test.com", "john.doe@test.com"]
}

variable "subaccount_service_admins" {
type = list(string)
description = "Defines the colleagues who are added to each subaccount as subaccount service administrators."
default = ["jane.doe@test.com", "john.doe@test.com"]
}

# service plan sap analytics cloud
Expand Down