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

Added AWS IAMGroup with UserMembership, and PolicyAttachment #249

Merged
merged 1 commit into from
Jul 10, 2020

Conversation

rahulchheda
Copy link
Contributor

@rahulchheda rahulchheda commented Jun 12, 2020

- Added CRUD operations for various resources
- Added test files for most of files (few exceptions are left, working on then actively)
- Added examples for each resource
- Added controllers for each resources

Signed-off-by: Rahul M Chheda rchheda@infracloud.io

Description of your changes

Checklist

I have:

  • Run make reviewable to ensure this PR is ready for review.
  • Ensured this PR contains a neat, self documenting set of commits.
  • Updated any relevant documentation, examples, or release notes.
  • Updated the dependencies in app.yaml to include any new role permissions.

@negz negz requested a review from muvaf June 15, 2020 17:09
type IAMGroupSpec struct {
runtimev1alpha1.ResourceSpec `json:",inline"`
// +optional
ForProvider IAMGroupParameters `json:"forProvider"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is a required field, so should not be annotated with optional


// An IAMGroupPolicyAttachment is a managed resource that represents an AWS IAM
// Group policy attachment.
// +kubebuilder:printcolumn:name="USERNAME",type="string",JSONPath=".spec.forProvider.groupName"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The column name should be GROUPNAME I assume.

// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
type IAMUserGroupAttachment struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would IAMGroupUserMembership be a good name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, seems good and pushed the changes

}

// GenerateIAMGroup assigns the in IAMGroupParameters to group.
func GenerateIAMGroup(in v1alpha1.IAMGroupParameters, role *iam.Group) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function being used anywhere?

@@ -0,0 +1 @@
package iam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this file.

@@ -0,0 +1 @@
package iam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this file maybe.

func (e *external) Update(ctx context.Context, mgd resource.Managed) (managed.ExternalUpdate, error) {
// Updating any field will create a new User-Policy attachment in AWS, which will be
// irrelevant/out-of-sync to the original defined attachment.
// It is encouraged to instead create a new IAMUserPolicyAttachment resource.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It is encouraged to instead create a new IAMUserPolicyAttachment resource.
// It is encouraged to instead create a new IAMUserGroupAttachment resource.

}

func (e *external) Update(ctx context.Context, mgd resource.Managed) (managed.ExternalUpdate, error) {
// Updating any field will create a new User-Policy attachment in AWS, which will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Updating any field will create a new User-Policy attachment in AWS, which will be
// Updating any field will create a new User-Group attachment in AWS, which will be

@rahulchheda rahulchheda changed the title Added AWS IAMGroup with UserAttachment, and PolicyAttachment Added AWS IAMGroup with UserMembership, and PolicyAttachment Jun 23, 2020
@muvaf muvaf added this to In progress in v0.13 via automation Jun 23, 2020
// PolicyARN is the Amazon Resource Name (ARN) of the IAM policy you want to
// attach.
// +immutable
PolicyARN string `json:"policyArn"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a reference to the IAMPolicy resource can also be added here.

// GroupName is the Amazon IAM Group Name (IAMGroup) of the IAM group you want to
// add User to.
// +immutable
GroupName string `json:"groupName"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, we can add a reference to the IAMGroup resource.

@negz
Copy link
Member

negz commented Jul 1, 2020

Hi @rahulchheda and @sahil-lakhwani,

Can you please comment here when you've finished your internal review and feel this PR is ready for @muvaf to review.

Thanks,
Nic

@negz
Copy link
Member

negz commented Jul 1, 2020

Also - it seems like this PR may need to be rebased on master. I see a lot of unrelated commits in the history.

@rahulchheda
Copy link
Contributor Author

Apologies @negz and @muvaf , fixed the rebase issue on this PR. I think this PR is ready for review. I guess internal reviews have been done, or @sahil-lakhwani , would you like to take one more pass?

// PolicyARN is the Amazon Resource Name (ARN) of the IAM policy you want to
// attach.
// +immutable
PolicyARN string `json:"policyArn,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be annotated with +optional and should be of pointer type.


// GroupName presents the name of the IAMGroup.
// +immutable
GroupName string `json:"groupName,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, the filed should be annotated with +optional and be of pointer type.

// GroupName is the Amazon IAM Group Name (IAMGroup) of the IAM group you want to
// add User to.
// +immutable
GroupName string `json:"groupName,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as well, GroupName should be pointer type.

@negz
Copy link
Member

negz commented Jul 3, 2020

Thanks @rahulchheda and @sahil-lakhwani! Looks like there's a little more review to go. I'll wait until @sahil-lakhwani has approved this PR before we have a maintainer review it.

@sahil-lakhwani
Copy link
Contributor

@negz The PR looks good to me after the latest commit. I think it's ready for you to review.

Copy link
Member

@muvaf muvaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rahulchheda and @sahil-lakhwani , really impressed!

It looks pretty good already. I have left a few small comments. It should be ready to merge after they are addressed.

pkg/controller/identity/iamgroup/controller.go Outdated Show resolved Hide resolved
pkg/controller/identity/iamgroup/controller.go Outdated Show resolved Hide resolved
pkg/controller/identity/iamgroup/controller.go Outdated Show resolved Hide resolved
@rahulchheda
Copy link
Contributor Author

@muvaf , I'm done with the changes, could you take a look? If it's good, remind me to squash my commits.

Copy link
Member

@muvaf muvaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after fixing two small things for test to pass and the commit history. Thanks!

v0.13 automation moved this from In progress to PR open Jul 10, 2020
Signed-off-by: Rahul M Chheda <rchheda@infracloud.io>
@muvaf muvaf merged commit 176a1f9 into crossplane-contrib:master Jul 10, 2020
v0.13 automation moved this from PR open to Done Jul 10, 2020
wolffbe pushed a commit to wolffbe/provider-aws that referenced this pull request Feb 12, 2021
Added AWS IAMGroup with UserMembership, and PolicyAttachment
namku pushed a commit to namku/provider-aws that referenced this pull request Mar 9, 2021
Added AWS IAMGroup with UserMembership, and PolicyAttachment
@negz negz removed this from Done in v0.13 May 26, 2022
tektondeploy pushed a commit to gtn3010/provider-aws that referenced this pull request Mar 12, 2024
DynamoDB: add aws_dynamodb_tag resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants