Skip to content

Commit

Permalink
Use TopologicalSort for viz yaml same as resources.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
gordon-klotho committed Mar 7, 2024
1 parent f11da88 commit 24f68e6
Show file tree
Hide file tree
Showing 32 changed files with 897 additions and 897 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ go.work.sum
*.key

/logs
__debug_bin*
44 changes: 22 additions & 22 deletions pkg/engine/testdata/2_routes.dataflow-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
provider: aws
resources:
lambda_function/lambda_function_0:
children:
- aws:ecr_image:lambda_function_0-image
- aws:ecr_repo:lambda_function_0-image-ecr_repo
- aws:iam_role:lambda_function_0-ExecutionRole
aws:api_integration:rest_api_1/integ0:
parent: rest_api/rest_api_1
tag: big

lambda_function/lambda_function_1:
children:
- aws:ecr_image:lambda_function_1-image
- aws:ecr_repo:lambda_function_1-image-ecr_repo
- aws:iam_role:lambda_function_1-ExecutionRole
aws:api_integration:rest_api_1/integ0 -> lambda_function/lambda_function_0:
path:
- aws:lambda_permission:integ0-lambda_function_0

aws:api_integration:rest_api_1/integ1:
parent: rest_api/rest_api_1
tag: big

aws:api_integration:rest_api_1/integ1 -> lambda_function/lambda_function_1:
path:
- aws:lambda_permission:integ1-lambda_function_1

rest_api/rest_api_1:
children:
- aws:api_deployment:rest_api_1:api_deployment-0
Expand All @@ -28,19 +30,17 @@ resources:
- aws:api_stage:rest_api_1:api_stage-0
tag: parent

aws:api_integration:rest_api_1/integ0:
parent: rest_api/rest_api_1
lambda_function/lambda_function_0:
children:
- aws:ecr_image:lambda_function_0-image
- aws:ecr_repo:lambda_function_0-image-ecr_repo
- aws:iam_role:lambda_function_0-ExecutionRole
tag: big

aws:api_integration:rest_api_1/integ0 -> lambda_function/lambda_function_0:
path:
- aws:lambda_permission:integ0-lambda_function_0

aws:api_integration:rest_api_1/integ1:
parent: rest_api/rest_api_1
lambda_function/lambda_function_1:
children:
- aws:ecr_image:lambda_function_1-image
- aws:ecr_repo:lambda_function_1-image-ecr_repo
- aws:iam_role:lambda_function_1-ExecutionRole
tag: big

aws:api_integration:rest_api_1/integ1 -> lambda_function/lambda_function_1:
path:
- aws:lambda_permission:integ1-lambda_function_1

116 changes: 58 additions & 58 deletions pkg/engine/testdata/2_routes.iac-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
provider: aws
resources:
ecr_repo/lambda_function_0-image-ecr_repo:

ecr_repo/lambda_function_1-image-ecr_repo:

log_group/lambda_function_0-log-group:
aws:api_stage:rest_api_1/api_stage-0:

log_group/lambda_function_1-log-group:
aws:api_stage:rest_api_1/api_stage-0 -> aws:api_deployment:rest_api_1/api_deployment-0:
aws:api_stage:rest_api_1/api_stage-0 -> rest_api/rest_api_1:
aws:api_deployment:rest_api_1/api_deployment-0:

rest_api/rest_api_1:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_integration:rest_api_1/integ0:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_integration:rest_api_1/integ1:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/integ0-api_method:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/integ1-api_method:
aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1:
aws:api_integration:rest_api_1/integ0:

ecr_image/lambda_function_0-image:
aws:api_integration:rest_api_1/integ0 -> aws:api_method:rest_api_1/integ0-api_method:
aws:api_integration:rest_api_1/integ0 -> aws:api_resource:rest_api_1/api_resource-0:
aws:api_integration:rest_api_1/integ0 -> lambda_function/lambda_function_0:
aws:api_integration:rest_api_1/integ0 -> lambda_permission/integ0-lambda_function_0:
aws:api_integration:rest_api_1/integ0 -> rest_api/rest_api_1:
aws:api_integration:rest_api_1/integ1:

ecr_image/lambda_function_0-image -> ecr_repo/lambda_function_0-image-ecr_repo:
ecr_image/lambda_function_1-image:
aws:api_integration:rest_api_1/integ1 -> aws:api_method:rest_api_1/integ1-api_method:
aws:api_integration:rest_api_1/integ1 -> aws:api_resource:rest_api_1/api_resource-1:
aws:api_integration:rest_api_1/integ1 -> lambda_function/lambda_function_1:
aws:api_integration:rest_api_1/integ1 -> lambda_permission/integ1-lambda_function_1:
aws:api_integration:rest_api_1/integ1 -> rest_api/rest_api_1:
aws:api_method:rest_api_1/integ0-api_method:

ecr_image/lambda_function_1-image -> ecr_repo/lambda_function_1-image-ecr_repo:
iam_role/lambda_function_0-executionrole:
aws:api_method:rest_api_1/integ0-api_method -> aws:api_resource:rest_api_1/api_resource-0:
aws:api_method:rest_api_1/integ0-api_method -> rest_api/rest_api_1:
lambda_permission/integ0-lambda_function_0:

iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group:
iam_role/lambda_function_1-executionrole:
lambda_permission/integ0-lambda_function_0 -> lambda_function/lambda_function_0:
lambda_permission/integ0-lambda_function_0 -> rest_api/rest_api_1:
aws:api_method:rest_api_1/integ1-api_method:

iam_role/lambda_function_1-executionrole -> log_group/lambda_function_1-log-group:
aws:api_resource:rest_api_1/lambda0:
aws:api_method:rest_api_1/integ1-api_method -> aws:api_resource:rest_api_1/api_resource-1:
aws:api_method:rest_api_1/integ1-api_method -> rest_api/rest_api_1:
lambda_permission/integ1-lambda_function_1:

aws:api_resource:rest_api_1/lambda0 -> rest_api/rest_api_1:
aws:api_resource:rest_api_1/lambda1:
lambda_permission/integ1-lambda_function_1 -> lambda_function/lambda_function_1:
lambda_permission/integ1-lambda_function_1 -> rest_api/rest_api_1:
aws:api_resource:rest_api_1/api_resource-0:

aws:api_resource:rest_api_1/lambda1 -> rest_api/rest_api_1:
aws:api_resource:rest_api_1/api_resource-0 -> aws:api_resource:rest_api_1/lambda0:
aws:api_resource:rest_api_1/api_resource-0 -> rest_api/rest_api_1:
lambda_function/lambda_function_0:

lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image:
lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole:
aws:api_resource:rest_api_1/api_resource-1:

aws:api_resource:rest_api_1/api_resource-1 -> aws:api_resource:rest_api_1/lambda1:
aws:api_resource:rest_api_1/api_resource-1 -> rest_api/rest_api_1:
lambda_function/lambda_function_1:

lambda_function/lambda_function_1 -> ecr_image/lambda_function_1-image:
lambda_function/lambda_function_1 -> iam_role/lambda_function_1-executionrole:
aws:api_resource:rest_api_1/api_resource-0:
aws:api_resource:rest_api_1/lambda0:

aws:api_resource:rest_api_1/api_resource-0 -> aws:api_resource:rest_api_1/lambda0:
aws:api_resource:rest_api_1/api_resource-0 -> rest_api/rest_api_1:
aws:api_resource:rest_api_1/api_resource-1:
aws:api_resource:rest_api_1/lambda0 -> rest_api/rest_api_1:
ecr_image/lambda_function_0-image:

