Skip to content

Commit

Permalink
aws/resources: Befor importing 'aws_iam_user_group_membership' check …
Browse files Browse the repository at this point in the history
…grups names

If there is no groups we cannot import this resources so we should skip it
  • Loading branch information
xescugc committed Jun 2, 2020
1 parent bcbde16 commit 1154bd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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
6 changes: 6 additions & 0 deletions aws/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,12 @@ func iamUserGroupMemberships(ctx context.Context, a *aws, resourceType string, f
return nil, err
}

// 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 nil, nil
}

resources := make([]provider.Resource, 0)
for _, un := range userNames {
// The format expected by TF is <user-name>/<group-name1>/...
Expand Down

0 comments on commit 1154bd1

Please sign in to comment.