Skip to content

Commit

Permalink
Add support for aws_appautoscaling_target
Browse files Browse the repository at this point in the history
  • Loading branch information
kishaningithub committed Sep 30, 2024
1 parent 97689be commit e8e57ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func computeResourceID(resource parser.TerraformResource) string {
return fmt.Sprintf("%s/%s/%s", getValue("id"), getValue("name"), getValue("scope"))
case "aws_autoscaling_schedule":
return fmt.Sprintf("%s/%s", getValue("autoscaling_group_name"), getValue("scheduled_action_name"))
case "aws_appautoscaling_target":
return fmt.Sprintf("%s/%s/%s", getValue("service_namespace"), getValue("resource_id"), getValue("scalable_dimension"))
default:
return getValue("id")
}
Expand Down
17 changes: 17 additions & 0 deletions pkg/convertor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,23 @@ func Test_ComputeTerraformImportForResource(t *testing.T) {
SupportsImport: true,
},
},
{
name: "For aws_appautoscaling_target",
terraformResource: parser.TerraformResource{
Address: "aws_appautoscaling_target.test",
Type: "aws_appautoscaling_target",
AttributeValues: map[string]any{
"service_namespace": "service_namespace",
"resource_id": "resource_id",
"scalable_dimension": "scalable_dimension",
},
},
expected: TerraformImport{
ResourceAddress: "aws_appautoscaling_target.test",
ResourceID: "service_namespace/resource_id/scalable_dimension",
SupportsImport: true,
},
},
{
name: "For everything else",
terraformResource: parser.TerraformResource{
Expand Down

0 comments on commit e8e57ee

Please sign in to comment.