aws:api_resource:rest_api_1/api_resource-1 -> aws:api_resource:rest_api_1/lambda1:
aws:api_resource:rest_api_1/api_resource-1 -> rest_api/rest_api_1:
lambda_permission/integ0-lambda_function_0:
ecr_image/lambda_function_0-image -> ecr_repo/lambda_function_0-image-ecr_repo:
iam_role/lambda_function_0-executionrole:

lambda_permission/integ0-lambda_function_0 -> lambda_function/lambda_function_0:
lambda_permission/integ0-lambda_function_0 -> rest_api/rest_api_1:
lambda_permission/integ1-lambda_function_1:
iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group:
aws:api_resource:rest_api_1/lambda1:

lambda_permission/integ1-lambda_function_1 -> lambda_function/lambda_function_1:
lambda_permission/integ1-lambda_function_1 -> rest_api/rest_api_1:
aws:api_method:rest_api_1/integ0-api_method:
aws:api_resource:rest_api_1/lambda1 -> rest_api/rest_api_1:
ecr_image/lambda_function_1-image:

aws:api_method:rest_api_1/integ0-api_method -> aws:api_resource:rest_api_1/api_resource-0:
aws:api_method:rest_api_1/integ0-api_method -> rest_api/rest_api_1:
aws:api_method:rest_api_1/integ1-api_method:
ecr_image/lambda_function_1-image -> ecr_repo/lambda_function_1-image-ecr_repo:
iam_role/lambda_function_1-executionrole:

aws:api_method:rest_api_1/integ1-api_method -> aws:api_resource:rest_api_1/api_resource-1:
aws:api_method:rest_api_1/integ1-api_method -> rest_api/rest_api_1:
aws:api_integration:rest_api_1/integ0:
iam_role/lambda_function_1-executionrole -> log_group/lambda_function_1-log-group:
ecr_repo/lambda_function_0-image-ecr_repo:

aws:api_integration:rest_api_1/integ0 -> aws:api_method:rest_api_1/integ0-api_method:
aws:api_integration:rest_api_1/integ0 -> aws:api_resource:rest_api_1/api_resource-0:
aws:api_integration:rest_api_1/integ0 -> lambda_function/lambda_function_0:
aws:api_integration:rest_api_1/integ0 -> lambda_permission/integ0-lambda_function_0:
aws:api_integration:rest_api_1/integ0 -> rest_api/rest_api_1:
aws:api_integration:rest_api_1/integ1:
log_group/lambda_function_0-log-group:

aws:api_integration:rest_api_1/integ1 -> aws:api_method:rest_api_1/integ1-api_method:
aws:api_integration:rest_api_1/integ1 -> aws:api_resource:rest_api_1/api_resource-1:
aws:api_integration:rest_api_1/integ1 -> lambda_function/lambda_function_1:
aws:api_integration:rest_api_1/integ1 -> lambda_permission/integ1-lambda_function_1:
aws:api_integration:rest_api_1/integ1 -> rest_api/rest_api_1:
aws:api_deployment:rest_api_1/api_deployment-0:
rest_api/rest_api_1:

aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_integration:rest_api_1/integ0:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_integration:rest_api_1/integ1:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/integ0-api_method:
aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/integ1-api_method:
aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1:
aws:api_stage:rest_api_1/api_stage-0:
ecr_repo/lambda_function_1-image-ecr_repo:

log_group/lambda_function_1-log-group:

aws:api_stage:rest_api_1/api_stage-0 -> aws:api_deployment:rest_api_1/api_deployment-0:
aws:api_stage:rest_api_1/api_stage-0 -> rest_api/rest_api_1:
18 changes: 9 additions & 9 deletions pkg/engine/testdata/cf_distribution.dataflow-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
provider: aws
resources:
rest_api/rest_api_1:
children:
- aws:api_deployment:rest_api_1:api_deployment-0
- aws:api_stage:rest_api_1:cloudfront_distribution_2-rest_api_1
tag: parent

s3_bucket/s3-bucket-3:
tag: big

