Skip to content

Commit c91ce19

Browse files
committed
Update comments, use coalesce
1 parent 60f4d42 commit c91ce19

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

examples/terraform-modules/teleport-azure-discovery/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
This Terraform module creates the Azure and Teleport cluster resources necessary for a Teleport cluster to discover Azure virtual machines:
44

5-
- Azure user-assigned managed identity for Teleport Discovery Service to use.
6-
- Azure federated identity credential that trusts the Teleport proxy as an issuer.
7-
- Azure custom role definition and assignment that grant the minimum VM discovery and install permissions.
8-
- Teleport `discovery_config` cluster resource that configures Teleport for Azure VM discovery.
9-
- Teleport `integration` cluster resource for Azure OIDC.
10-
- Teleport `token` cluster resource that allows Teleport nodes to join the cluster using Azure credentials.
5+
- **Azure user-assigned managed identity**: Used by the Teleport Discovery Service to authenticate to Azure APIs for scanning and managing VMs in the specified resource groups.
6+
- **Azure federated identity credential**: Establishes trust between Azure and your Teleport cluster by allowing the managed identity to authenticate using OIDC tokens issued by your Teleport proxy.
7+
- **Azure custom role definition and assignment**: Grants the managed identity the minimum required permissions to discover VMs and run installation commands on them.
8+
- **Teleport `discovery_config` cluster resource**: Configures the discovery parameters (subscriptions, resource groups, tags) that determine which Azure VMs will be discovered and enrolled.
9+
- **Teleport `integration` cluster resource**: Stores the Azure OIDC integration configuration in your Teleport cluster, linking the Azure tenant and client ID to enable authentication.
10+
- **Teleport `token` cluster resource**: Provides the join token that discovered Azure VMs will use to authenticate and join your Teleport cluster.
1111

1212
## Prerequisites
1313

@@ -31,14 +31,14 @@ For bugs related to this code, please [open an issue](https://github.com/gravita
3131
|------|---------|
3232
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 1.6.0 |
3333
| <a name="requirement_azurerm"></a> [azurerm](#requirement_azurerm) | ~> 4.0 |
34-
| <a name="requirement_teleport"></a> [teleport](#requirement_teleport) | ~> 18.5 |
34+
| <a name="requirement_teleport"></a> [teleport](#requirement_teleport) | ~> 18.7 |
3535

3636
## Providers
3737

3838
| Name | Version |
3939
|------|---------|
4040
| <a name="provider_azurerm"></a> [azurerm](#provider_azurerm) | ~> 4.0 |
41-
| <a name="provider_teleport"></a> [teleport](#provider_teleport) | ~> 18.5 |
41+
| <a name="provider_teleport"></a> [teleport](#provider_teleport) | ~> 18.7 |
4242

4343
## Modules
4444

examples/terraform-modules/teleport-azure-discovery/main.tf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terraform {
88
}
99
teleport = {
1010
source = "terraform.releases.teleport.dev/gravitational/teleport"
11-
version = "~> 18.5"
11+
version = "~> 18.7"
1212
}
1313
}
1414
}
@@ -20,8 +20,14 @@ locals {
2020
discovery_resource_groups = var.discovery_resource_group_names
2121
proxy_addr = var.proxy_addr
2222
discovery_group = var.discovery_group_name
23-
identity_resource_group = var.identity_resource_group_name != "" ? var.identity_resource_group_name : local.discovery_resource_groups[0]
24-
tags = var.tags
23+
# Use the specified identity resource group, or default to the first discovery resource group
24+
# if none is provided. This allows managed identity groups to be in a separate resource group
25+
# from where VMs are discovered.
26+
identity_resource_group = coalesce(
27+
var.identity_resource_group_name,
28+
local.discovery_resource_groups[0]
29+
)
30+
tags = var.tags
2531

2632
names = {
2733
identity = "${var.prefix}-discovery-identity"
@@ -32,7 +38,8 @@ locals {
3238
role = "${var.prefix}-discovery-role"
3339
}
3440

35-
issuer = "https://${replace(local.proxy_addr, ":443", "")}"
41+
# Extract the host from proxy_addr (format: host:port) to construct the OIDC issuer URL
42+
issuer = "https://${split(":", local.proxy_addr)[0]}"
3643
}
3744

3845
# User-assigned managed identity for discovery

examples/terraform-modules/teleport-azure-discovery/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ variable "tags" {
3838
variable "identity_resource_group_name" {
3939
type = string
4040
description = "Resource group to place identity resources; defaults to first discovery RG when empty."
41-
default = ""
41+
default = null
4242
}
4343

4444
variable "discovery_group_name" {

0 commit comments

Comments
 (0)