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

Add SAML Group link resource #1215

Closed
wants to merge 9 commits into from

Conversation

mhodgson
Copy link
Contributor

@mhodgson mhodgson commented Aug 16, 2022

Description

Closes #503, #1214

BLOCKED: Note this requires an update to the Gitlab Go Client. a PR for the required update is here: xanzy/go-gitlab#1527

PR Checklist Acknowledgement

  • I acknowledge that all of the following items are true, where applicable:
    • Resource attributes match 1:1 the names and structure of the API resource in the GitLab API documentation.
    • Examples are updated with:
      • A *.tf file for the resource/s with at least one usage example
      • A *.sh file for the resource/s with an import example (if applicable)
    • New resources have at minimum a basic test with three steps:
      • Create the resource
      • Update the attributes
      • Import the resource
    • No new //lintignore comments were copied from existing code. (Linter rules are meant to be enforced on new code.)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @mhodgson 👋

It looks like this is your first submission to the Terraform GitLab Provider! If you haven’t already done so, please make sure you have checked out our CONTRIBUTING.md guide to make sure your contribution has all the necessary elements in place for a successful approval.

Thanks again, and welcome to the community! 😃

@PatrickRice-KSC PatrickRice-KSC added this to the v3.17.0 milestone Aug 16, 2022
@PatrickRice-KSC
Copy link
Collaborator

nice @mhodgson - thanks for the submission! I've thrown a watch on the xanzy repo upstream to see when that's merged. @timofurrer - were you added a maintainer there for reviews? I know we'd talked about that in one of the community hours.

Copy link
Member

@timofurrer timofurrer left a comment

Choose a reason for hiding this comment

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

Hey @mhodgson 👋

Thanks for the contribution! I think it's going into the right direction 🎉

I've added a few suggestions and things to align with the other recently added resources and styles and a some nitpicks.

Back to you 🏓

internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/resource_gitlab_group_saml_link.go Outdated Show resolved Hide resolved
internal/provider/access_level_helpers.go Outdated Show resolved Hide resolved
@timofurrer
Copy link
Member

nice @mhodgson - thanks for the submission! I've thrown a watch on the xanzy repo upstream to see when that's merged. @timofurrer - were you added a maintainer there for reviews? I know we'd talked about that in one of the community hours.

No, I haven't unfortunately. However, I've just given the change set here an initial review! @PatrickRice-KSC feel free to add your comments to and @mhodgson let us know if you need anything! I'm looking forward to have this resource in the provider 🎉

@timofurrer timofurrer linked an issue Aug 16, 2022 that may be closed by this pull request
1 task
@mhodgson
Copy link
Contributor Author

@timofurrer just as a general FYI, I mostly copied the gitlab_group_ldap_link existing resource and code since it is very similar. Looking through your comments now, thanks for the quick review!

@timofurrer
Copy link
Member

@timofurrer just as a general FYI, I mostly copied the gitlab_group_ldap_link existing resource and code since it is very similar. Looking through your comments now, thanks for the quick review!

Yeah ... Unfortunately, some resources are quite old and desperately need some love. Sorry for the inconvenience 🙏

@timofurrer
Copy link
Member

@mhodgson @PatrickRice-KSC see my comment here: xanzy/go-gitlab#1527 (comment)

I think if the upstream MR can get into 15.3 we can simplify this resource a bit and don't have to search for the proper saml group link in response from the list endpoint. If it doesn't make it - we can merge as-is I guess.

@PatrickRice-KSC
Copy link
Collaborator

@mhodgson - in case you didn't see the comment thread on the upstream gitlab issue, the API has been updated to accept the integer values instead of the string values to match other APIs 🙂

@timofurrer
Copy link
Member

@mhodgson I've integrated the latest go-gitlab release in main (#1224). Any change for you to rebase and update this PR accordingly for a release tomorrow?

