From 24f68e6a7c07b9563ff144efe8a4a18bd1b47e4f Mon Sep 17 00:00:00 2001 From: Gordon Date: Wed, 6 Mar 2024 13:34:50 -0500 Subject: [PATCH] Use TopologicalSort for viz yaml same as resources.yaml --- .gitignore | 1 + .../testdata/2_routes.dataflow-viz.yaml | 44 +-- pkg/engine/testdata/2_routes.iac-viz.yaml | 116 ++++---- .../cf_distribution.dataflow-viz.yaml | 18 +- .../testdata/cf_distribution.iac-viz.yaml | 24 +- .../delete_api_to_lambda_edge.iac-viz.yaml | 52 ++-- .../delete_namespace_resource.iac-viz.yaml | 14 +- .../delete_resource_and_iacdeps.iac-viz.yaml | 30 +- pkg/engine/testdata/ecs_rds.dataflow-viz.yaml | 28 +- pkg/engine/testdata/ecs_rds.iac-viz.yaml | 144 ++++----- .../testdata/extend_graph.dataflow-viz.yaml | 24 +- pkg/engine/testdata/extend_graph.iac-viz.yaml | 54 ++-- .../idempotent_constraints.dataflow-viz.yaml | 28 +- .../idempotent_constraints.iac-viz.yaml | 162 +++++------ pkg/engine/testdata/k8s_api.dataflow-viz.yaml | 30 +- pkg/engine/testdata/k8s_api.iac-viz.yaml | 274 +++++++++--------- .../testdata/lambda_efs.dataflow-viz.yaml | 32 +- pkg/engine/testdata/lambda_efs.iac-viz.yaml | 148 +++++----- .../namespace_pathselect.iac-viz.yaml | 116 ++++---- .../testdata/remove_path.dataflow-viz.yaml | 32 +- pkg/engine/testdata/remove_path.iac-viz.yaml | 178 ++++++------ pkg/engine/testdata/rename.dataflow-viz.yaml | 6 +- pkg/engine/testdata/rename.iac-viz.yaml | 20 +- .../same_path_multiple_methods.iac-viz.yaml | 58 ++-- .../testdata/single_lambda.iac-viz.yaml | 12 +- .../testdata/static_site.dataflow-viz.yaml | 6 +- pkg/engine/testdata/static_site.iac-viz.yaml | 8 +- pkg/engine/testdata/vpc_import.iac-viz.yaml | 4 +- .../vpc_import_to_lambda.iac-viz.yaml | 26 +- ...c_import_wo_subnets_to_lambda.iac-viz.yaml | 96 +++--- pkg/graph_addons/topology.go | 7 +- pkg/visualizer/file.go | 2 +- 32 files changed, 897 insertions(+), 897 deletions(-) diff --git a/.gitignore b/.gitignore index 9c2160079..043e0b9ed 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ go.work.sum *.key /logs +__debug_bin* diff --git a/pkg/engine/testdata/2_routes.dataflow-viz.yaml b/pkg/engine/testdata/2_routes.dataflow-viz.yaml index a41254ee2..2b59e34c4 100755 --- a/pkg/engine/testdata/2_routes.dataflow-viz.yaml +++ b/pkg/engine/testdata/2_routes.dataflow-viz.yaml @@ -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 @@ -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 - diff --git a/pkg/engine/testdata/2_routes.iac-viz.yaml b/pkg/engine/testdata/2_routes.iac-viz.yaml index 44766bcbf..e2d0f1b29 100755 --- a/pkg/engine/testdata/2_routes.iac-viz.yaml +++ b/pkg/engine/testdata/2_routes.iac-viz.yaml @@ -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: diff --git a/pkg/engine/testdata/cf_distribution.dataflow-viz.yaml b/pkg/engine/testdata/cf_distribution.dataflow-viz.yaml index 1ac5bbe9e..929c5cd21 100755 --- a/pkg/engine/testdata/cf_distribution.dataflow-viz.yaml +++ b/pkg/engine/testdata/cf_distribution.dataflow-viz.yaml @@ -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 @@ -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 + diff --git a/pkg/engine/testdata/cf_distribution.iac-viz.yaml b/pkg/engine/testdata/cf_distribution.iac-viz.yaml index debe3f01d..d2233c2b5 100755 --- a/pkg/engine/testdata/cf_distribution.iac-viz.yaml +++ b/pkg/engine/testdata/cf_distribution.iac-viz.yaml @@ -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: @@ -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: diff --git a/pkg/engine/testdata/delete_api_to_lambda_edge.iac-viz.yaml b/pkg/engine/testdata/delete_api_to_lambda_edge.iac-viz.yaml index 5a0444558..3e3ae8e87 100644 --- a/pkg/engine/testdata/delete_api_to_lambda_edge.iac-viz.yaml +++ b/pkg/engine/testdata/delete_api_to_lambda_edge.iac-viz.yaml @@ -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: diff --git a/pkg/engine/testdata/delete_namespace_resource.iac-viz.yaml b/pkg/engine/testdata/delete_namespace_resource.iac-viz.yaml index 44854cd8a..b20ce20da 100644 --- a/pkg/engine/testdata/delete_namespace_resource.iac-viz.yaml +++ b/pkg/engine/testdata/delete_namespace_resource.iac-viz.yaml @@ -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: diff --git a/pkg/engine/testdata/delete_resource_and_iacdeps.iac-viz.yaml b/pkg/engine/testdata/delete_resource_and_iacdeps.iac-viz.yaml index 815290ed0..47dc69944 100644 --- a/pkg/engine/testdata/delete_resource_and_iacdeps.iac-viz.yaml +++ b/pkg/engine/testdata/delete_resource_and_iacdeps.iac-viz.yaml @@ -1,27 +1,27 @@ provider: aws resources: - ecs_cluster/ecs_cluster-0: - - rest_api/rest_api_0: + aws:api_stage:rest_api_0/api_stage-0: - aws:api_resource:rest_api_0/api_resource-0: + 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: + ecs_cluster/ecs_cluster-0: - 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_deployment:rest_api_0/api_deployment-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_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: 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 -> rest_api/rest_api_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 -> 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: + 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_resource:rest_api_0/api_resource-0: + + aws:api_resource:rest_api_0/api_resource-0 -> rest_api/rest_api_0: + rest_api/rest_api_0: - 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: diff --git a/pkg/engine/testdata/ecs_rds.dataflow-viz.yaml b/pkg/engine/testdata/ecs_rds.dataflow-viz.yaml index a0fe5394e..e3062f6fd 100755 --- a/pkg/engine/testdata/ecs_rds.dataflow-viz.yaml +++ b/pkg/engine/testdata/ecs_rds.dataflow-viz.yaml @@ -1,11 +1,21 @@ provider: aws resources: - rds_instance/rds-instance-2: + ecs_service/ecs_service_0: children: - - aws:rds_subnet_group:rds_subnet_group-0 + - aws:ecr_image:ecs_service_0-ecs_service_0 + - aws:ecr_repo:ecs_service_0-ecs_service_0-ecr_repo + - aws:ecs_task_definition:ecs_service_0 + - aws:iam_role:ecs_service_0-execution-role + - aws:log_group:ecs_service_0-log-group parent: vpc/vpc-0 tag: big + ecs_service/ecs_service_0 -> rds_instance/rds-instance-2: + path: + - aws:ecs_task_definition:ecs_service_0 + - aws:iam_role:ecs_service_0-execution-role + - aws:security_group:vpc-0:rds-instance-2-security_group + vpc/vpc-0: children: - aws:internet_gateway:vpc-0:internet_gateway-0 @@ -21,19 +31,9 @@ resources: - aws:subnet:vpc-0:subnet-3 tag: parent - ecs_service/ecs_service_0: + rds_instance/rds-instance-2: children: - - aws:ecr_image:ecs_service_0-ecs_service_0 - - aws:ecr_repo:ecs_service_0-ecs_service_0-ecr_repo - - aws:ecs_task_definition:ecs_service_0 - - aws:iam_role:ecs_service_0-execution-role - - aws:log_group:ecs_service_0-log-group + - aws:rds_subnet_group:rds_subnet_group-0 parent: vpc/vpc-0 tag: big - ecs_service/ecs_service_0 -> rds_instance/rds-instance-2: - path: - - aws:ecs_task_definition:ecs_service_0 - - aws:iam_role:ecs_service_0-execution-role - - aws:security_group:vpc-0:rds-instance-2-security_group - diff --git a/pkg/engine/testdata/ecs_rds.iac-viz.yaml b/pkg/engine/testdata/ecs_rds.iac-viz.yaml index 2d0324247..fbc362c6a 100755 --- a/pkg/engine/testdata/ecs_rds.iac-viz.yaml +++ b/pkg/engine/testdata/ecs_rds.iac-viz.yaml @@ -1,45 +1,48 @@ provider: aws resources: - ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: - - ecs_cluster/ecs_cluster-0: - - elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: - - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - - log_group/ecs_service_0-log-group: + ecs_service/ecs_service_0: - region/region-0: + ecs_service/ecs_service_0 -> ecs_cluster/ecs_cluster-0: + ecs_service/ecs_service_0 -> ecs_task_definition/ecs_service_0: + ecs_service/ecs_service_0 -> aws:security_group:vpc-0/ecs_service_0-security_group: + ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-0: + ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-0-subnet-0-route_table: - vpc/vpc-0: + route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: + route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: + route_table_association/subnet-1-subnet-1-route_table: - ecr_image/ecs_service_0-ecs_service_0: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - ecr_image/ecs_service_0-ecs_service_0 -> ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: - aws:availability_zone:region-0/availability_zone-0: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: + ecs_cluster/ecs_cluster-0: - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc-0/internet_gateway-0: + ecs_task_definition/ecs_service_0: - aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + ecs_task_definition/ecs_service_0 -> ecr_image/ecs_service_0-ecs_service_0: + ecs_task_definition/ecs_service_0 -> iam_role/ecs_service_0-execution-role: + ecs_task_definition/ecs_service_0 -> log_group/ecs_service_0-log-group: + ecs_task_definition/ecs_service_0 -> rds_instance/rds-instance-2: + ecs_task_definition/ecs_service_0 -> region/region-0: aws:security_group:vpc-0/ecs_service_0-security_group: aws:security_group:vpc-0/ecs_service_0-security_group -> vpc/vpc-0: - aws:security_group:vpc-0/rds-instance-2-security_group: - - aws:security_group:vpc-0/rds-instance-2-security_group -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-2: + aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-3: + aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: aws:route_table:vpc-0/subnet-2-route_table: aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: @@ -48,16 +51,14 @@ resources: aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-0: + ecr_image/ecs_service_0-ecs_service_0: - aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-2-security_group: - aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-1: + ecr_image/ecs_service_0-ecs_service_0 -> ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: + iam_role/ecs_service_0-execution-role: + + iam_role/ecs_service_0-execution-role -> rds_instance/rds-instance-2: + log_group/ecs_service_0-log-group: - aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-2-security_group: - aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: @@ -66,52 +67,51 @@ resources: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-3: - route_table_association/subnet-2-subnet-2-route_table: + aws:internet_gateway:vpc-0/internet_gateway-0: - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: - route_table_association/subnet-3-subnet-3-route_table: + aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: + rds_instance/rds-instance-2: + + rds_instance/rds-instance-2 -> rds_subnet_group/rds_subnet_group-0: + rds_instance/rds-instance-2 -> aws:security_group:vpc-0/rds-instance-2-security_group: + elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: + + aws:subnet:vpc-0/subnet-2: + + aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + + aws:subnet:vpc-0/subnet-3: + + aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: rds_subnet_group/rds_subnet_group-0: rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-0: rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-1: - aws:route_table:vpc-0/subnet-0-route_table: - - aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-0: - aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: - rds_instance/rds-instance-2: + aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-2-security_group: + aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1: - rds_instance/rds-instance-2 -> rds_subnet_group/rds_subnet_group-0: - rds_instance/rds-instance-2 -> aws:security_group:vpc-0/rds-instance-2-security_group: - route_table_association/subnet-0-subnet-0-route_table: + aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-2-security_group: + aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-0: - route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: - route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: - route_table_association/subnet-1-subnet-1-route_table: + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:availability_zone:region-0/availability_zone-1: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: - iam_role/ecs_service_0-execution-role: + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + aws:security_group:vpc-0/rds-instance-2-security_group: - iam_role/ecs_service_0-execution-role -> rds_instance/rds-instance-2: - ecs_task_definition/ecs_service_0: + aws:security_group:vpc-0/rds-instance-2-security_group -> vpc/vpc-0: + region/region-0: - ecs_task_definition/ecs_service_0 -> ecr_image/ecs_service_0-ecs_service_0: - ecs_task_definition/ecs_service_0 -> iam_role/ecs_service_0-execution-role: - ecs_task_definition/ecs_service_0 -> log_group/ecs_service_0-log-group: - ecs_task_definition/ecs_service_0 -> rds_instance/rds-instance-2: - ecs_task_definition/ecs_service_0 -> region/region-0: - ecs_service/ecs_service_0: + vpc/vpc-0: - ecs_service/ecs_service_0 -> ecs_cluster/ecs_cluster-0: - ecs_service/ecs_service_0 -> ecs_task_definition/ecs_service_0: - ecs_service/ecs_service_0 -> aws:security_group:vpc-0/ecs_service_0-security_group: - ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-0: - ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-1: diff --git a/pkg/engine/testdata/extend_graph.dataflow-viz.yaml b/pkg/engine/testdata/extend_graph.dataflow-viz.yaml index ff5831e3b..4e464a948 100755 --- a/pkg/engine/testdata/extend_graph.dataflow-viz.yaml +++ b/pkg/engine/testdata/extend_graph.dataflow-viz.yaml @@ -1,13 +1,14 @@ provider: aws resources: - dynamodb_table/dynamodb_table_3: + aws:api_integration:rest_api_1/rest_api_1_integration_0: + parent: rest_api/rest_api_1 tag: big - lambda_function/lambda_function_0: - children: - - aws:ecr_image:lambda_function_0-image - - aws:ecr_repo:ecr_repo-0 - - aws:iam_role:lambda_function_0-ExecutionRole + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_function/lambda_function_0: + path: + - aws:lambda_permission:rest_api_1_integration_0_lambda_function_0 + + dynamodb_table/dynamodb_table_3: tag: big rest_api/rest_api_1: @@ -19,11 +20,10 @@ resources: - aws:api_stage:rest_api_1:api_stage-0 tag: parent - aws:api_integration:rest_api_1/rest_api_1_integration_0: - parent: rest_api/rest_api_1 + lambda_function/lambda_function_0: + children: + - aws:ecr_image:lambda_function_0-image + - aws:ecr_repo:ecr_repo-0 + - aws:iam_role:lambda_function_0-ExecutionRole tag: big - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_function/lambda_function_0: - path: - - aws:lambda_permission:rest_api_1_integration_0_lambda_function_0 - diff --git a/pkg/engine/testdata/extend_graph.iac-viz.yaml b/pkg/engine/testdata/extend_graph.iac-viz.yaml index 1e27e316a..f52a11b18 100755 --- a/pkg/engine/testdata/extend_graph.iac-viz.yaml +++ b/pkg/engine/testdata/extend_graph.iac-viz.yaml @@ -1,19 +1,31 @@ provider: aws resources: - dynamodb_table/dynamodb_table_3: + aws:api_stage:rest_api_1/api_stage-0: - ecr_repo/ecr_repo-0: + 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: + dynamodb_table/dynamodb_table_3: - log_group/lambda_function_0-log-group: + 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/rest_api_1_integration_0: + aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/rest_api_1_integration_0_method: + aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1: + aws:api_integration:rest_api_1/rest_api_1_integration_0: - ecr_image/lambda_function_0-image: + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> aws:api_method:rest_api_1/rest_api_1_integration_0_method: + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> aws:api_resource:rest_api_1/api_resource-0: + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_function/lambda_function_0: + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_permission/rest_api_1_integration_0_lambda_function_0: + aws:api_integration:rest_api_1/rest_api_1_integration_0 -> rest_api/rest_api_1: + aws:api_method:rest_api_1/rest_api_1_integration_0_method: - ecr_image/lambda_function_0-image -> ecr_repo/ecr_repo-0: - iam_role/lambda_function_0-executionrole: + aws:api_method:rest_api_1/rest_api_1_integration_0_method -> aws:api_resource:rest_api_1/api_resource-0: + aws:api_method:rest_api_1/rest_api_1_integration_0_method -> rest_api/rest_api_1: + lambda_permission/rest_api_1_integration_0_lambda_function_0: - iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: + lambda_permission/rest_api_1_integration_0_lambda_function_0 -> lambda_function/lambda_function_0: + lambda_permission/rest_api_1_integration_0_lambda_function_0 -> rest_api/rest_api_1: aws:api_resource:rest_api_1/api_resource-0: aws:api_resource:rest_api_1/api_resource-0 -> rest_api/rest_api_1: @@ -22,27 +34,15 @@ resources: lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: lambda_function/lambda_function_0 -> log_group/lambda_function_0-log-group: - aws:api_method:rest_api_1/rest_api_1_integration_0_method: + rest_api/rest_api_1: - aws:api_method:rest_api_1/rest_api_1_integration_0_method -> aws:api_resource:rest_api_1/api_resource-0: - aws:api_method:rest_api_1/rest_api_1_integration_0_method -> rest_api/rest_api_1: - lambda_permission/rest_api_1_integration_0_lambda_function_0: + ecr_image/lambda_function_0-image: - lambda_permission/rest_api_1_integration_0_lambda_function_0 -> lambda_function/lambda_function_0: - lambda_permission/rest_api_1_integration_0_lambda_function_0 -> rest_api/rest_api_1: - aws:api_integration:rest_api_1/rest_api_1_integration_0: + ecr_image/lambda_function_0-image -> ecr_repo/ecr_repo-0: + iam_role/lambda_function_0-executionrole: - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> aws:api_method:rest_api_1/rest_api_1_integration_0_method: - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> aws:api_resource:rest_api_1/api_resource-0: - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_function/lambda_function_0: - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> lambda_permission/rest_api_1_integration_0_lambda_function_0: - aws:api_integration:rest_api_1/rest_api_1_integration_0 -> rest_api/rest_api_1: - aws:api_deployment:rest_api_1/api_deployment-0: + iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: + ecr_repo/ecr_repo-0: - aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_integration:rest_api_1/rest_api_1_integration_0: - aws:api_deployment:rest_api_1/api_deployment-0 -> aws:api_method:rest_api_1/rest_api_1_integration_0_method: - aws:api_deployment:rest_api_1/api_deployment-0 -> rest_api/rest_api_1: - aws:api_stage:rest_api_1/api_stage-0: + log_group/lambda_function_0-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: diff --git a/pkg/engine/testdata/idempotent_constraints.dataflow-viz.yaml b/pkg/engine/testdata/idempotent_constraints.dataflow-viz.yaml index a0fe5394e..e3062f6fd 100755 --- a/pkg/engine/testdata/idempotent_constraints.dataflow-viz.yaml +++ b/pkg/engine/testdata/idempotent_constraints.dataflow-viz.yaml @@ -1,11 +1,21 @@ provider: aws resources: - rds_instance/rds-instance-2: + ecs_service/ecs_service_0: children: - - aws:rds_subnet_group:rds_subnet_group-0 + - aws:ecr_image:ecs_service_0-ecs_service_0 + - aws:ecr_repo:ecs_service_0-ecs_service_0-ecr_repo + - aws:ecs_task_definition:ecs_service_0 + - aws:iam_role:ecs_service_0-execution-role + - aws:log_group:ecs_service_0-log-group parent: vpc/vpc-0 tag: big + ecs_service/ecs_service_0 -> rds_instance/rds-instance-2: + path: + - aws:ecs_task_definition:ecs_service_0 + - aws:iam_role:ecs_service_0-execution-role + - aws:security_group:vpc-0:rds-instance-2-security_group + vpc/vpc-0: children: - aws:internet_gateway:vpc-0:internet_gateway-0 @@ -21,19 +31,9 @@ resources: - aws:subnet:vpc-0:subnet-3 tag: parent - ecs_service/ecs_service_0: + rds_instance/rds-instance-2: children: - - aws:ecr_image:ecs_service_0-ecs_service_0 - - aws:ecr_repo:ecs_service_0-ecs_service_0-ecr_repo - - aws:ecs_task_definition:ecs_service_0 - - aws:iam_role:ecs_service_0-execution-role - - aws:log_group:ecs_service_0-log-group + - aws:rds_subnet_group:rds_subnet_group-0 parent: vpc/vpc-0 tag: big - ecs_service/ecs_service_0 -> rds_instance/rds-instance-2: - path: - - aws:ecs_task_definition:ecs_service_0 - - aws:iam_role:ecs_service_0-execution-role - - aws:security_group:vpc-0:rds-instance-2-security_group - diff --git a/pkg/engine/testdata/idempotent_constraints.iac-viz.yaml b/pkg/engine/testdata/idempotent_constraints.iac-viz.yaml index 46f4137fb..4220dd69b 100755 --- a/pkg/engine/testdata/idempotent_constraints.iac-viz.yaml +++ b/pkg/engine/testdata/idempotent_constraints.iac-viz.yaml @@ -1,121 +1,121 @@ provider: aws resources: - ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: + ecs_service/ecs_service_0: - ecs_cluster/ecs_cluster-0: + ecs_service/ecs_service_0 -> ecs_cluster/ecs_cluster-0: + ecs_service/ecs_service_0 -> ecs_task_definition/ecs_service_0: + ecs_service/ecs_service_0 -> aws:security_group:vpc-0/ecs_service_0-security_group: + ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-0: + ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-0-subnet-0-route_table: - elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: + route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: + route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: + route_table_association/subnet-1-subnet-1-route_table: - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - log_group/ecs_service_0-log-group: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: - region/region-0: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: + ecs_cluster/ecs_cluster-0: - vpc/vpc-0: + ecs_task_definition/ecs_service_0: + + ecs_task_definition/ecs_service_0 -> ecr_image/ecs_service_0-ecs_service_0: + ecs_task_definition/ecs_service_0 -> iam_role/ecs_service_0-execution-role: + ecs_task_definition/ecs_service_0 -> log_group/ecs_service_0-log-group: + ecs_task_definition/ecs_service_0 -> rds_instance/rds-instance-2: + ecs_task_definition/ecs_service_0 -> region/region-0: + aws:security_group:vpc-0/ecs_service_0-security_group: + aws:security_group:vpc-0/ecs_service_0-security_group -> vpc/vpc-0: ecr_image/ecs_service_0-ecs_service_0: ecr_image/ecs_service_0-ecs_service_0 -> ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: - aws:availability_zone:region-0/availability_zone-0: + iam_role/ecs_service_0-execution-role: - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: + iam_role/ecs_service_0-execution-role -> rds_instance/rds-instance-2: + log_group/ecs_service_0-log-group: - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc-0/internet_gateway-0: + ecr_repo/ecs_service_0-ecs_service_0-ecr_repo: - aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: - aws:security_group:vpc-0/ecs_service_0-security_group: + rds_instance/rds-instance-2: - aws:security_group:vpc-0/ecs_service_0-security_group -> vpc/vpc-0: - aws:security_group:vpc-0/rds-instance-2-security_group: + rds_instance/rds-instance-2 -> rds_subnet_group/rds_subnet_group-0: + rds_instance/rds-instance-2 -> aws:security_group:vpc-0/rds-instance-2-security_group: + rds_subnet_group/rds_subnet_group-0: - aws:security_group:vpc-0/rds-instance-2-security_group -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-2-route_table: + rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-0: + rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-1: + aws:subnet:vpc-0/subnet-0: - aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: - aws:route_table:vpc-0/subnet-2-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-3-route_table: + aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-0 -> aws:route_table:vpc-0/subnet-0-route_table: + aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-2-security_group: + aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1: - aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: - aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-2: + aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-1 -> aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-2-security_group: + aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2 -> aws:route_table:vpc-0/subnet-2-route_table: - aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-3: + aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-3 -> aws:route_table:vpc-0/subnet-3-route_table: - aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: + aws:security_group:vpc-0/rds-instance-2-security_group: + + aws:security_group:vpc-0/rds-instance-2-security_group -> vpc/vpc-0: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-2: - route_table_association/subnet-2-subnet-2-route_table: - - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-3: - route_table_association/subnet-3-subnet-3-route_table: - - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: - aws:route_table:vpc-0/subnet-0-route_table: + elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-2: - aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-0: + aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-2 -> aws:route_table:vpc-0/subnet-2-route_table: + aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-0 -> aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-2-security_group: - aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-1: + aws:subnet:vpc-0/subnet-3: - aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-1 -> aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-2-security_group: - aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: - route_table_association/subnet-0-subnet-0-route_table: + aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-3 -> aws:route_table:vpc-0/subnet-3-route_table: + aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-0: - route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: - route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: - rds_subnet_group/rds_subnet_group-0: + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:route_table:vpc-0/subnet-2-route_table: - rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-0: - rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-1: - route_table_association/subnet-1-subnet-1-route_table: + aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: + aws:route_table:vpc-0/subnet-2-route_table -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-1: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: - rds_instance/rds-instance-2: + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + aws:route_table:vpc-0/subnet-3-route_table: - rds_instance/rds-instance-2 -> rds_subnet_group/rds_subnet_group-0: - rds_instance/rds-instance-2 -> aws:security_group:vpc-0/rds-instance-2-security_group: - iam_role/ecs_service_0-execution-role: + aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: + aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: + region/region-0: - iam_role/ecs_service_0-execution-role -> rds_instance/rds-instance-2: - ecs_task_definition/ecs_service_0: + aws:internet_gateway:vpc-0/internet_gateway-0: - ecs_task_definition/ecs_service_0 -> ecr_image/ecs_service_0-ecs_service_0: - ecs_task_definition/ecs_service_0 -> iam_role/ecs_service_0-execution-role: - ecs_task_definition/ecs_service_0 -> log_group/ecs_service_0-log-group: - ecs_task_definition/ecs_service_0 -> rds_instance/rds-instance-2: - ecs_task_definition/ecs_service_0 -> region/region-0: - ecs_service/ecs_service_0: + aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + vpc/vpc-0: - ecs_service/ecs_service_0 -> ecs_cluster/ecs_cluster-0: - ecs_service/ecs_service_0 -> ecs_task_definition/ecs_service_0: - ecs_service/ecs_service_0 -> aws:security_group:vpc-0/ecs_service_0-security_group: - ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-0: - ecs_service/ecs_service_0 -> aws:subnet:vpc-0/subnet-1: diff --git a/pkg/engine/testdata/k8s_api.dataflow-viz.yaml b/pkg/engine/testdata/k8s_api.dataflow-viz.yaml index e07f9c472..00ec16f11 100755 --- a/pkg/engine/testdata/k8s_api.dataflow-viz.yaml +++ b/pkg/engine/testdata/k8s_api.dataflow-viz.yaml @@ -1,5 +1,13 @@ provider: aws resources: + aws:api_integration:rest_api_4/rest_api_4_integration_0: + parent: rest_api/rest_api_4 + tag: big + + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> load_balancer/rest-api-4-integbcc77100: + path: + - aws:vpc_link:rest_api_4_integration_0-pod2 + eks_cluster/eks_cluster-0: children: - aws:iam_role:ClusterRole-eks_cluster-0 @@ -48,15 +56,6 @@ resources: parent: eks_cluster/eks_cluster-0 tag: big - kubernetes:pod:eks_cluster-0/pod2: - children: - - aws:ecr_image:pod2-ecr_image - - aws:ecr_repo:pod2-ecr_image-ecr_repo - - aws:iam_role:ClusterRole-eks_cluster-0 - - kubernetes:service_account:eks_cluster-0:pod2 - parent: eks_cluster/eks_cluster-0 - tag: big - load_balancer/rest-api-4-integbcc77100: children: - aws:load_balancer_listener:rest-api-4-integbcc77100:rest_api_4_integration_0-pod2 @@ -71,11 +70,12 @@ resources: - kubernetes:service:eks_cluster-0:restapi4integration0-pod2 - kubernetes:target_group_binding:eks_cluster-0:restapi4integration0-pod2 - aws:api_integration:rest_api_4/rest_api_4_integration_0: - parent: rest_api/rest_api_4 + kubernetes:pod:eks_cluster-0/pod2: + children: + - aws:ecr_image:pod2-ecr_image + - aws:ecr_repo:pod2-ecr_image-ecr_repo + - aws:iam_role:ClusterRole-eks_cluster-0 + - kubernetes:service_account:eks_cluster-0:pod2 + parent: eks_cluster/eks_cluster-0 tag: big - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> load_balancer/rest-api-4-integbcc77100: - path: - - aws:vpc_link:rest_api_4_integration_0-pod2 - diff --git a/pkg/engine/testdata/k8s_api.iac-viz.yaml b/pkg/engine/testdata/k8s_api.iac-viz.yaml index 31d026fec..0b8a36b78 100755 --- a/pkg/engine/testdata/k8s_api.iac-viz.yaml +++ b/pkg/engine/testdata/k8s_api.iac-viz.yaml @@ -1,59 +1,75 @@ provider: aws resources: - ecr_repo/pod2-ecr_image-ecr_repo: - - elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: - - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + aws:api_stage:rest_api_4/api_stage-0: - iam_policy/iam_policy-0: + aws:api_stage:rest_api_4/api_stage-0 -> aws:api_deployment:rest_api_4/api_deployment-0: + aws:api_stage:rest_api_4/api_stage-0 -> rest_api/rest_api_4: + eks_add_on/amazon-cloudwatch-observability: - iam_role/clusterrole-eks_cluster-0: + eks_add_on/amazon-cloudwatch-observability -> eks_cluster/eks_cluster-0: + eks_add_on/amazon-cloudwatch-observability -> iam_role/amazon-cloudwatch-observability-iam_role: + eks_add_on/vpc-cni: - iam_role/eks_node_group-0-iam_role: + eks_add_on/vpc-cni -> eks_cluster/eks_cluster-0: + iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0: - region/region-0: + iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0 -> iam_policy/iam_policy-0: + iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0 -> iam_role/aws-load-balancer-controller: + aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2: - rest_api/rest_api_4: + aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2 -> load_balancer/rest-api-4-integbcc77100: + aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2 -> target_group/rest-api-4-integbcc77100: + route_table_association/subnet-0-subnet-0-route_table: - vpc/vpc-0: + route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: + route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: + route_table_association/subnet-1-subnet-1-route_table: - ecr_image/pod2-ecr_image: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - ecr_image/pod2-ecr_image -> ecr_repo/pod2-ecr_image-ecr_repo: - aws:availability_zone:region-0/availability_zone-0: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: + security_group_rule/security_group_rule-0: - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:api_resource:rest_api_4/api_resource-0: + security_group_rule/security_group_rule-0 -> vpc/vpc-0: + kubernetes:helm_chart:eks_cluster-0/metricsserver: - aws:api_resource:rest_api_4/api_resource-0 -> rest_api/rest_api_4: - aws:internet_gateway:vpc-0/internet_gateway-0: + kubernetes:helm_chart:eks_cluster-0/metricsserver -> eks_cluster/eks_cluster-0: + kubernetes:helm_chart:eks_cluster-0/metricsserver -> eks_node_group/eks_node_group-0: + kubernetes:kube_config/eks_cluster-0-kube_config: - aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: - aws:security_group:vpc-0/eks_cluster-0-security_group: + kubernetes:kube_config/eks_cluster-0-kube_config -> eks_cluster/eks_cluster-0: + kubernetes:kube_config/eks_cluster-0-kube_config -> region/region-0: + kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2: - aws:security_group:vpc-0/eks_cluster-0-security_group -> vpc/vpc-0: - security_group_rule/security_group_rule-0: + kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> eks_cluster/eks_cluster-0: + kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> target_group/rest-api-4-integbcc77100: + kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller: + kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:service:eks_cluster-0/restapi4integration0-pod2: + aws:api_deployment:rest_api_4/api_deployment-0: - security_group_rule/security_group_rule-0 -> vpc/vpc-0: - target_group/rest-api-4-integbcc77100: + aws:api_deployment:rest_api_4/api_deployment-0 -> aws:api_integration:rest_api_4/rest_api_4_integration_0: + aws:api_deployment:rest_api_4/api_deployment-0 -> aws:api_method:rest_api_4/rest_api_4_integration_0_method: + aws:api_deployment:rest_api_4/api_deployment-0 -> rest_api/rest_api_4: + iam_role/amazon-cloudwatch-observability-iam_role: - target_group/rest-api-4-integbcc77100 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-2: + iam_role/amazon-cloudwatch-observability-iam_role -> iam_oidc_provider/eks_cluster-0: + iam_policy/iam_policy-0: - aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-3: + aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: - aws:api_method:rest_api_4/rest_api_4_integration_0_method: + aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table: - aws:api_method:rest_api_4/rest_api_4_integration_0_method -> aws:api_resource:rest_api_4/api_resource-0: - aws:api_method:rest_api_4/rest_api_4_integration_0_method -> rest_api/rest_api_4: + aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: aws:route_table:vpc-0/subnet-2-route_table: aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: @@ -62,16 +78,25 @@ resources: aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-0: + target_group/rest-api-4-integbcc77100: - aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/eks_cluster-0-security_group: - aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-1: + target_group/rest-api-4-integbcc77100 -> vpc/vpc-0: + kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller: - aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/eks_cluster-0-security_group: - aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: + kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> eks_cluster/eks_cluster-0: + kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> region/region-0: + kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller: + kubernetes:service:eks_cluster-0/restapi4integration0-pod2: + + kubernetes:service:eks_cluster-0/restapi4integration0-pod2 -> eks_cluster/eks_cluster-0: + kubernetes:service:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:pod:eks_cluster-0/pod2: + aws:api_integration:rest_api_4/rest_api_4_integration_0: + + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> aws:api_method:rest_api_4/rest_api_4_integration_0_method: + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> aws:api_resource:rest_api_4/api_resource-0: + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> load_balancer/rest-api-4-integbcc77100: + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> rest_api/rest_api_4: + aws:api_integration:rest_api_4/rest_api_4_integration_0 -> vpc_link/rest_api_4_integration_0-pod2: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: @@ -80,128 +105,103 @@ resources: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-3: - route_table_association/subnet-2-subnet-2-route_table: + aws:internet_gateway:vpc-0/internet_gateway-0: - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: - route_table_association/subnet-3-subnet-3-route_table: + aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller: - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: - eks_cluster/eks_cluster-0: + kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller -> eks_cluster/eks_cluster-0: + kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller -> iam_role/aws-load-balancer-controller: + kubernetes:pod:eks_cluster-0/pod2: - eks_cluster/eks_cluster-0 -> iam_role/clusterrole-eks_cluster-0: - eks_cluster/eks_cluster-0 -> aws:security_group:vpc-0/eks_cluster-0-security_group: - eks_cluster/eks_cluster-0 -> aws:subnet:vpc-0/subnet-0: - eks_cluster/eks_cluster-0 -> aws:subnet:vpc-0/subnet-1: - eks_cluster/eks_cluster-0 -> vpc/vpc-0: - load_balancer/rest-api-4-integbcc77100: + kubernetes:pod:eks_cluster-0/pod2 -> ecr_image/pod2-ecr_image: + kubernetes:pod:eks_cluster-0/pod2 -> eks_cluster/eks_cluster-0: + kubernetes:pod:eks_cluster-0/pod2 -> eks_node_group/eks_node_group-0: + kubernetes:pod:eks_cluster-0/pod2 -> kubernetes:service_account:eks_cluster-0/pod2: + aws:api_method:rest_api_4/rest_api_4_integration_0_method: - load_balancer/rest-api-4-integbcc77100 -> aws:subnet:vpc-0/subnet-0: - load_balancer/rest-api-4-integbcc77100 -> aws:subnet:vpc-0/subnet-1: - aws:route_table:vpc-0/subnet-0-route_table: + aws:api_method:rest_api_4/rest_api_4_integration_0_method -> aws:api_resource:rest_api_4/api_resource-0: + aws:api_method:rest_api_4/rest_api_4_integration_0_method -> rest_api/rest_api_4: + vpc_link/rest_api_4_integration_0-pod2: - aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-1-route_table: + vpc_link/rest_api_4_integration_0-pod2 -> load_balancer/rest-api-4-integbcc77100: + elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: - eks_add_on/vpc-cni: + aws:subnet:vpc-0/subnet-2: - eks_add_on/vpc-cni -> eks_cluster/eks_cluster-0: + aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + + aws:subnet:vpc-0/subnet-3: + + aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + iam_role/aws-load-balancer-controller: + + iam_role/aws-load-balancer-controller -> iam_oidc_provider/eks_cluster-0: + ecr_image/pod2-ecr_image: + + ecr_image/pod2-ecr_image -> ecr_repo/pod2-ecr_image-ecr_repo: eks_node_group/eks_node_group-0: eks_node_group/eks_node_group-0 -> eks_cluster/eks_cluster-0: eks_node_group/eks_node_group-0 -> iam_role/eks_node_group-0-iam_role: eks_node_group/eks_node_group-0 -> aws:subnet:vpc-0/subnet-0: eks_node_group/eks_node_group-0 -> aws:subnet:vpc-0/subnet-1: - iam_oidc_provider/eks_cluster-0: - - iam_oidc_provider/eks_cluster-0 -> eks_cluster/eks_cluster-0: - iam_oidc_provider/eks_cluster-0 -> region/region-0: - kubernetes:kube_config/eks_cluster-0-kube_config: - - kubernetes:kube_config/eks_cluster-0-kube_config -> eks_cluster/eks_cluster-0: - kubernetes:kube_config/eks_cluster-0-kube_config -> region/region-0: - aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2: - - aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2 -> load_balancer/rest-api-4-integbcc77100: - aws:load_balancer_listener:rest-api-4-integbcc77100/rest_api_4_integration_0-pod2 -> target_group/rest-api-4-integbcc77100: - vpc_link/rest_api_4_integration_0-pod2: - - vpc_link/rest_api_4_integration_0-pod2 -> load_balancer/rest-api-4-integbcc77100: - route_table_association/subnet-0-subnet-0-route_table: + kubernetes:service_account:eks_cluster-0/pod2: - route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: - route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: - route_table_association/subnet-1-subnet-1-route_table: + kubernetes:service_account:eks_cluster-0/pod2 -> eks_cluster/eks_cluster-0: + kubernetes:service_account:eks_cluster-0/pod2 -> iam_role/pod2: + aws:api_resource:rest_api_4/api_resource-0: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: - kubernetes:helm_chart:eks_cluster-0/metricsserver: + aws:api_resource:rest_api_4/api_resource-0 -> rest_api/rest_api_4: + load_balancer/rest-api-4-integbcc77100: - kubernetes:helm_chart:eks_cluster-0/metricsserver -> eks_cluster/eks_cluster-0: - kubernetes:helm_chart:eks_cluster-0/metricsserver -> eks_node_group/eks_node_group-0: - iam_role/amazon-cloudwatch-observability-iam_role: + load_balancer/rest-api-4-integbcc77100 -> aws:subnet:vpc-0/subnet-0: + load_balancer/rest-api-4-integbcc77100 -> aws:subnet:vpc-0/subnet-1: + ecr_repo/pod2-ecr_image-ecr_repo: - iam_role/amazon-cloudwatch-observability-iam_role -> iam_oidc_provider/eks_cluster-0: - iam_role/aws-load-balancer-controller: + iam_role/eks_node_group-0-iam_role: - iam_role/aws-load-balancer-controller -> iam_oidc_provider/eks_cluster-0: iam_role/pod2: iam_role/pod2 -> iam_oidc_provider/eks_cluster-0: - aws:api_integration:rest_api_4/rest_api_4_integration_0: + rest_api/rest_api_4: - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> aws:api_method:rest_api_4/rest_api_4_integration_0_method: - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> aws:api_resource:rest_api_4/api_resource-0: - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> load_balancer/rest-api-4-integbcc77100: - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> rest_api/rest_api_4: - aws:api_integration:rest_api_4/rest_api_4_integration_0 -> vpc_link/rest_api_4_integration_0-pod2: - eks_add_on/amazon-cloudwatch-observability: + iam_oidc_provider/eks_cluster-0: - eks_add_on/amazon-cloudwatch-observability -> eks_cluster/eks_cluster-0: - eks_add_on/amazon-cloudwatch-observability -> iam_role/amazon-cloudwatch-observability-iam_role: - iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0: + iam_oidc_provider/eks_cluster-0 -> eks_cluster/eks_cluster-0: + iam_oidc_provider/eks_cluster-0 -> region/region-0: + eks_cluster/eks_cluster-0: - iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0 -> iam_policy/iam_policy-0: - iam_role_policy_attachment/aws-load-balancer-controller-iam_policy-0 -> iam_role/aws-load-balancer-controller: - kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller: + eks_cluster/eks_cluster-0 -> iam_role/clusterrole-eks_cluster-0: + eks_cluster/eks_cluster-0 -> aws:security_group:vpc-0/eks_cluster-0-security_group: + eks_cluster/eks_cluster-0 -> aws:subnet:vpc-0/subnet-0: + eks_cluster/eks_cluster-0 -> aws:subnet:vpc-0/subnet-1: + eks_cluster/eks_cluster-0 -> vpc/vpc-0: + iam_role/clusterrole-eks_cluster-0: - kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller -> eks_cluster/eks_cluster-0: - kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller -> iam_role/aws-load-balancer-controller: - kubernetes:service_account:eks_cluster-0/pod2: + aws:subnet:vpc-0/subnet-0: - kubernetes:service_account:eks_cluster-0/pod2 -> eks_cluster/eks_cluster-0: - kubernetes:service_account:eks_cluster-0/pod2 -> iam_role/pod2: - aws:api_deployment:rest_api_4/api_deployment-0: + aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/eks_cluster-0-security_group: + aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1: - aws:api_deployment:rest_api_4/api_deployment-0 -> aws:api_integration:rest_api_4/rest_api_4_integration_0: - aws:api_deployment:rest_api_4/api_deployment-0 -> aws:api_method:rest_api_4/rest_api_4_integration_0_method: - aws:api_deployment:rest_api_4/api_deployment-0 -> rest_api/rest_api_4: - kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller: + aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/eks_cluster-0-security_group: + aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-0: - kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> eks_cluster/eks_cluster-0: - kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> region/region-0: - kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller -> kubernetes:service_account:eks_cluster-0/aws-load-balancer-controller: - kubernetes:pod:eks_cluster-0/pod2: + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:availability_zone:region-0/availability_zone-1: - kubernetes:pod:eks_cluster-0/pod2 -> ecr_image/pod2-ecr_image: - kubernetes:pod:eks_cluster-0/pod2 -> eks_cluster/eks_cluster-0: - kubernetes:pod:eks_cluster-0/pod2 -> eks_node_group/eks_node_group-0: - kubernetes:pod:eks_cluster-0/pod2 -> kubernetes:service_account:eks_cluster-0/pod2: - aws:api_stage:rest_api_4/api_stage-0: + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + aws:security_group:vpc-0/eks_cluster-0-security_group: - aws:api_stage:rest_api_4/api_stage-0 -> aws:api_deployment:rest_api_4/api_deployment-0: - aws:api_stage:rest_api_4/api_stage-0 -> rest_api/rest_api_4: - kubernetes:service:eks_cluster-0/restapi4integration0-pod2: + aws:security_group:vpc-0/eks_cluster-0-security_group -> vpc/vpc-0: + region/region-0: - kubernetes:service:eks_cluster-0/restapi4integration0-pod2 -> eks_cluster/eks_cluster-0: - kubernetes:service:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:pod:eks_cluster-0/pod2: - kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2: + vpc/vpc-0: - kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> eks_cluster/eks_cluster-0: - kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> target_group/rest-api-4-integbcc77100: - kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:helm_chart:eks_cluster-0/aws-load-balancer-controller: - kubernetes:target_group_binding:eks_cluster-0/restapi4integration0-pod2 -> kubernetes:service:eks_cluster-0/restapi4integration0-pod2: diff --git a/pkg/engine/testdata/lambda_efs.dataflow-viz.yaml b/pkg/engine/testdata/lambda_efs.dataflow-viz.yaml index cbabee5ec..0285324f6 100755 --- a/pkg/engine/testdata/lambda_efs.dataflow-viz.yaml +++ b/pkg/engine/testdata/lambda_efs.dataflow-viz.yaml @@ -1,11 +1,23 @@ provider: aws resources: - efs_file_system/test-efs-fs: + lambda_function/lambda_test_app: children: + - aws:ecr_image:lambda_test_app-image + - aws:ecr_repo:lambda_test_app-image-ecr_repo + - aws:iam_role:lambda_test_app-ExecutionRole + parent: vpc/vpc-0 + tag: big + + lambda_function/lambda_test_app -> efs_file_system/test-efs-fs: + path: - aws:efs_access_point:test-efs-fs:lambda_test_app-test-efs-fs - aws:efs_mount_target:test-efs-fs:lambda_test_app-test-efs-fs - aws:efs_mount_target:test-efs-fs:subnet-1-test-efs-fs - tag: big + - aws:iam_role:lambda_test_app-ExecutionRole + - aws:security_group:vpc-0:lambda_test_app-test-efs-fs + - aws:security_group:vpc-0:subnet-1-test-efs-fs + - aws:subnet:vpc-0:lambda_test_app-test-efs-fs + - aws:subnet:vpc-0:subnet-1 vpc/vpc-0: children: @@ -23,22 +35,10 @@ resources: - aws:subnet:vpc-0:subnet-3 tag: parent - lambda_function/lambda_test_app: + efs_file_system/test-efs-fs: children: - - aws:ecr_image:lambda_test_app-image - - aws:ecr_repo:lambda_test_app-image-ecr_repo - - aws:iam_role:lambda_test_app-ExecutionRole - parent: vpc/vpc-0 - tag: big - - lambda_function/lambda_test_app -> efs_file_system/test-efs-fs: - path: - aws:efs_access_point:test-efs-fs:lambda_test_app-test-efs-fs - aws:efs_mount_target:test-efs-fs:lambda_test_app-test-efs-fs - aws:efs_mount_target:test-efs-fs:subnet-1-test-efs-fs - - aws:iam_role:lambda_test_app-ExecutionRole - - aws:security_group:vpc-0:lambda_test_app-test-efs-fs - - aws:security_group:vpc-0:subnet-1-test-efs-fs - - aws:subnet:vpc-0:lambda_test_app-test-efs-fs - - aws:subnet:vpc-0:subnet-1 + tag: big diff --git a/pkg/engine/testdata/lambda_efs.iac-viz.yaml b/pkg/engine/testdata/lambda_efs.iac-viz.yaml index 0f6964e18..169696800 100755 --- a/pkg/engine/testdata/lambda_efs.iac-viz.yaml +++ b/pkg/engine/testdata/lambda_efs.iac-viz.yaml @@ -1,49 +1,71 @@ provider: aws resources: - ecr_repo/lambda_test_app-image-ecr_repo: + aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs: - elastic_ip/lambda_test_app-test-efs-fs-route_table-nat_gateway-elastic_ip: + aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> efs_file_system/test-efs-fs: + aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: + aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: + aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs: - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> efs_file_system/test-efs-fs: + aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> aws:security_group:vpc-0/subnet-1-test-efs-fs: + aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> aws:subnet:vpc-0/subnet-1: + lambda_function/lambda_test_app: - log_group/lambda_test_app-log-group: + lambda_function/lambda_test_app -> ecr_image/lambda_test_app-image: + lambda_function/lambda_test_app -> aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs: + lambda_function/lambda_test_app -> iam_role/lambda_test_app-executionrole: + lambda_function/lambda_test_app -> aws:security_group:vpc-0/lambda_test_app-security_group: + lambda_function/lambda_test_app -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: + lambda_function/lambda_test_app -> aws:subnet:vpc-0/subnet-1: + route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table: - region/region-0: + route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table -> aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table: + route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: + route_table_association/subnet-1-subnet-1-route_table: - vpc/vpc-0: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: + + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: ecr_image/lambda_test_app-image: ecr_image/lambda_test_app-image -> ecr_repo/lambda_test_app-image-ecr_repo: - aws:availability_zone:region-0/availability_zone-0: - - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: + aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs: - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc-0/internet_gateway-0: + aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs -> efs_file_system/test-efs-fs: + iam_role/lambda_test_app-executionrole: - aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + iam_role/lambda_test_app-executionrole -> efs_file_system/test-efs-fs: + iam_role/lambda_test_app-executionrole -> log_group/lambda_test_app-log-group: aws:security_group:vpc-0/lambda_test_app-security_group: aws:security_group:vpc-0/lambda_test_app-security_group -> vpc/vpc-0: - aws:security_group:vpc-0/lambda_test_app-test-efs-fs: - - aws:security_group:vpc-0/lambda_test_app-test-efs-fs -> vpc/vpc-0: - aws:security_group:vpc-0/subnet-1-test-efs-fs: + aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table: - aws:security_group:vpc-0/subnet-1-test-efs-fs -> vpc/vpc-0: - efs_file_system/test-efs-fs: + aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table -> aws:nat_gateway:subnet-2/lambda_test_app-test-efs-fs-route_table-nat_gateway: + aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table -> vpc/vpc-0: + aws:subnet:vpc-0/lambda_test_app-test-efs-fs: - efs_file_system/test-efs-fs -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2: + aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: + aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-3: + aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1: - aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/subnet-1-test-efs-fs: + aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: aws:route_table:vpc-0/subnet-2-route_table: aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: @@ -52,24 +74,13 @@ resources: aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/lambda_test_app-test-efs-fs: - - aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: - aws:subnet:vpc-0/lambda_test_app-test-efs-fs -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-1: + ecr_repo/lambda_test_app-image-ecr_repo: - aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/subnet-1-test-efs-fs: - aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: - aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs: + efs_file_system/test-efs-fs: - aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs -> efs_file_system/test-efs-fs: - iam_role/lambda_test_app-executionrole: + efs_file_system/test-efs-fs -> aws:availability_zone:region-0/availability_zone-0: + log_group/lambda_test_app-log-group: - iam_role/lambda_test_app-executionrole -> efs_file_system/test-efs-fs: - iam_role/lambda_test_app-executionrole -> log_group/lambda_test_app-log-group: aws:nat_gateway:subnet-2/lambda_test_app-test-efs-fs-route_table-nat_gateway: aws:nat_gateway:subnet-2/lambda_test_app-test-efs-fs-route_table-nat_gateway -> elastic_ip/lambda_test_app-test-efs-fs-route_table-nat_gateway-elastic_ip: @@ -78,45 +89,34 @@ resources: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-3: - route_table_association/subnet-2-subnet-2-route_table: + aws:security_group:vpc-0/lambda_test_app-test-efs-fs: - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: - route_table_association/subnet-3-subnet-3-route_table: + aws:security_group:vpc-0/lambda_test_app-test-efs-fs -> vpc/vpc-0: + aws:security_group:vpc-0/subnet-1-test-efs-fs: - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: - aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs: + aws:security_group:vpc-0/subnet-1-test-efs-fs -> vpc/vpc-0: + aws:internet_gateway:vpc-0/internet_gateway-0: - aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> efs_file_system/test-efs-fs: - aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> aws:security_group:vpc-0/lambda_test_app-test-efs-fs: - aws:efs_mount_target:test-efs-fs/lambda_test_app-test-efs-fs -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: - aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs: + aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + elastic_ip/lambda_test_app-test-efs-fs-route_table-nat_gateway-elastic_ip: - aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> efs_file_system/test-efs-fs: - aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> aws:security_group:vpc-0/subnet-1-test-efs-fs: - aws:efs_mount_target:test-efs-fs/subnet-1-test-efs-fs -> aws:subnet:vpc-0/subnet-1: - lambda_function/lambda_test_app: + aws:subnet:vpc-0/subnet-2: - lambda_function/lambda_test_app -> ecr_image/lambda_test_app-image: - lambda_function/lambda_test_app -> aws:efs_access_point:test-efs-fs/lambda_test_app-test-efs-fs: - lambda_function/lambda_test_app -> iam_role/lambda_test_app-executionrole: - lambda_function/lambda_test_app -> aws:security_group:vpc-0/lambda_test_app-security_group: - lambda_function/lambda_test_app -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: - lambda_function/lambda_test_app -> aws:subnet:vpc-0/subnet-1: - aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table: + aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table -> aws:nat_gateway:subnet-2/lambda_test_app-test-efs-fs-route_table-nat_gateway: - aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-3: - aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: - route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table: + aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-0: - route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table -> aws:route_table:vpc-0/lambda_test_app-test-efs-fs-route_table: - route_table_association/lambda_test_app-test-efs-fs-lambda_test_app-test-efs-fs-route_table -> aws:subnet:vpc-0/lambda_test_app-test-efs-fs: - route_table_association/subnet-1-subnet-1-route_table: + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:availability_zone:region-0/availability_zone-1: + + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + vpc/vpc-0: + + region/region-0: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: diff --git a/pkg/engine/testdata/namespace_pathselect.iac-viz.yaml b/pkg/engine/testdata/namespace_pathselect.iac-viz.yaml index 354faff3a..6b84aa139 100755 --- a/pkg/engine/testdata/namespace_pathselect.iac-viz.yaml +++ b/pkg/engine/testdata/namespace_pathselect.iac-viz.yaml @@ -1,66 +1,64 @@ provider: aws resources: - ecr_repo/ecr_repo-0: - - ecr_repo/lambda_function_2-image-ecr_repo: - - elastic_ip/lambda_function_2-vpc_1-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function_0: - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: + lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: + lambda_function/lambda_function_0 -> log_group/lambda_function_0-log-group: + lambda_function/lambda_function_2: - log_group/lambda_function_0-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 -> aws:security_group:vpc_1/lambda_function_2-security_group: + lambda_function/lambda_function_2 -> aws:subnet:vpc_1/lambda_function_2-vpc_1: + lambda_function/lambda_function_2 -> aws:subnet:vpc_1/subnet-1: + route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table: - log_group/lambda_function_2-log-group: + route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table -> aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table: + route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table -> aws:subnet:vpc_1/lambda_function_2-vpc_1: + route_table_association/subnet-1-subnet-1-route_table: - region/region-0: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc_1/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc_1/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - vpc/vpc_1: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc_1/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc_1/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc_1/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc_1/subnet-3: ecr_image/lambda_function_0-image: ecr_image/lambda_function_0-image -> ecr_repo/ecr_repo-0: - ecr_image/lambda_function_2-image: - - ecr_image/lambda_function_2-image -> ecr_repo/lambda_function_2-image-ecr_repo: iam_role/lambda_function_0-executionrole: iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: + ecr_image/lambda_function_2-image: + + ecr_image/lambda_function_2-image -> ecr_repo/lambda_function_2-image-ecr_repo: iam_role/lambda_function_2-executionrole: iam_role/lambda_function_2-executionrole -> log_group/lambda_function_2-log-group: - aws:availability_zone:region-0/availability_zone-0: - - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: - - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc_1/internet_gateway-0: - - aws:internet_gateway:vpc_1/internet_gateway-0 -> vpc/vpc_1: aws:security_group:vpc_1/lambda_function_2-security_group: aws:security_group:vpc_1/lambda_function_2-security_group -> vpc/vpc_1: - lambda_function/lambda_function_0: + aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table: - lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: - lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: - lambda_function/lambda_function_0 -> log_group/lambda_function_0-log-group: + aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table -> aws:nat_gateway:subnet-2/lambda_function_2-vpc_1-route_table-nat_gateway: + aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table -> vpc/vpc_1: aws:subnet:vpc_1/lambda_function_2-vpc_1: aws:subnet:vpc_1/lambda_function_2-vpc_1 -> aws:availability_zone:region-0/availability_zone-0: aws:subnet:vpc_1/lambda_function_2-vpc_1 -> vpc/vpc_1: - aws:subnet:vpc_1/subnet-2: + aws:route_table:vpc_1/subnet-1-route_table: - aws:subnet:vpc_1/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc_1/subnet-2 -> vpc/vpc_1: + aws:route_table:vpc_1/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc_1/subnet-1-route_table -> vpc/vpc_1: aws:subnet:vpc_1/subnet-1: aws:subnet:vpc_1/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: aws:subnet:vpc_1/subnet-1 -> vpc/vpc_1: - aws:subnet:vpc_1/subnet-3: - - aws:subnet:vpc_1/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc_1/subnet-3 -> vpc/vpc_1: aws:route_table:vpc_1/subnet-2-route_table: aws:route_table:vpc_1/subnet-2-route_table -> aws:internet_gateway:vpc_1/internet_gateway-0: @@ -69,42 +67,44 @@ resources: aws:route_table:vpc_1/subnet-3-route_table -> aws:internet_gateway:vpc_1/internet_gateway-0: aws:route_table:vpc_1/subnet-3-route_table -> vpc/vpc_1: + ecr_repo/ecr_repo-0: + + log_group/lambda_function_0-log-group: + + ecr_repo/lambda_function_2-image-ecr_repo: + + log_group/lambda_function_2-log-group: + aws:nat_gateway:subnet-2/lambda_function_2-vpc_1-route_table-nat_gateway: aws:nat_gateway:subnet-2/lambda_function_2-vpc_1-route_table-nat_gateway -> elastic_ip/lambda_function_2-vpc_1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-2/lambda_function_2-vpc_1-route_table-nat_gateway -> aws:subnet:vpc_1/subnet-2: - 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 -> aws:security_group:vpc_1/lambda_function_2-security_group: - lambda_function/lambda_function_2 -> aws:subnet:vpc_1/lambda_function_2-vpc_1: - lambda_function/lambda_function_2 -> aws:subnet:vpc_1/subnet-1: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc_1/subnet-3: - route_table_association/subnet-2-subnet-2-route_table: + aws:internet_gateway:vpc_1/internet_gateway-0: - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc_1/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc_1/subnet-2: - route_table_association/subnet-3-subnet-3-route_table: + aws:internet_gateway:vpc_1/internet_gateway-0 -> vpc/vpc_1: + elastic_ip/lambda_function_2-vpc_1-route_table-nat_gateway-elastic_ip: - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc_1/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc_1/subnet-3: - aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table: + aws:subnet:vpc_1/subnet-2: - aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table -> aws:nat_gateway:subnet-2/lambda_function_2-vpc_1-route_table-nat_gateway: - aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table -> vpc/vpc_1: - aws:route_table:vpc_1/subnet-1-route_table: + aws:subnet:vpc_1/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc_1/subnet-2 -> vpc/vpc_1: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc_1/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc_1/subnet-1-route_table -> vpc/vpc_1: - route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table: + aws:subnet:vpc_1/subnet-3: - route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table -> aws:route_table:vpc_1/lambda_function_2-vpc_1-route_table: - route_table_association/lambda_function_2-vpc_1-lambda_function_2-vpc_1-route_table -> aws:subnet:vpc_1/lambda_function_2-vpc_1: - route_table_association/subnet-1-subnet-1-route_table: + aws:subnet:vpc_1/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc_1/subnet-3 -> vpc/vpc_1: + aws:availability_zone:region-0/availability_zone-0: + + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:availability_zone:region-0/availability_zone-1: + + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + vpc/vpc_1: + + region/region-0: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc_1/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc_1/subnet-1: diff --git a/pkg/engine/testdata/remove_path.dataflow-viz.yaml b/pkg/engine/testdata/remove_path.dataflow-viz.yaml index 98318cd63..65736bd16 100644 --- a/pkg/engine/testdata/remove_path.dataflow-viz.yaml +++ b/pkg/engine/testdata/remove_path.dataflow-viz.yaml @@ -1,16 +1,25 @@ provider: aws resources: - lambda_function/lambda_function_3: + lambda_function/lambda_function_0: children: - - aws:ecr_image:lambda_function_3-image + - aws:ecr_image:lambda_function_0-image - aws:ecr_repo:ecr_repo-0 - - aws:iam_role:lambda_function_3-ExecutionRole + - aws:iam_role:lambda_function_0-ExecutionRole parent: vpc/vpc-0 tag: big - rds_instance/rds-instance-1: + lambda_function/lambda_function_0 -> rds_instance/rds-instance-1: + path: + - aws:iam_role:lambda_function_0-ExecutionRole + - aws:security_group:vpc-0:rds-instance-1-security_group + - aws:subnet:vpc-0:subnet-0 + - aws:subnet:vpc-0:subnet-1 + + lambda_function/lambda_function_3: children: - - aws:rds_subnet_group:rds_subnet_group-0 + - aws:ecr_image:lambda_function_3-image + - aws:ecr_repo:ecr_repo-0 + - aws:iam_role:lambda_function_3-ExecutionRole parent: vpc/vpc-0 tag: big @@ -30,18 +39,9 @@ resources: - aws:subnet:vpc-0:subnet-3 tag: parent - lambda_function/lambda_function_0: + rds_instance/rds-instance-1: children: - - aws:ecr_image:lambda_function_0-image - - aws:ecr_repo:ecr_repo-0 - - aws:iam_role:lambda_function_0-ExecutionRole + - aws:rds_subnet_group:rds_subnet_group-0 parent: vpc/vpc-0 tag: big - lambda_function/lambda_function_0 -> rds_instance/rds-instance-1: - path: - - aws:iam_role:lambda_function_0-ExecutionRole - - aws:security_group:vpc-0:rds-instance-1-security_group - - aws:subnet:vpc-0:subnet-0 - - aws:subnet:vpc-0:subnet-1 - diff --git a/pkg/engine/testdata/remove_path.iac-viz.yaml b/pkg/engine/testdata/remove_path.iac-viz.yaml index 38768d5e6..054d645b3 100644 --- a/pkg/engine/testdata/remove_path.iac-viz.yaml +++ b/pkg/engine/testdata/remove_path.iac-viz.yaml @@ -1,135 +1,135 @@ provider: aws resources: - ecr_repo/ecr_repo-0: - - elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function_0: - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: + lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: + lambda_function/lambda_function_0 -> log_group/lambda_function_0-log-group: + lambda_function/lambda_function_0 -> rds_instance/rds-instance-1: + lambda_function/lambda_function_0 -> aws:security_group:vpc-0/lambda_function_0-security_group: + lambda_function/lambda_function_0 -> aws:subnet:vpc-0/subnet-0: + lambda_function/lambda_function_0 -> aws:subnet:vpc-0/subnet-1: + lambda_function/lambda_function_3: - log_group/lambda_function_0-log-group: + lambda_function/lambda_function_3 -> ecr_image/lambda_function_3-image: + lambda_function/lambda_function_3 -> iam_role/lambda_function_3-executionrole: + lambda_function/lambda_function_3 -> log_group/lambda_function_3-log-group: + lambda_function/lambda_function_3 -> rds_instance/rds-instance-1: + lambda_function/lambda_function_3 -> aws:security_group:vpc-0/lambda_function_3-security_group: + lambda_function/lambda_function_3 -> aws:subnet:vpc-0/subnet-0: + lambda_function/lambda_function_3 -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-0-subnet-0-route_table: - log_group/lambda_function_3-log-group: + route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: + route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: + route_table_association/subnet-1-subnet-1-route_table: - region/region-0: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - vpc/vpc-0: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: ecr_image/lambda_function_0-image: ecr_image/lambda_function_0-image -> ecr_repo/ecr_repo-0: + iam_role/lambda_function_0-executionrole: + + iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: + iam_role/lambda_function_0-executionrole -> rds_instance/rds-instance-1: + aws:security_group:vpc-0/lambda_function_0-security_group: + + aws:security_group:vpc-0/lambda_function_0-security_group -> vpc/vpc-0: ecr_image/lambda_function_3-image: ecr_image/lambda_function_3-image -> ecr_repo/ecr_repo-0: iam_role/lambda_function_3-executionrole: iam_role/lambda_function_3-executionrole -> log_group/lambda_function_3-log-group: - aws:availability_zone:region-0/availability_zone-0: + aws:security_group:vpc-0/lambda_function_3-security_group: - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: + aws:security_group:vpc-0/lambda_function_3-security_group -> vpc/vpc-0: + log_group/lambda_function_0-log-group: - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc-0/internet_gateway-0: + rds_instance/rds-instance-1: - aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: - aws:security_group:vpc-0/lambda_function_0-security_group: + rds_instance/rds-instance-1 -> rds_subnet_group/rds_subnet_group-0: + rds_instance/rds-instance-1 -> aws:security_group:vpc-0/rds-instance-1-security_group: + ecr_repo/ecr_repo-0: - aws:security_group:vpc-0/lambda_function_0-security_group -> vpc/vpc-0: - aws:security_group:vpc-0/lambda_function_3-security_group: + log_group/lambda_function_3-log-group: - aws:security_group:vpc-0/lambda_function_3-security_group -> vpc/vpc-0: - aws:security_group:vpc-0/rds-instance-1-security_group: + rds_subnet_group/rds_subnet_group-0: - aws:security_group:vpc-0/rds-instance-1-security_group -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-2-route_table: + rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-0: + rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-1: + aws:subnet:vpc-0/subnet-0: - aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: - aws:route_table:vpc-0/subnet-2-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-3-route_table: + aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-0 -> aws:route_table:vpc-0/subnet-0-route_table: + aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-1-security_group: + aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: + aws:subnet:vpc-0/subnet-1: - aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: - aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-2: + aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-1 -> aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-1-security_group: + aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-2 -> aws:route_table:vpc-0/subnet-2-route_table: - aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-3: + aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-3 -> aws:route_table:vpc-0/subnet-3-route_table: - aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: + aws:security_group:vpc-0/rds-instance-1-security_group: + + aws:security_group:vpc-0/rds-instance-1-security_group -> vpc/vpc-0: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-2: - route_table_association/subnet-2-subnet-2-route_table: - - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc-0/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc-0/subnet-2: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc-0/subnet-3: - route_table_association/subnet-3-subnet-3-route_table: - - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc-0/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc-0/subnet-3: - aws:route_table:vpc-0/subnet-0-route_table: + elastic_ip/subnet-0-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc-0/subnet-0-route_table -> aws:nat_gateway:subnet-2/subnet-0-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-0-route_table -> vpc/vpc-0: - aws:route_table:vpc-0/subnet-1-route_table: + aws:subnet:vpc-0/subnet-2: - aws:route_table:vpc-0/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc-0/subnet-1-route_table -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-0: + aws:subnet:vpc-0/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc-0/subnet-2 -> aws:route_table:vpc-0/subnet-2-route_table: + aws:subnet:vpc-0/subnet-2 -> vpc/vpc-0: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - aws:subnet:vpc-0/subnet-0 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc-0/subnet-0 -> aws:route_table:vpc-0/subnet-0-route_table: - aws:subnet:vpc-0/subnet-0 -> aws:security_group:vpc-0/rds-instance-1-security_group: - aws:subnet:vpc-0/subnet-0 -> vpc/vpc-0: - aws:subnet:vpc-0/subnet-1: + aws:subnet:vpc-0/subnet-3: - aws:subnet:vpc-0/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc-0/subnet-1 -> aws:route_table:vpc-0/subnet-1-route_table: - aws:subnet:vpc-0/subnet-1 -> aws:security_group:vpc-0/rds-instance-1-security_group: - aws:subnet:vpc-0/subnet-1 -> vpc/vpc-0: - route_table_association/subnet-0-subnet-0-route_table: + aws:subnet:vpc-0/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc-0/subnet-3 -> aws:route_table:vpc-0/subnet-3-route_table: + aws:subnet:vpc-0/subnet-3 -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-0: - route_table_association/subnet-0-subnet-0-route_table -> aws:route_table:vpc-0/subnet-0-route_table: - route_table_association/subnet-0-subnet-0-route_table -> aws:subnet:vpc-0/subnet-0: - rds_subnet_group/rds_subnet_group-0: + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:route_table:vpc-0/subnet-2-route_table: - rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-0: - rds_subnet_group/rds_subnet_group-0 -> aws:subnet:vpc-0/subnet-1: - route_table_association/subnet-1-subnet-1-route_table: + aws:route_table:vpc-0/subnet-2-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: + aws:route_table:vpc-0/subnet-2-route_table -> vpc/vpc-0: + aws:availability_zone:region-0/availability_zone-1: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc-0/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc-0/subnet-1: - rds_instance/rds-instance-1: + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + aws:route_table:vpc-0/subnet-3-route_table: - rds_instance/rds-instance-1 -> rds_subnet_group/rds_subnet_group-0: - rds_instance/rds-instance-1 -> aws:security_group:vpc-0/rds-instance-1-security_group: - iam_role/lambda_function_0-executionrole: + aws:route_table:vpc-0/subnet-3-route_table -> aws:internet_gateway:vpc-0/internet_gateway-0: + aws:route_table:vpc-0/subnet-3-route_table -> vpc/vpc-0: + region/region-0: - iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: - iam_role/lambda_function_0-executionrole -> rds_instance/rds-instance-1: - lambda_function/lambda_function_3: + aws:internet_gateway:vpc-0/internet_gateway-0: - lambda_function/lambda_function_3 -> ecr_image/lambda_function_3-image: - lambda_function/lambda_function_3 -> iam_role/lambda_function_3-executionrole: - lambda_function/lambda_function_3 -> log_group/lambda_function_3-log-group: - lambda_function/lambda_function_3 -> rds_instance/rds-instance-1: - lambda_function/lambda_function_3 -> aws:security_group:vpc-0/lambda_function_3-security_group: - lambda_function/lambda_function_3 -> aws:subnet:vpc-0/subnet-0: - lambda_function/lambda_function_3 -> aws:subnet:vpc-0/subnet-1: - lambda_function/lambda_function_0: + aws:internet_gateway:vpc-0/internet_gateway-0 -> vpc/vpc-0: + vpc/vpc-0: - lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: - lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: - lambda_function/lambda_function_0 -> log_group/lambda_function_0-log-group: - lambda_function/lambda_function_0 -> rds_instance/rds-instance-1: - lambda_function/lambda_function_0 -> aws:security_group:vpc-0/lambda_function_0-security_group: - lambda_function/lambda_function_0 -> aws:subnet:vpc-0/subnet-0: - lambda_function/lambda_function_0 -> aws:subnet:vpc-0/subnet-1: diff --git a/pkg/engine/testdata/rename.dataflow-viz.yaml b/pkg/engine/testdata/rename.dataflow-viz.yaml index 35e0bc63b..71458d644 100644 --- a/pkg/engine/testdata/rename.dataflow-viz.yaml +++ b/pkg/engine/testdata/rename.dataflow-viz.yaml @@ -1,8 +1,5 @@ provider: aws resources: - s3_bucket/new-bucket: - tag: big - lambda_function/lambda_test_app: children: - aws:ecr_image:lambda_test_app-image @@ -15,3 +12,6 @@ resources: - aws:SERVICE_API:lambda_test_app-lambda_test_app-log-group - aws:iam_role:lambda_test_app-ExecutionRole + s3_bucket/new-bucket: + tag: big + diff --git a/pkg/engine/testdata/rename.iac-viz.yaml b/pkg/engine/testdata/rename.iac-viz.yaml index 59b8f01e2..be83b3204 100644 --- a/pkg/engine/testdata/rename.iac-viz.yaml +++ b/pkg/engine/testdata/rename.iac-viz.yaml @@ -1,11 +1,11 @@ provider: aws resources: - ecr_repo/ecr_repo-0: - - log_group/lambda_test_app-log-group: - - s3_bucket/new-bucket: + lambda_function/lambda_test_app: + lambda_function/lambda_test_app -> ecr_image/lambda_test_app-image: + lambda_function/lambda_test_app -> iam_role/lambda_test_app-executionrole: + lambda_function/lambda_test_app -> log_group/lambda_test_app-log-group: + lambda_function/lambda_test_app -> s3_bucket/new-bucket: ecr_image/lambda_test_app-image: ecr_image/lambda_test_app-image -> ecr_repo/ecr_repo-0: @@ -13,9 +13,9 @@ resources: iam_role/lambda_test_app-executionrole -> log_group/lambda_test_app-log-group: iam_role/lambda_test_app-executionrole -> s3_bucket/new-bucket: - lambda_function/lambda_test_app: + ecr_repo/ecr_repo-0: + + log_group/lambda_test_app-log-group: + + s3_bucket/new-bucket: - lambda_function/lambda_test_app -> ecr_image/lambda_test_app-image: - lambda_function/lambda_test_app -> iam_role/lambda_test_app-executionrole: - lambda_function/lambda_test_app -> log_group/lambda_test_app-log-group: - lambda_function/lambda_test_app -> s3_bucket/new-bucket: diff --git a/pkg/engine/testdata/same_path_multiple_methods.iac-viz.yaml b/pkg/engine/testdata/same_path_multiple_methods.iac-viz.yaml index 7a70ea924..d9d849d71 100644 --- a/pkg/engine/testdata/same_path_multiple_methods.iac-viz.yaml +++ b/pkg/engine/testdata/same_path_multiple_methods.iac-viz.yaml @@ -1,25 +1,18 @@ provider: aws resources: - rest_api/rest_api_0: - - aws:api_resource:rest_api_0/api_resource-1: - - aws:api_resource:rest_api_0/api_resource-1 -> rest_api/rest_api_0: - aws:api_resource:rest_api_0/api_resource-2: - - aws:api_resource:rest_api_0/api_resource-2 -> rest_api/rest_api_0: - aws:api_method:rest_api_0/rest_api_0_integration_0_method: - - aws:api_method:rest_api_0/rest_api_0_integration_0_method -> aws:api_resource:rest_api_0/api_resource-1: - aws:api_method:rest_api_0/rest_api_0_integration_0_method -> rest_api/rest_api_0: - aws:api_method:rest_api_0/rest_api_0_integration_1_method: + aws:api_stage:rest_api_0/api_stage-0: - aws:api_method:rest_api_0/rest_api_0_integration_1_method -> aws:api_resource:rest_api_0/api_resource-2: - aws:api_method:rest_api_0/rest_api_0_integration_1_method -> rest_api/rest_api_0: - aws:api_method:rest_api_0/rest_api_0_integration_2_method: + 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: - aws:api_method:rest_api_0/rest_api_0_integration_2_method -> aws:api_resource:rest_api_0/api_resource-2: - aws:api_method:rest_api_0/rest_api_0_integration_2_method -> rest_api/rest_api_0: + 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_integration:rest_api_0/rest_api_0_integration_1: + aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_integration:rest_api_0/rest_api_0_integration_2: + 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 -> aws:api_method:rest_api_0/rest_api_0_integration_1_method: + aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_method:rest_api_0/rest_api_0_integration_2_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: aws:api_integration:rest_api_0/rest_api_0_integration_0 -> aws:api_method:rest_api_0/rest_api_0_integration_0_method: @@ -35,16 +28,23 @@ resources: aws:api_integration:rest_api_0/rest_api_0_integration_2 -> aws:api_method:rest_api_0/rest_api_0_integration_2_method: aws:api_integration:rest_api_0/rest_api_0_integration_2 -> aws:api_resource:rest_api_0/api_resource-2: aws:api_integration:rest_api_0/rest_api_0_integration_2 -> rest_api/rest_api_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 -> aws:api_integration:rest_api_0/rest_api_0_integration_0: - aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_integration:rest_api_0/rest_api_0_integration_1: - aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_integration:rest_api_0/rest_api_0_integration_2: - 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 -> aws:api_method:rest_api_0/rest_api_0_integration_1_method: - aws:api_deployment:rest_api_0/api_deployment-0 -> aws:api_method:rest_api_0/rest_api_0_integration_2_method: - aws:api_deployment:rest_api_0/api_deployment-0 -> rest_api/rest_api_0: - aws:api_stage:rest_api_0/api_stage-0: + aws:api_method:rest_api_0/rest_api_0_integration_0_method -> aws:api_resource:rest_api_0/api_resource-1: + aws:api_method:rest_api_0/rest_api_0_integration_0_method -> rest_api/rest_api_0: + aws:api_method:rest_api_0/rest_api_0_integration_1_method: + + aws:api_method:rest_api_0/rest_api_0_integration_1_method -> aws:api_resource:rest_api_0/api_resource-2: + aws:api_method:rest_api_0/rest_api_0_integration_1_method -> rest_api/rest_api_0: + aws:api_method:rest_api_0/rest_api_0_integration_2_method: + + aws:api_method:rest_api_0/rest_api_0_integration_2_method -> aws:api_resource:rest_api_0/api_resource-2: + aws:api_method:rest_api_0/rest_api_0_integration_2_method -> rest_api/rest_api_0: + aws:api_resource:rest_api_0/api_resource-1: + + aws:api_resource:rest_api_0/api_resource-1 -> rest_api/rest_api_0: + aws:api_resource:rest_api_0/api_resource-2: + + aws:api_resource:rest_api_0/api_resource-2 -> rest_api/rest_api_0: + rest_api/rest_api_0: - 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: diff --git a/pkg/engine/testdata/single_lambda.iac-viz.yaml b/pkg/engine/testdata/single_lambda.iac-viz.yaml index 3370986e0..13521fc79 100755 --- a/pkg/engine/testdata/single_lambda.iac-viz.yaml +++ b/pkg/engine/testdata/single_lambda.iac-viz.yaml @@ -1,16 +1,16 @@ provider: aws resources: - ecr_repo/lambda_function_0-image-ecr_repo: - - log_group/lambda_function_0-log-group: + 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: ecr_image/lambda_function_0-image: ecr_image/lambda_function_0-image -> ecr_repo/lambda_function_0-image-ecr_repo: iam_role/lambda_function_0-executionrole: iam_role/lambda_function_0-executionrole -> log_group/lambda_function_0-log-group: - lambda_function/lambda_function_0: + ecr_repo/lambda_function_0-image-ecr_repo: + + log_group/lambda_function_0-log-group: - lambda_function/lambda_function_0 -> ecr_image/lambda_function_0-image: - lambda_function/lambda_function_0 -> iam_role/lambda_function_0-executionrole: diff --git a/pkg/engine/testdata/static_site.dataflow-viz.yaml b/pkg/engine/testdata/static_site.dataflow-viz.yaml index af6a02102..473a6061f 100755 --- a/pkg/engine/testdata/static_site.dataflow-viz.yaml +++ b/pkg/engine/testdata/static_site.dataflow-viz.yaml @@ -1,8 +1,5 @@ provider: aws resources: - s3_bucket/s3-bucket-0: - tag: big - cloudfront_distribution/cloudfront_distribution_1: tag: big @@ -11,3 +8,6 @@ resources: - aws:cloudfront_origin_access_identity:cloudfront_origin_access_identity-0 - aws:s3_bucket_policy:s3_bucket_policy-0 + s3_bucket/s3-bucket-0: + tag: big + diff --git a/pkg/engine/testdata/static_site.iac-viz.yaml b/pkg/engine/testdata/static_site.iac-viz.yaml index ef378751c..9f43f4da7 100755 --- a/pkg/engine/testdata/static_site.iac-viz.yaml +++ b/pkg/engine/testdata/static_site.iac-viz.yaml @@ -1,9 +1,5 @@ provider: aws resources: - cloudfront_origin_access_identity/cloudfront_origin_access_identity-0: - - s3_bucket/s3-bucket-0: - cloudfront_distribution/cloudfront_distribution_1: cloudfront_distribution/cloudfront_distribution_1 -> cloudfront_origin_access_identity/cloudfront_origin_access_identity-0: @@ -12,3 +8,7 @@ resources: s3_bucket_policy/s3_bucket_policy-0 -> cloudfront_origin_access_identity/cloudfront_origin_access_identity-0: s3_bucket_policy/s3_bucket_policy-0 -> s3_bucket/s3-bucket-0: + cloudfront_origin_access_identity/cloudfront_origin_access_identity-0: + + s3_bucket/s3-bucket-0: + diff --git a/pkg/engine/testdata/vpc_import.iac-viz.yaml b/pkg/engine/testdata/vpc_import.iac-viz.yaml index 9da31456a..ca2ae386a 100644 --- a/pkg/engine/testdata/vpc_import.iac-viz.yaml +++ b/pkg/engine/testdata/vpc_import.iac-viz.yaml @@ -1,7 +1,5 @@ provider: aws resources: - vpc/vpc: - aws:subnet:vpc/subnet1: aws:subnet:vpc/subnet1 -> vpc/vpc: @@ -14,3 +12,5 @@ resources: aws:subnet:vpc/subnet4: aws:subnet:vpc/subnet4 -> vpc/vpc: + vpc/vpc: + diff --git a/pkg/engine/testdata/vpc_import_to_lambda.iac-viz.yaml b/pkg/engine/testdata/vpc_import_to_lambda.iac-viz.yaml index e7aa6e12e..d69580743 100644 --- a/pkg/engine/testdata/vpc_import_to_lambda.iac-viz.yaml +++ b/pkg/engine/testdata/vpc_import_to_lambda.iac-viz.yaml @@ -1,11 +1,18 @@ provider: aws resources: - ecr_repo/lambda_function-image-ecr_repo: + lambda_function/lambda_function: - log_group/lambda_function-log-group: + lambda_function/lambda_function -> ecr_image/lambda_function-image: + lambda_function/lambda_function -> iam_role/lambda_function-executionrole: + lambda_function/lambda_function -> aws:security_group:vpc/lambda_function-security_group: + lambda_function/lambda_function -> subnet/subnet1: + lambda_function/lambda_function -> subnet/subnet2: + subnet/subnet3: - vpc/vpc: + subnet/subnet3 -> vpc/vpc: + subnet/subnet4: + subnet/subnet4 -> vpc/vpc: ecr_image/lambda_function-image: ecr_image/lambda_function-image -> ecr_repo/lambda_function-image-ecr_repo: @@ -21,16 +28,9 @@ resources: subnet/subnet2: subnet/subnet2 -> vpc/vpc: - subnet/subnet3: + ecr_repo/lambda_function-image-ecr_repo: - subnet/subnet3 -> vpc/vpc: - subnet/subnet4: + log_group/lambda_function-log-group: - subnet/subnet4 -> vpc/vpc: - lambda_function/lambda_function: + vpc/vpc: - lambda_function/lambda_function -> ecr_image/lambda_function-image: - lambda_function/lambda_function -> iam_role/lambda_function-executionrole: - lambda_function/lambda_function -> aws:security_group:vpc/lambda_function-security_group: - lambda_function/lambda_function -> subnet/subnet1: - lambda_function/lambda_function -> subnet/subnet2: diff --git a/pkg/engine/testdata/vpc_import_wo_subnets_to_lambda.iac-viz.yaml b/pkg/engine/testdata/vpc_import_wo_subnets_to_lambda.iac-viz.yaml index 11f214e13..18b71ad4d 100644 --- a/pkg/engine/testdata/vpc_import_wo_subnets_to_lambda.iac-viz.yaml +++ b/pkg/engine/testdata/vpc_import_wo_subnets_to_lambda.iac-viz.yaml @@ -1,51 +1,53 @@ provider: aws resources: - ecr_repo/lambda_function-image-ecr_repo: - - elastic_ip/lambda_function-vpc-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function: - elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: + lambda_function/lambda_function -> ecr_image/lambda_function-image: + lambda_function/lambda_function -> iam_role/lambda_function-executionrole: + lambda_function/lambda_function -> aws:security_group:vpc/lambda_function-security_group: + lambda_function/lambda_function -> aws:subnet:vpc/lambda_function-vpc: + lambda_function/lambda_function -> aws:subnet:vpc/subnet-1: + route_table_association/lambda_function-vpc-lambda_function-vpc-route_table: - log_group/lambda_function-log-group: + route_table_association/lambda_function-vpc-lambda_function-vpc-route_table -> aws:route_table:vpc/lambda_function-vpc-route_table: + route_table_association/lambda_function-vpc-lambda_function-vpc-route_table -> aws:subnet:vpc/lambda_function-vpc: + route_table_association/subnet-1-subnet-1-route_table: - region/region-0: + route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc/subnet-1-route_table: + route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc/subnet-1: + route_table_association/subnet-2-subnet-2-route_table: - vpc/vpc: + route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc/subnet-2-route_table: + route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc/subnet-2: + route_table_association/subnet-3-subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc/subnet-3-route_table: + route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc/subnet-3: ecr_image/lambda_function-image: ecr_image/lambda_function-image -> ecr_repo/lambda_function-image-ecr_repo: iam_role/lambda_function-executionrole: iam_role/lambda_function-executionrole -> log_group/lambda_function-log-group: - aws:availability_zone:region-0/availability_zone-0: - - aws:availability_zone:region-0/availability_zone-0 -> region/region-0: - aws:availability_zone:region-0/availability_zone-1: - - aws:availability_zone:region-0/availability_zone-1 -> region/region-0: - aws:internet_gateway:vpc/internet_gateway-0: - - aws:internet_gateway:vpc/internet_gateway-0 -> vpc/vpc: aws:security_group:vpc/lambda_function-security_group: aws:security_group:vpc/lambda_function-security_group -> vpc/vpc: + aws:route_table:vpc/lambda_function-vpc-route_table: + + aws:route_table:vpc/lambda_function-vpc-route_table -> aws:nat_gateway:subnet-2/lambda_function-vpc-route_table-nat_gateway: + aws:route_table:vpc/lambda_function-vpc-route_table -> vpc/vpc: aws:subnet:vpc/lambda_function-vpc: aws:subnet:vpc/lambda_function-vpc -> aws:availability_zone:region-0/availability_zone-0: aws:subnet:vpc/lambda_function-vpc -> vpc/vpc: - aws:subnet:vpc/subnet-2: + aws:route_table:vpc/subnet-1-route_table: - aws:subnet:vpc/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: - aws:subnet:vpc/subnet-2 -> vpc/vpc: + aws:route_table:vpc/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: + aws:route_table:vpc/subnet-1-route_table -> vpc/vpc: aws:subnet:vpc/subnet-1: aws:subnet:vpc/subnet-1 -> aws:availability_zone:region-0/availability_zone-1: aws:subnet:vpc/subnet-1 -> vpc/vpc: - aws:subnet:vpc/subnet-3: - - aws:subnet:vpc/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: - aws:subnet:vpc/subnet-3 -> vpc/vpc: aws:route_table:vpc/subnet-2-route_table: aws:route_table:vpc/subnet-2-route_table -> aws:internet_gateway:vpc/internet_gateway-0: @@ -54,42 +56,40 @@ resources: aws:route_table:vpc/subnet-3-route_table -> aws:internet_gateway:vpc/internet_gateway-0: aws:route_table:vpc/subnet-3-route_table -> vpc/vpc: + ecr_repo/lambda_function-image-ecr_repo: + + log_group/lambda_function-log-group: + aws:nat_gateway:subnet-2/lambda_function-vpc-route_table-nat_gateway: aws:nat_gateway:subnet-2/lambda_function-vpc-route_table-nat_gateway -> elastic_ip/lambda_function-vpc-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-2/lambda_function-vpc-route_table-nat_gateway -> aws:subnet:vpc/subnet-2: - lambda_function/lambda_function: - - lambda_function/lambda_function -> ecr_image/lambda_function-image: - lambda_function/lambda_function -> iam_role/lambda_function-executionrole: - lambda_function/lambda_function -> aws:security_group:vpc/lambda_function-security_group: - lambda_function/lambda_function -> aws:subnet:vpc/lambda_function-vpc: - lambda_function/lambda_function -> aws:subnet:vpc/subnet-1: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway -> aws:subnet:vpc/subnet-3: - route_table_association/subnet-2-subnet-2-route_table: + aws:internet_gateway:vpc/internet_gateway-0: - route_table_association/subnet-2-subnet-2-route_table -> aws:route_table:vpc/subnet-2-route_table: - route_table_association/subnet-2-subnet-2-route_table -> aws:subnet:vpc/subnet-2: - route_table_association/subnet-3-subnet-3-route_table: + aws:internet_gateway:vpc/internet_gateway-0 -> vpc/vpc: + elastic_ip/lambda_function-vpc-route_table-nat_gateway-elastic_ip: - route_table_association/subnet-3-subnet-3-route_table -> aws:route_table:vpc/subnet-3-route_table: - route_table_association/subnet-3-subnet-3-route_table -> aws:subnet:vpc/subnet-3: - aws:route_table:vpc/lambda_function-vpc-route_table: + aws:subnet:vpc/subnet-2: - aws:route_table:vpc/lambda_function-vpc-route_table -> aws:nat_gateway:subnet-2/lambda_function-vpc-route_table-nat_gateway: - aws:route_table:vpc/lambda_function-vpc-route_table -> vpc/vpc: - aws:route_table:vpc/subnet-1-route_table: + aws:subnet:vpc/subnet-2 -> aws:availability_zone:region-0/availability_zone-0: + aws:subnet:vpc/subnet-2 -> vpc/vpc: + elastic_ip/subnet-1-route_table-nat_gateway-elastic_ip: - aws:route_table:vpc/subnet-1-route_table -> aws:nat_gateway:subnet-3/subnet-1-route_table-nat_gateway: - aws:route_table:vpc/subnet-1-route_table -> vpc/vpc: - route_table_association/lambda_function-vpc-lambda_function-vpc-route_table: + aws:subnet:vpc/subnet-3: - route_table_association/lambda_function-vpc-lambda_function-vpc-route_table -> aws:route_table:vpc/lambda_function-vpc-route_table: - route_table_association/lambda_function-vpc-lambda_function-vpc-route_table -> aws:subnet:vpc/lambda_function-vpc: - route_table_association/subnet-1-subnet-1-route_table: + aws:subnet:vpc/subnet-3 -> aws:availability_zone:region-0/availability_zone-1: + aws:subnet:vpc/subnet-3 -> vpc/vpc: + aws:availability_zone:region-0/availability_zone-0: + + aws:availability_zone:region-0/availability_zone-0 -> region/region-0: + aws:availability_zone:region-0/availability_zone-1: + + aws:availability_zone:region-0/availability_zone-1 -> region/region-0: + vpc/vpc: + + region/region-0: - route_table_association/subnet-1-subnet-1-route_table -> aws:route_table:vpc/subnet-1-route_table: - route_table_association/subnet-1-subnet-1-route_table -> aws:subnet:vpc/subnet-1: diff --git a/pkg/graph_addons/topology.go b/pkg/graph_addons/topology.go index 17a805343..0bbb3e88d 100644 --- a/pkg/graph_addons/topology.go +++ b/pkg/graph_addons/topology.go @@ -39,6 +39,9 @@ func topologicalSort[K comparable](deps map[K]map[K]graph.Edge[K], less func(K, enqueue(vertex) } } + sort.Slice(queue, func(i, j int) bool { + return less(queue[i], queue[j]) + }) // enqueueArbitrary enqueues an arbitray but deterministic id from the remaining unvisited ids. // It should only be used if len(queue) == 0 && len(deps) > 0 @@ -69,10 +72,6 @@ func topologicalSort[K comparable](deps map[K]map[K]graph.Edge[K], less func(K, order := make([]K, 0, len(deps)) visited := make(map[K]struct{}) - sort.Slice(queue, func(i, j int) bool { - return less(queue[i], queue[j]) - }) - for len(queue) > 0 { currentVertex := queue[0] queue = queue[1:] diff --git a/pkg/visualizer/file.go b/pkg/visualizer/file.go index afed11d69..b2ea848c2 100644 --- a/pkg/visualizer/file.go +++ b/pkg/visualizer/file.go @@ -37,7 +37,7 @@ func (f *File) WriteTo(w io.Writer) (n int64, err error) { wh.Writef("provider: %s\n", f.Provider) wh.Write("resources:\n") - resourceIds, err := construct.ReverseTopologicalSort(f.Graph) + resourceIds, err := construct.TopologicalSort(f.Graph) if err != nil { return }