Skip to content

Commit 139e225

Browse files
authored
feat: add module for fetching app ID for a role (#389)
1 parent 0d08233 commit 139e225

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Module: modules - roles - App ID of a Role on subaccount level
2+
3+
## Content of setup
4+
5+
The module returns the application ID needed to create custom role collections.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
terraform {
2+
required_providers {
3+
btp = {
4+
source = "SAP/btp"
5+
version = "~> 1.9.0"
6+
}
7+
}
8+
}
9+
10+
data "btp_subaccount_roles" "all_roles" {
11+
subaccount_id = var.subaccount_id
12+
}
13+
14+
15+
locals {
16+
selected_role = [
17+
for role in data.btp_subaccount_roles.all_roles.values : role
18+
if role.name == var.role_name && role.role_template_name == var.role_template_name
19+
]
20+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "role_app_id" {
2+
value = local.selected_role[0].app_id
3+
description = "The id of the application that provides the role template and the role."
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
variable "subaccount_id" {
2+
type = string
3+
description = "The ID of the SAP BTP subaccount"
4+
}
5+
6+
variable "role_name" {
7+
type = string
8+
description = "The name of the role"
9+
}
10+
11+
variable "role_template_name" {
12+
type = string
13+
description = "The name of the role template."
14+
}

0 commit comments

Comments
 (0)