단일 구독에서 Azure 리소스 검색하기
Teleport v18.11요약
이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 single-subscription의 구성 필드를 나열합니다. GitHub에서 teleport-discovery-azure 모듈의 single-subscription 예시 소스 코드 보기
이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 single-subscription의 구성 필드를 나열합니다.
단일 구독에서 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 모듈의 single-subscription 예시 소스 코드 보기
################################################################################
# teleport/discovery/azure/examples/single-subscription/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
# Discover Azure VMs or AKS clusters across all resource groups in the current subscription
# and matching the specified tags.
azure_matchers = [
{
types = ["vm"] # or ["aks"] for AKS clusters
subscriptions = [data.azurerm_client_config.current.subscription_id]
resource_groups = ["*"]
regions = ["westus", "eastus"]
tags = {
env = ["example"]
}
}
]
# 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"
}
}
}