diff --git a/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf.tf b/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf.tf index 546d41ce..723bc04e 100644 --- a/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf.tf +++ b/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf.tf @@ -53,6 +53,7 @@ resource "btp_subaccount_environment_instance" "cf" { delete = "30m" } } + # ------------------------------------------------------------------------------------------------------ # Create the Cloud Foundry org users # ------------------------------------------------------------------------------------------------------ @@ -61,4 +62,25 @@ resource "cloudfoundry_org_role" "org_role" { username = each.value type = "organization_user" org = btp_subaccount_environment_instance.cf.platform_id -} \ No newline at end of file +} + +resource "cloudfoundry_org_role" "manager_role" { + for_each = var.cf_org_managers + username = each.value + type = "organization_manager" + org = btp_subaccount_environment_instance.cf.platform_id +} + +resource "cloudfoundry_org_role" "auditor_role" { + for_each = var.cf_org_auditors + username = each.value + type = "organization_auditor" + org = btp_subaccount_environment_instance.cf.platform_id +} + +resource "cloudfoundry_org_role" "billing_role" { + for_each = var.cf_org_billing_managers + username = each.value + type = "organization_auditor" + org = btp_subaccount_environment_instance.cf.platform_id +} diff --git a/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf_variables.tf b/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf_variables.tf index c235d51a..e3c74ec0 100644 --- a/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf_variables.tf +++ b/released/modules/btp-cf/btp-cf-env-instance/btp_env_cf_variables.tf @@ -37,4 +37,19 @@ variable "cf_org_name" { variable "cf_org_user" { type = set(string) description = "Defines the colleagues who are added to the Cloud Foundry organization as users." +} + +variable "cf_org_managers" { + type = set(string) + description = "List of Cloud Foundry org managers." +} + +variable "cf_org_billing_managers" { + type = set(string) + description = "List of Cloud Foundry org billing managers." +} + +variable "cf_org_auditors" { + type = set(string) + description = "List of Cloud Foundry org auditors." } \ No newline at end of file diff --git a/released/usecases/subaccount_setup/main.tf b/released/usecases/subaccount_setup/main.tf index 4f4ef3bf..b4406a48 100644 --- a/released/usecases/subaccount_setup/main.tf +++ b/released/usecases/subaccount_setup/main.tf @@ -20,11 +20,12 @@ resource "btp_subaccount" "project" { # Creation of Cloud Foundry environment ### module "cloudfoundry_environment" { - source = "../../modules/environment/cloudfoundry/envinstance_cf" + source = "../../modules/btp-cf/btp-cf-env-instance" subaccount_id = btp_subaccount.project.id instance_name = local.project_subaccount_cf_org cf_org_name = local.project_subaccount_cf_org + cf_org_user = [] cf_org_managers = [] cf_org_billing_managers = [] cf_org_auditors = [] diff --git a/released/usecases/subaccount_setup/provider.tf b/released/usecases/subaccount_setup/provider.tf index e9eecb8a..8e84519c 100644 --- a/released/usecases/subaccount_setup/provider.tf +++ b/released/usecases/subaccount_setup/provider.tf @@ -6,8 +6,8 @@ terraform { version = "~> 1.4.0" } cloudfoundry = { - source = "cloudfoundry-community/cloudfoundry" - version = "0.53.1" + source = "SAP/cloudfoundry" + version = "0.2.1-beta" } } diff --git a/released/usecases/subaccount_setup/variables.tf b/released/usecases/subaccount_setup/variables.tf index e57d0ebd..5aec6c41 100644 --- a/released/usecases/subaccount_setup/variables.tf +++ b/released/usecases/subaccount_setup/variables.tf @@ -11,7 +11,8 @@ variable "subaccount_name" { error_message = "Provide a valid project account name." } } - +### +# CloudFoundry Org Setup variable "cf_org_name" { type = string description = "Defines to which organisation the project account shall belong to." @@ -30,6 +31,26 @@ variable "cf_org_name" { } } +variable "cf_org_user" { + type = set(string) + description = "Defines the colleagues who are added to the Cloud Foundry organization as users." +} + +variable "cf_org_managers" { + type = set(string) + description = "Defines the colleagues who are added to the Cloud Foundry organization as org managers." +} + +variable "cf_org_billing_managers" { + type = set(string) + description = "Defines the colleagues who are added to the Cloud Foundry organization as org billing managers." +} + +variable "cf_org_auditors" { + type = set(string) + description = "Defines the colleagues who are added to the Cloud Foundry organization as org auditors." +} + variable "stage" { type = string description = "The stage/tier the account will be used for." @@ -41,7 +62,6 @@ variable "stage" { } } - ### # BTP ACCOUNT ### @@ -49,4 +69,4 @@ variable "region" { type = string description = "The region where the project account shall be created in." default = "us10" -} +} \ No newline at end of file