@@ -2,9 +2,10 @@ package tfimportgen
2
2
3
3
import (
4
4
"fmt"
5
- "github.com/kishaningithub/tf-import-gen/pkg/internal/parser"
6
5
"slices"
7
6
"strings"
7
+
8
+ "github.com/kishaningithub/tf-import-gen/pkg/internal/parser"
8
9
)
9
10
10
11
func computeTerraformImportForResource (resource parser.TerraformResource ) TerraformImport {
@@ -58,6 +59,8 @@ func computeResourceID(resource parser.TerraformResource) string {
58
59
return fmt .Sprintf ("%s/%s" , v ("function_name" ), v ("statement_id" ))
59
60
case "aws_security_group_rule" :
60
61
return computeResourceIDForAWSSecurityGroupRole (resource )
62
+ case "aws_network_acl_rule" :
63
+ return computeResourceIdForAWSNetworkACLRule (resource )
61
64
case "aws_api_gateway_resource" , "aws_api_gateway_deployment" :
62
65
return fmt .Sprintf ("%s/%s" , v ("rest_api_id" ), v ("id" ))
63
66
case "aws_api_gateway_stage" :
@@ -76,6 +79,8 @@ func computeResourceID(resource parser.TerraformResource) string {
76
79
return fmt .Sprintf ("%s|%s" , v ("plan_id" ), v ("id" ))
77
80
case "aws_vpc_endpoint_route_table_association" :
78
81
return fmt .Sprintf ("%s/%s" , v ("vpc_endpoint_id" ), v ("route_table_id" ))
82
+ case "aws_vpc_endpoint_subnet_association" :
83
+ return fmt .Sprintf ("%s/%s" , v ("vpc_endpoint_id" ), v ("subnet_id" ))
79
84
case "aws_cognito_user_pool_client" :
80
85
return fmt .Sprintf ("%s/%s" , v ("user_pool_id" ), v ("id" ))
81
86
case "aws_ecs_cluster" :
@@ -220,6 +225,14 @@ func computeResourceIDForAWSSecurityGroupRole(resource parser.TerraformResource)
220
225
return resourceID
221
226
}
222
227
228
+ func computeResourceIdForAWSNetworkACLRule (resource parser.TerraformResource ) string {
229
+ networkACLId := fmt .Sprint (resource .AttributeValues ["network_acl_id" ])
230
+ ruleNumber := fmt .Sprint (resource .AttributeValues ["rule_number" ])
231
+ protocol := fmt .Sprint (resource .AttributeValues ["protocol" ])
232
+ egress := fmt .Sprint (resource .AttributeValues ["egress" ])
233
+ return fmt .Sprintf ("%s:%s:%s:%s" , networkACLId , ruleNumber , protocol , egress )
234
+ }
235
+
223
236
func convertToStrings (source []any ) []string {
224
237
var result []string
225
238
for _ , element := range source {
0 commit comments