class
Analyzer::Specification::Terraform
- Analyzer::Specification::Terraform
- Analyzer
- Reference
- Object
Overview
Extracts HTTP endpoints from Terraform / OpenTofu configurations that declare AWS API Gateway routes. Two shapes are covered, mirroring the CloudFormation analyzer:
- API Gateway v2 (HTTP / WebSocket) —
aws_apigatewayv2_routecarries a self-containedroute_key = "GET /path", so it resolves per file. - API Gateway v1 (REST) —
aws_api_gateway_resource+aws_api_gateway_methodform a reference graph. Terraform merges every.tffile in a module directory into one config, so the graph is resolved per directory, not per file.
Both HCL (.tf) and Terraform JSON (.tf.json) inputs are supported.
Defined in:
analyzer/analyzers/specification/terraform.crConstant Summary
-
HTTP_METHODS =
{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "ANY"} -
METHOD_ANY =
"ANY" -
REF_ATTRS =
{"parent_id", "resource_id"} -
RESOURCE_TYPE_REST_M =
"aws_api_gateway_method" -
RESOURCE_TYPE_REST_R =
"aws_api_gateway_resource" -
RESOURCE_TYPE_V2 =
"aws_apigatewayv2_route" -
TARGET_ATTRS =
{"route_key", "path_part", "parent_id", "resource_id", "http_method"} -
Attributes the analyzer reads out of a resource body. Everything else is skipped while scanning.
route_key/path_part/http_methodare only meaningful as literal strings — a computed value (each.value.method,"${var.path}") can't be resolved statically, so they are captured from quoted strings only.resource_id/parent_idare by nature references into the resource graph, so they are captured from bare expressions too.