Architecture
Data Sources Overview
This document describes the SAP BTP Terraform provider data sources and how they interconnect.
btp_global* Data Sources
The following data sources are available for querying SAP BTP Global Account information:
| Data Source | Purpose | Key Attributes |
|---|---|---|
btp_globalaccount |
Query current authenticated Global Account context | global_account_id, idp_name, name, tenant_domain, username |
btp_globalsubaccount |
Query a specific subaccount within the Global Account | global_account_id, guid, name, subaccount_type, url, x509_url, iam_url |
btp_globalentitlements |
Query service entitlements for a Global Account | idp_name, global_account_id, service_name, service_instance_guid, plan_name, service_version |
btp_globaldestinations |
Query destinations configured in the BTP Cockpit | guid, name, destination_type, url, authentication_type, description |
btp_globalcloudconnector |
Query cloud connector instances | global_account_id, guid, name, endpoint_url, protocol |
Data Source Interconnections
graph TD
A[btp_globalaccount] -->|Provides context for| B[btp_globalsubaccount]
A -->|Provides context for| C[btp_globalentitlements]
A -->|Provides context for| D[btp_globaldestinations]
A -->|Provides context for| E[btp_globalcloudconnector]
B -->|Requires| F[global_account_id from A]
C -->|Requires| G[global_account_id from A]
D -->|Requires| H[global_account_id from A or tenant URL]
E -->|Requires| I[global_account_id from A]
Usage Patterns
- Authentication Context:
btp_globalaccountprovides the authenticated context for all other data sources. - Subaccount Discovery: Use
btp_globalsubaccountto list and query subaccounts within a Global Account. - Entitlement Management: Use
btp_globalentitlementsto discover available services and their instances. - Integration Configuration: Use
btp_globaldestinationsandbtp_globalcloudconnectorfor integration patterns.
Current Implementation
The project currently implements:
data "btp_globalaccount" "this" {
provider = btp.development
}
Additional data sources can be added following the same pattern:
# Example: Query subaccounts
data "btp_globalsubaccount" "all" {
provider = btp.development
global_account_id = data.btp_globalaccount.this.global_account_id
}
# Example: Query entitlements
data "btp_globalentitlements" "services" {
provider = btp.development
global_account_id = data.btp_globalaccount.this.global_account_id
idp_name = data.btp_globalaccount.this.idp_name
}
Intended architecture direction
- The repository root is the orchestration entry point (root module).
- Reusable child modules live in
modules/; each has one cohesive responsibility and declares provider requirements without configuring providers. - Environments are independent root modules under
environments/with isolated state; they reuse the same modules. - Provider configuration and authentication belong to root modules only.
Current state
Scaffold stage: no resources, modules, or backends are implemented yet. See the
project specification SPEC-TF-001 Terraform Project Directory Structure
(Obsidian vault, Efforts/Projects/BTP Documentation Generator/Specifications/).