Skip to content

Commit a6af10f

Browse files
author
Felix Zieger
committed
feat: add tenant id and replicator service principal to terraform output
1 parent 492ade6 commit a6af10f

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ For an overview of the module structure, refer to [generated terraform docs](./T
3030

3131
3. Download the example `main.tf` and an `output.tf` files.
3232

33-
```sh
33+
```powershell
3434
# Downloads main.tf and output.tf files into ~/terraform-azure-meshplatform
3535
wget https://raw.githubusercontent.com/meshcloud/terraform-azure-meshplatform/main/examples/basic-azure-integration/main.tf -P ~/terraform-azure-meshplatform
3636
wget https://raw.githubusercontent.com/meshcloud/terraform-azure-meshplatform/main/examples/basic-azure-integration/outputs.tf -P ~/terraform-azure-meshplatform
@@ -40,7 +40,7 @@ For an overview of the module structure, refer to [generated terraform docs](./T
4040
4141
5. Execute the module.
4242
43-
```sh
43+
```powershell
4444
# Changes into ~/terraform-azure-meshplatform and applies terraform
4545
cd ~/terraform-azure-meshplatform
4646
terraform init
@@ -66,29 +66,7 @@ For an overview of the module structure, refer to [generated terraform docs](./T
6666
az login --tenant TENANT_ID
6767
```
6868

69-
2. Create a directory and change into it
70-
71-
```sh
72-
mkdir terraform-azure-meshplatform
73-
cd terraform-azure-meshplatform
74-
```
75-
76-
3. Create a `main.tf` and an `output.tf` files in the created directory that references this module
77-
> See [Example Usages](#example-usages)
78-
79-
4. Run
80-
81-
```sh
82-
terraform init
83-
terraform apply
84-
```
85-
86-
5. Access terraform output and pass it securely to meshcloud.
87-
88-
```sh
89-
# The JSON output contains sensitive values that must not be transmitted to meshcloud in plain text.
90-
terraform output -json
91-
```
69+
2. Follow the instructions for Azure Portal
9270

9371
## Example Usages
9472

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ module "uami_blueprint_user_principal" {
5454
spp_name_suffix = var.spp_name_suffix
5555
subscriptions = var.subscriptions
5656
}
57+
58+
data "azuread_client_config" "current" {}

modules/meshcloud-replicator-spp/module.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ resource "azuread_service_principal_password" "spp_pw" {
126126
service_principal_id = azuread_service_principal.meshcloud_replicator.id
127127
end_date = "2999-01-01T01:02:03Z" # no expiry
128128
}
129+
130+
data "azuread_application" "blueprint_service_principal" {
131+
application_id = "f71766dc-90d9-4b7d-bd9d-4499c4331c3f"
132+
}

modules/meshcloud-replicator-spp/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ output "service_principal_password" {
1212
value = azuread_service_principal_password.spp_pw.value
1313
sensitive = true
1414
}
15+
16+
output "blueprint_service_principal_object_id" {
17+
description = "Object ID of the BluePrint Service Principal of this AAD."
18+
value = data.azuread_application.blueprint_service_principal.object_id
19+
}

outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ output "replicator_spp_password" {
1010
sensitive = true
1111
}
1212

13+
output "blueprint_service_principal_object_id" {
14+
description = "Object ID of the BluePrint Service Principal in this AAD."
15+
value = length(module.replicator_spp) > 0 ? module.replicator_spp[0].azuread_application.blueprint_service_principal.object_id : null
16+
}
17+
1318
output "kraken_spp" {
1419
description = "Kraken Service Principal."
1520
value = length(module.kraken_spp) > 0 ? module.kraken_spp[0].service_principal : null
@@ -42,3 +47,8 @@ output "uami_blueprint_user_principal_password" {
4247
value = length(module.uami_blueprint_user_principal) > 0 ? module.uami_blueprint_user_principal[0].service_principal_password : null
4348
sensitive = true
4449
}
50+
51+
output "azure_ad_tenant_id" {
52+
description = "The Azure AD tenant id."
53+
value = data.azuread_client_config.current.tenant_id
54+
}

0 commit comments

Comments
 (0)