Skip to content

Commit

Permalink
Add support for aws_backup_selection and aws_vpc_endpoint_route_table…
Browse files Browse the repository at this point in the history
…_association
  • Loading branch information
kishaningithub committed Jun 12, 2024
1 parent 5b530bf commit 3aeded4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func computeResourceID(resource parser.TerraformResource) string {
return fmt.Sprintf("%s/%s", getValue("user"), getValue("policy_arn"))
case "aws_emr_instance_group":
return fmt.Sprintf("%s/%s", getValue("cluster_id"), getValue("id"))
case "aws_backup_selection":
return fmt.Sprintf("%s|%s", getValue("plan_id"), getValue("id"))
case "aws_vpc_endpoint_route_table_association":
return fmt.Sprintf("%s/%s", getValue("vpc_endpoint_id"), getValue("route_table_id"))
default:
return getValue("id")
}
Expand Down
32 changes: 32 additions & 0 deletions pkg/convertor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,38 @@ func Test_ComputeTerraformImportForResource(t *testing.T) {
SupportsImport: true,
},
},
{
name: "For aws_backup_selection",
terraformResource: parser.TerraformResource{
Address: "aws_backup_selection.test",
Type: "aws_backup_selection",
AttributeValues: map[string]any{
"id": "id",
"plan_id": "plan_id",
},
},
expected: TerraformImport{
ResourceAddress: "aws_backup_selection.test",
ResourceID: "plan_id|id",
SupportsImport: true,
},
},
{
name: "For aws_vpc_endpoint_route_table_association",
terraformResource: parser.TerraformResource{
Address: "aws_vpc_endpoint_route_table_association.test",
Type: "aws_vpc_endpoint_route_table_association",
AttributeValues: map[string]any{
"vpc_endpoint_id": "vpc_endpoint_id",
"route_table_id": "route_table_id",
},
},
expected: TerraformImport{
ResourceAddress: "aws_vpc_endpoint_route_table_association.test",
ResourceID: "vpc_endpoint_id/route_table_id",
SupportsImport: true,
},
},
{
name: "For everything else",
terraformResource: parser.TerraformResource{
Expand Down

0 comments on commit 3aeded4

Please sign in to comment.