단일 계정에서의 AWS Discovery
Teleport v18.11요약
이 페이지는 teleport-discovery-aws Terraform 모듈의 사용 예시(single-account-legacy)에 있는 설정 필드를 나열합니다. 이 디렉터리의 구성은 Teleport가 단일 AWS 계정의 리소스를 탐색하는 데 필요한 AWS 및 Teleport 리소스를 생성합니다.
이 페이지는 teleport-discovery-aws Terraform 모듈의 사용 예시(single-account-legacy)에 있는 설정 필드를 나열합니다.
Teleport AWS 계정 Discovery 예시#
이 디렉터리의 구성은 Teleport가 단일 AWS 계정의 리소스를 탐색하는 데 필요한 AWS 및 Teleport 리소스를 생성합니다.
또한 이 예시는 사용자 지정 AWS IAM 정책을 사용하여 Teleport Discovery Service 인스턴스의 권한 범위를 좁힙니다.
요구 사항#
| Name | Version |
|---|---|
| terraform | >= 1.0 |
| aws | >= 5.0 |
| teleport | >= 18.5.1 |
| tls | >= 4.0 |
제공자#
| Name | Version |
|---|---|
| aws | >= 5.0 |
모듈#
| Name | Source | Version |
|---|---|---|
| aws_discovery | ../.. | n/a |
리소스#
| Name | Type |
|---|---|
| aws_iam_policy_document.teleport_discovery_service_single_account | data source |
입력#
입력이 없습니다.
출력#
| Name | Description |
|---|---|
| aws_discovery | n/a |
소스 코드#
GitHub에서 teleport-discovery-aws 모듈의 single-account-legacy 예시 소스 코드 보기.
################################################################################
# teleport/discovery/aws/examples/single-account-legacy/main.tf
################################################################################
module "aws_discovery" {
source = "terraform.releases.teleport.dev/teleport/discovery/aws"
version = "~> (=teleport.major_version=).0"
teleport_proxy_public_addr = "example.teleport.sh:443"
teleport_discovery_group_name = "cloud-discovery-group"
# Discover EC2 AWS resources
match_aws_resource_types = ["ec2"]
# Apply the additional AWS tag "origin=example" to all AWS resources created by this module
apply_aws_tags = { origin = "example" }
# Apply the additional Teleport label "origin=example" to all Teleport resources created by this module
apply_teleport_resource_labels = { origin = "example" }
# Examples of existing AWS resource reuse:
# AWS IAM OIDC provider for this Teleport cluster's public proxy address must already exist
create_aws_iam_openid_connect_provider = false
# Use a custom IAM policy with permission conditions
aws_iam_policy_document = data.aws_iam_policy_document.teleport_discovery_service_single_account.json
}
data "aws_iam_policy_document" "teleport_discovery_service_single_account" {
# read-only discovery
statement {
effect = "Allow"
actions = [
"account:ListRegions",
"ec2:DescribeInstances",
"ssm:DescribeInstanceInformation",
"ssm:GetCommandInvocation",
"ssm:ListCommandInvocations",
]
resources = ["*"]
}
# SSM command execution document access
# (Allows using any document, or restrict to specific documents here)
statement {
effect = "Allow"
actions = [
"ssm:SendCommand",
]
resources = [
"arn:aws:ssm:*:*:document/AWS-RunShellScript"
]
}
# SSM command execution instance access
statement {
effect = "Allow"
actions = [
"ssm:SendCommand",
]
resources = [
"arn:aws:ec2:*:*:instance/*"
]
# restrict command execution on instances based on resource tags
condition {
test = "StringEquals"
variable = "aws:ResourceTag/TeleportManaged"
values = ["true"]
}
}
}
################################################################################
# teleport/discovery/aws/examples/single-account-legacy/outputs.tf
################################################################################
output "aws_discovery" {
value = module.aws_discovery
}
################################################################################
# teleport/discovery/aws/examples/single-account-legacy/versions.tf
################################################################################
terraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
}
tls = {
source = "hashicorp/tls"
version = ">= 4.0"
}
teleport = {
source = "terraform.releases.teleport.dev/gravitational/teleport"
version = ">= 18.5.1"
}
}
}