Skip to content

Commit

Permalink
Merge pull request #17 from kishaningithub/add-support-for-aws_iam_us…
Browse files Browse the repository at this point in the history
…er_policy_attachment

Add support for aws_iam_user_policy_attachment resource
  • Loading branch information
kishaningithub authored May 6, 2024
2 parents d415862 + bdd8091 commit a195a62
Show file tree
Hide file tree
Showing 2 changed files with 18 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 @@ -50,6 +50,8 @@ func computeResourceID(resource parser.TerraformResource) string {
return fmt.Sprintf("%s/%s/%s", getValue("rest_api_id"), getValue("resource_id"), getValue("http_method"))
case "aws_route_table_association":
return fmt.Sprintf("%s/%s", getValue("subnet_id"), getValue("route_table_id"))
case "aws_iam_user_policy_attachment":
return fmt.Sprintf("%s/%s", getValue("user"), getValue("policy_arn"))
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 @@ -215,6 +215,22 @@ func Test_ComputeTerraformImportForResource(t *testing.T) {
SupportsImport: true,
},
},
{
name: "For aws_iam_user_policy_attachment",
terraformResource: parser.TerraformResource{
Address: "aws_iam_user_policy_attachment.test",
Type: "aws_iam_user_policy_attachment",
AttributeValues: map[string]any{
"policy_arn": "policy_arn",
"user": "user",
},
},
expected: TerraformImport{
ResourceAddress: "aws_iam_user_policy_attachment.test",
ResourceID: "user/policy_arn",
SupportsImport: true,
},
},
{
name: "For everything else",
terraformResource: parser.TerraformResource{
Expand Down

0 comments on commit a195a62

Please sign in to comment.