cloudfront_distribution/cloudfront_distribution_2:
tag: big

Expand All @@ -21,3 +12,12 @@ resources:
- aws:cloudfront_origin_access_identity:cloudfront_origin_access_identity-0
- aws:s3_bucket_policy:s3_bucket_policy-0

rest_api/rest_api_1:
children:
- aws:api_deployment:rest_api_1:api_deployment-0
- aws:api_stage:rest_api_1:cloudfront_distribution_2-rest_api_1
tag: parent

s3_bucket/s3-bucket-3:
tag: big

24 changes: 12 additions & 12 deletions pkg/engine/testdata/cf_distribution.iac-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
provider: aws
resources:
cloudfront_origin_access_identity/cloudfront_origin_access_identity-0:

rest_api/rest_api_1:

s3_bucket/s3-bucket-3:

aws:api_deployment:rest_api_1/api_deployment-0:
cloudfront_distribution/cloudfront_distribution_2:

aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1:
cloudfront_distribution/cloudfront_distribution_2 -> aws:api_stage:rest_api_1/cloudfront_distribution_2-rest_api_1:
cloudfront_distribution/cloudfront_distribution_2 -> cloudfront_origin_access_identity/cloudfront_origin_access_identity-0:
cloudfront_distribution/cloudfront_distribution_2 -> s3_bucket/s3-bucket-3:
s3_bucket_policy/s3_bucket_policy-0:

s3_bucket_policy/s3_bucket_policy-0 -> cloudfront_origin_access_identity/cloudfront_origin_access_identity-0:
Expand All @@ -17,8 +13,12 @@ resources:

aws:api_stage:rest_api_1/cloudfront_distribution_2-rest_api_1 -> aws:api_deployment:rest_api_1/api_deployment-0:
aws:api_stage:rest_api_1/cloudfront_distribution_2-rest_api_1 -> rest_api/rest_api_1:
cloudfront_distribution/cloudfront_distribution_2:
cloudfront_origin_access_identity/cloudfront_origin_access_identity-0:

s3_bucket/s3-bucket-3:

aws:api_deployment:rest_api_1/api_deployment-0:

aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1:
rest_api/rest_api_1:

cloudfront_distribution/cloudfront_distribution_2 -> aws:api_stage:rest_api_1/cloudfront_distribution_2-rest_api_1:
cloudfront_distribution/cloudfront_distribution_2 -> cloudfront_origin_access_identity/cloudfront_origin_access_identity-0:
cloudfront_distribution/cloudfront_distribution_2 -> s3_bucket/s3-bucket-3:
52 changes: 26 additions & 26 deletions pkg/engine/testdata/delete_api_to_lambda_edge.iac-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
provider: aws
resources:
ecr_repo/ecr_repo-0:

log_group/lambda_function_2-log-group:

rest_api/rest_api_0:
aws:api_stage:rest_api_0/api_stage-0:

ecr_image/lambda_function_2-image:
aws:api_stage:rest_api_0/api_stage-0 -> aws:api_deployment:rest_api_0/api_deployment-0:
aws:api_stage:rest_api_0/api_stage-0 -> rest_api/rest_api_0:
aws:api_deployment:rest_api_0/api_deployment-0:

ecr_image/lambda_function_2-image -> ecr_repo/ecr_repo-0:
iam_role/lambda_function_2-executionrole:
aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_integration:rest_api_0/rest_api_0_integration_0:
aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_method:rest_api_0/rest_api_0_integration_0_method:
aws:api_deployment:rest_api_0/api_deployment-0 -> rest_api/rest_api_0:
aws:api_integration:rest_api_0/rest_api_0_integration_0:

iam_role/lambda_function_2-executionrole -> log_group/lambda_function_2-log-group:
aws:api_resource:rest_api_0/api_resource-0:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> aws:api_method:rest_api_0/rest_api_0_integration_0_method:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> aws:api_resource:rest_api_0/api_resource-0:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> lambda_function/lambda_function_2:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> rest_api/rest_api_0:
aws:api_method:rest_api_0/rest_api_0_integration_0_method:

