Skip to content

Commit

Permalink
Add support for aws_api_gateway_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kishaningithub committed Dec 1, 2023
1 parent 66b2c6d commit 82960e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func computeResourceID(resource parser.TerraformResource) string {
return computeResourceIDForAWSSecurityGroupRole(resource)
case "aws_api_gateway_resource":
return fmt.Sprintf("%s/%s", getValue("rest_api_id"), getValue("id"))
case "aws_api_gateway_method":
case "aws_api_gateway_method", "aws_api_gateway_integration":
return fmt.Sprintf("%s/%s/%s", getValue("rest_api_id"), getValue("resource_id"), getValue("http_method"))
default:
return getValue("id")
Expand Down
16 changes: 16 additions & 0 deletions pkg/convertor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ func Test_ComputeTerraformImportForResource(t *testing.T) {
ResourceID: "rest_api_id/resource_id/http_method",
},
},
{
name: "For aws_api_gateway_integration",
terraformResource: parser.TerraformResource{
Address: "aws_api_gateway_integration.test",
Type: "aws_api_gateway_integration",
AttributeValues: map[string]any{
"http_method": "http_method",
"resource_id": "resource_id",
"rest_api_id": "rest_api_id",
},
},
expected: TerraformImport{
ResourceAddress: "aws_api_gateway_integration.test",
ResourceID: "rest_api_id/resource_id/http_method",
},
},
{
name: "For everything else",
terraformResource: parser.TerraformResource{
Expand Down

0 comments on commit 82960e4

Please sign in to comment.