Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws/resources: Befor importing 'aws_iam_user_group_membership' check grups names #107

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
- Provide filters to resource functions instead of tags only
([PR #92](https://github.com/cycloidio/terracognita/pull/92))

## Fixed

- Error when importing `aws_iam_user_group_membership` without groups
([Issue #104](https://github.com/cycloidio/terracognita/issues/104))

## [0.4.0] _2020-03-31_

### Added
Expand Down
8 changes: 7 additions & 1 deletion aws/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,14 @@ func iamUserGroupMemberships(ctx context.Context, a *aws, resourceType string, f
if err != nil {
return nil, err
}

resources := make([]provider.Resource, 0)

// If the user has no Groups then we do not need to proceed
// or TF will return an error of malformed ID
if len(groupNames) == 0 {
return resources, nil
}

for _, un := range userNames {
// The format expected by TF is <user-name>/<group-name1>/...
r, err := initializeResource(a, strings.Join(append([]string{un}, groupNames...), "/"), resourceType)
Expand Down