TerraVision은 Terraform 코드를 전문 클라우드 아키텍처 다이어그램으로 변환하고 클라우드 프로젝트에서 가장 중요한 문서인 아키텍처 문서를 최신 상태로 유지하는 문제를 해결하는 CLI 도구입니다. 이제 고속 릴리스가 표준이 되면서 기계 생성 아키텍처 다이어그램은 더 이상 현실과 일치하지 않는 클라우드 설계자가 그린 자유형 다이어그램에 의존하는 것보다 더 정확합니다. Terravision은 Terraform에 대한 의존성이나 클라우드 환경에 대한 액세스 없이 100% 클라이언트측을 안전하게 실행하여 조건에 따라 생성된 리소스와 변수를 동적으로 구문 분석하고 아키텍처의 자동 시각화를 생성합니다. Terravision은 빌드/테스트/릴리스 파이프라인 단계 후 아키텍처 다이어그램을 업데이트하고 readthedocs.io와 같은 다른 문서 생성기를 함께 보완하기 위해 CI/CD 파이프라인에 포함될 수 있는 'Docs as Code'(DaC) 도구로 설계되었습니다. 현재 AWS를 지원하고 곧 Google 및 Azure 클라우드를 지원합니다.
이걸 돌려...
이것에...
이 소프트웨어는 아직 알파 테스트 중이며 코드는 명시적이든 묵시적이든 어떠한 종류의 보증이나 조건도 없이 "있는 그대로" 공유됩니다 . 자신의 책임하에 사용하십시오.
git clone https://github.com/patrickchugh/terravision.git
복제cd terravision
및 pwd
수행하여 작업 디렉터리(전체 경로)를 가져옵니다.PATH
값에 terravision 폴더를 추가하세요(예: export PATH=$PATH:/Users/<PATH TO TERRAVISION>
. 그러면 어디에서나 실행할 수 있습니다. <PATH TO TERRAVISION>
은 3행의 출력입니다.cd terravision && pip install -r requirements.txt
chmod +x terravision
사용하여 Terravision Python 스크립트를 실행할 수 있는지 확인하세요.terravision
실행하고 Terraform 소스 파일을 다음 형식으로 지정합니다. $ terravision draw --source ~ /src/my-terraform-code
작업공간이 있는 Terraform 스택의 경우 --workspace
매개변수를 사용할 수 있습니다.
$ terraform draw --source ~ /src/my-terraform-code --workspace development
Git 저장소의 Terraform 소스 코드의 경우 다음 형식을 사용할 수도 있습니다.
$ terravision draw --source https://github.com/your-repo/terraform-examples.git
원하는 코드가 폴더 계층 구조 아래에 있는 경우 Git 저장소 내의 하위 폴더에 //
문자를 사용하세요.
$ terravision draw --source https://github.com/your-repo/terraform-examples.git//mysubfolder/secondfolder/
자동으로 생성된 다이어그램에는 필요한 모든 세부 정보가 포함되어 있지 않으며 기껏해야 80-90% 정도만 얻을 수 있습니다. 기본 다이어그램 제목, 화살표의 추가 레이블 또는 Terraform 외부에서 생성된 추가 리소스와 같은 사용자 정의 주석을 추가하려면 소스 코드 폴더에 terravision.yml
파일을 포함하면 자동으로 로드됩니다. 또는 주석 파일의 경로를 terravision에 대한 매개변수로 지정합니다.
terravision --source https://github.com/your-repo/terraform-examples.git --annotate /Users/me/MyDocuments/annotations.yml
.yml 파일은 title
, connect
, disconnect
, add
, remove
또는 update
라는 제목이 하나 이상 포함된 아래 예제와 유사한 표준 YAML 구성 파일입니다. 노드 이름은 Terraform 리소스 이름(https://registry.terraform.io/providers/hashicorp/aws/latest/docs)과 동일한 규칙을 따르고 와일드카드를 지원합니다. 리소스 속성을 수정하고 label
속성(Terraform에는 없음)을 추가하여 모든 TF 리소스에 사용자 지정 레이블을 추가할 수 있습니다. 라인/연결의 경우 특정 리소스 노드에 대한 연결 라인에 텍스트를 추가하기 위해 terravision 특정 edge_labels
추가하여 리소스 속성을 수정할 수 있습니다. 아래 예를 참조하세요.
format : 0.1
# Main Diagram heading
title : Serverless Wordpress Site
# Draw new connection lines that are not apparent from the Terraforms
connect :
aws_rds_cluster.this :
- aws_ssm_parameter.db_master_user : Retrieve credentials from SSM
# Remove connections between nodes that are currently shown
disconnect :
# Wildcards mean these disconnections apply to any cloudwatch type resource called logs
aws_cloudwatch*.logs :
- aws_ecs_service.this
- aws_ecs_cluster.this
# Delete the following nodes
remove :
- aws_iam_role.task_execution_role
# Add the following nodes
add :
aws_subnet.another_one :
# Specify Terraform attributes for a resource like this
cidr_block : " 123.123.1.1 "
# Modify attributes of existing node
update :
aws_ecs_service.this :
# Add custom labels to the connection lines that already exist between ECS->RDS
edge_labels :
- aws_rds_cluster.this : Database Queries
# Wildcards save you listing multiple resources of the same type. This edge label is added to all CF->ACM connections.
aws_cloudfront* :
edge_labels :
- aws_acm_certificate.this : SSL Cert
# Add a custom label to a resource node. Overrides default label
aws_ecs_service.this :
label : " My Custom Label "
전체 명령 목록을 보려면 terravision --help
입력하거나 특정 명령에 대한 도움말을 보려면