timofurrer added a commit to timofurrer/go-gitlab that referenced this pull request Aug 23, 2022
While working on gitlabhq/terraform-provider-gitlab#1215
I have noticed that the access level type introcued in
xanzy#1527
is wrong.
@timofurrer
Copy link
Member

@mhodgson I've added an additional fix in go-gitlab: xanzy/go-gitlab#1531

Could you please enable that maintainer of this repository can change the PR change set? I've added some cleanup things on a commit on this branch: https://github.com/gitlabhq/terraform-provider-gitlab/pull/new/feature/saml-group-links

@mhodgson
Copy link
Contributor Author

@timofurrer do you know how I enable that? I don't see that permission.

@mhodgson
Copy link
Contributor Author

@timofurrer I'm very sorry, but I do not see anything that resembles what the document you link suggests.

Screen Shot 2022-08-23 at 11 13 10 AM

@mhodgson
Copy link
Contributor Author

@timofurrer I cherry-picked your commit.

@timofurrer
Copy link
Member

@mhodgson you also need to rebase to latest main to get the go-gitlab update :)

@mhodgson
Copy link
Contributor Author

@timofurrer how do we exclude < 15.3 from the acceptance test matrix for the tests for this resource?

@timofurrer
Copy link
Member

@mhodgson Good point!

You can use this pattern:

@mhodgson
Copy link
Contributor Author

@timofurrer I think it's good to go now. Looks like it just needs approval from your review.

@timofurrer
Copy link
Member

@mhodgson btw. something went wrong with your latest rebase I think (looking at the diff) 🤔

@github-actions github-actions bot removed the merge-conflict PR cannot be merged due to a merge conflict label Aug 24, 2022
@github-actions
Copy link

Conflicts are resolved. Thank you! 😀

@mhodgson
Copy link
Contributor Author

@timofurrer sorry, rebased against origin instead of upstream. Rookie mistake...

I wouldn't say this is super urgent, but not sure on timeline for next release. I'd like to try to get it in the next few weeks if possible.

@timofurrer
Copy link
Member

@mhodgson AFAIK, this will get into a bug fix release 15.3.2 - not sure when it's released though. You may follow it a little here:

@PatrickRice-KSC
Copy link
Collaborator

PatrickRice-KSC commented Aug 24, 2022

@mhodgson Fair point! The reason to wait for me is to make sure it really works - which it didn't until my latest comments for the latest changes on SaaS (I know this has been very confusing and changed last second). However, we can test this manually if it's urgent for you and release it sooner.

I think it makes sense to push it with a bugfix version just because it's so widely used, and would be extremely nice to use within the provider (we plan to use it as soon as it's available too 🙂 ).

@timofurrer
Copy link
Member

@mhodgson I've integrated the latest GitLab bugfix release in #1238 which includes the required changes in the SAML API.

Do you have time to rebase this PR today? I'd be ready for a release today with #1239 .

@timofurrer timofurrer removed the blocked We are currently blocked to implement this label Aug 31, 2022
@timofurrer
Copy link
Member

@mhodgson false alarm :'( I've just learned that apparently this didn't make it into 15.3.2 as was planned: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96117#note_1083680405

gravis pushed a commit to gravis/go-gitlab that referenced this pull request Sep 1, 2022
While working on gitlabhq/terraform-provider-gitlab#1215
I have noticed that the access level type introcued in
xanzy#1527
is wrong.
gravis pushed a commit to gravis/go-gitlab that referenced this pull request Sep 1, 2022
While working on gitlabhq/terraform-provider-gitlab#1215
I have noticed that the access level type introcued in
xanzy#1527
is wrong.
@timofurrer
Copy link
Member

I'm closing this in favor of #1243 - in the spirits of releasing today!

Thanks @mhodgson for the nice contribution 🎉

@timofurrer timofurrer closed this Sep 5, 2022
@github-actions
Copy link

github-actions bot commented Sep 5, 2022

This functionality has been released in v3.18.0 of the Terraform GitLab Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants