관리 그룹에서 Azure 리소스 검색하기
Teleport v18.11요약
이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 management-group의 구성 필드를 나열합니다. GitHub에서 teleport-discovery-azure 모듈의 management-group 예시 소스 코드 보기.
이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 management-group의 구성 필드를 나열합니다.
관리 그룹에서 Azure 리소스 검색 예시#
Azure 관리 그룹의 리소스를 검색하도록 Teleport를 구성합니다.
요구 사항#
| 이름 | 버전 |
|---|---|
| terraform | >= 1.5.7 |
| azurerm | >= 4.0 |
| http | >= 3.0 |
| teleport | >= 18.7.6 |
공급자 (Providers)#
| 이름 | 버전 |
|---|---|
| azurerm | >= 4.0 |
| teleport | >= 18.7.6 |
모듈 (Modules)#
| 이름 | 소스 | 버전 |
|---|---|---|
| azure_discovery | ../.. | n/a |
리소스 (Resources)#
| 이름 | 유형 |
|---|---|
| azurerm_resource_group.example | resource |
| teleport_installer.example | resource |
| azurerm_client_config.current | data source |
입력 (Inputs)#
입력 없음.
출력 (Outputs)#
| 이름 | 설명 |
|---|---|
| azure_discovery | n/a |
소스 코드#
GitHub에서 teleport-discovery-azure 모듈의 management-group 예시 소스 코드 보기.
################################################################################
# teleport/discovery/azure/examples/management-group/main.tf
################################################################################
locals {
apply_azure_tags = { origin = "example" }
apply_teleport_resource_labels = { origin = "example" }
}
data "azurerm_client_config" "current" {}
# Resource group for the Azure resources created by the module.
resource "azurerm_resource_group" "example" {
name = "teleport-discovery"
location = "eastus"
tags = local.apply_azure_tags
}
module "azure_discovery" {
source = "terraform.releases.teleport.dev/teleport/discovery/azure"
version = "~> (=teleport.major_version=).0"
teleport_discovery_group_name = "cloud-discovery-group"
teleport_proxy_public_addr = "example.teleport.sh:443"
# Name of an existing Azure Resource Group where Azure resources will be created.
azure_resource_group_name = azurerm_resource_group.example.name
# Region where Azure managed identity will be created (eastus)
azure_managed_identity_location = azurerm_resource_group.example.location
# Management group ID or tenant ID. Using a Tenant ID will use the Root
# management group scope for the managed identity's role.
#
# Operations on the root scope will require elevated access.
# See https://learn.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin
azure_management_group_id = data.azurerm_client_config.current.tenant_id
# Optionally restrict role assignments to child scopes. The wildcard
# subscription matcher will discover subscriptions visible to the
# assigned scopes. When set, azure_management_group_id is only used for the
# role definition's assignable scope.
#
# azure_role_assignment_scopes = [
# "/providers/Microsoft.Management/managementGroups/child-mg",
# "/subscriptions/00000000-0000-0000-0000-000000000000",
# ]
# Discover Azure VMs across all subscriptions matching the specified tags.
azure_matchers = [
{
types = ["vm"]
subscriptions = ["*"]
tags = {
TeleportEnroll = ["true"]
}
}
]
# Apply the additional Azure tag "origin=example" to all Azure resources created by this module
apply_azure_tags = local.apply_azure_tags
# Apply the additional Teleport label "origin=example" to all Teleport resources created by this module
apply_teleport_resource_labels = local.apply_teleport_resource_labels
# Using a custom installer script on discovered VMs instead of the default installer script.
teleport_installer_script_name = teleport_installer.example.metadata.name
}
resource "teleport_installer" "example" {
version = "v1"
metadata = {
name = "custom-azure-installer-example"
description = "Example Teleport Installer"
labels = local.apply_teleport_resource_labels
}
spec = {
# This "custom" script is actually the default installer script (you can view the default installer to verify: `$ tctl get installer/default-installer`).
# Edit it to customize the commands that the Teleport Discovery Service
# configures virtual machines to run to install Teleport on startup.
script = <= 1.5.7"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.0"
}
teleport = {
source = "terraform.releases.teleport.dev/gravitational/teleport"
version = ">= 18.7.6"
}
}
}