aws:api_resource:rest_api_0/api_resource-0 -> rest_api/rest_api_0:
aws:api_method:rest_api_0/rest_api_0_integration_0_method -> aws:api_resource:rest_api_0/api_resource-0:
aws:api_method:rest_api_0/rest_api_0_integration_0_method -> rest_api/rest_api_0:
lambda_function/lambda_function_2:

lambda_function/lambda_function_2 -> ecr_image/lambda_function_2-image:
lambda_function/lambda_function_2 -> iam_role/lambda_function_2-executionrole:
lambda_function/lambda_function_2 -> log_group/lambda_function_2-log-group:
aws:api_method:rest_api_0/rest_api_0_integration_0_method:
aws:api_resource:rest_api_0/api_resource-0:

aws:api_method:rest_api_0/rest_api_0_integration_0_method -> aws:api_resource:rest_api_0/api_resource-0:
aws:api_method:rest_api_0/rest_api_0_integration_0_method -> rest_api/rest_api_0:
aws:api_integration:rest_api_0/rest_api_0_integration_0:
aws:api_resource:rest_api_0/api_resource-0 -> rest_api/rest_api_0:
ecr_image/lambda_function_2-image:

aws:api_integration:rest_api_0/rest_api_0_integration_0 -> aws:api_method:rest_api_0/rest_api_0_integration_0_method:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> aws:api_resource:rest_api_0/api_resource-0:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> lambda_function/lambda_function_2:
aws:api_integration:rest_api_0/rest_api_0_integration_0 -> rest_api/rest_api_0:
aws:api_deployment:rest_api_0/api_deployment-0:
ecr_image/lambda_function_2-image -> ecr_repo/ecr_repo-0:
iam_role/lambda_function_2-executionrole:

aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_integration:rest_api_0/rest_api_0_integration_0:
aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_method:rest_api_0/rest_api_0_integration_0_method:
aws:api_deployment:rest_api_0/api_deployment-0 -> rest_api/rest_api_0:
aws:api_stage:rest_api_0/api_stage-0:
iam_role/lambda_function_2-executionrole -> log_group/lambda_function_2-log-group:
rest_api/rest_api_0:

ecr_repo/ecr_repo-0:

log_group/lambda_function_2-log-group:

aws:api_stage:rest_api_0/api_stage-0 -> aws:api_deployment:rest_api_0/api_deployment-0:
aws:api_stage:rest_api_0/api_stage-0 -> rest_api/rest_api_0:
14 changes: 7 additions & 7 deletions pkg/engine/testdata/delete_namespace_resource.iac-viz.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
provider: aws
resources:
ecr_repo/ecr_repo-0:

log_group/lambda_function_2-log-group:
lambda_function/lambda_function_2:

lambda_function/lambda_function_2 -> ecr_image/lambda_function_2-image:
lambda_function/lambda_function_2 -> iam_role/lambda_function_2-executionrole:
lambda_function/lambda_function_2 -> log_group/lambda_function_2-log-group:
ecr_image/lambda_function_2-image:

ecr_image/lambda_function_2-image -> ecr_repo/ecr_repo-0:
iam_role/lambda_function_2-executionrole:

iam_role/lambda_function_2-executionrole -> log_group/lambda_function_2-log-group:
lambda_function/lambda_function_2:
ecr_repo/ecr_repo-0:

log_group/lambda_function_2-log-group:

lambda_function/lambda_function_2 -> ecr_image/lambda_function_2-image:
lambda_function/lambda_function_2 -> iam_role/lambda_function_2-executionrole:
lambda_function/lambda_function_2 -> log_group/lambda_function_2-log-group:
Loading

0 comments on commit 24f68e6

Please sign in to comment.