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

feat: Add azuredevops_group_entitlment #870

Merged
merged 8 commits into from
Sep 8, 2023

Conversation

stanleyz
Copy link
Contributor

This change is based on PR #707, most of the work should be credited to marley-ma.

#707

"

All Submissions:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code follows the code style of this project.
  • I ran lint checks locally prior to submission.
  • Have you checked to ensure there aren't other open PRs for the same update/change?

What about the current behavior has changed?

Issue Number:

#700

Issue Number: 700

Does this introduce a change to go.mod, go.sum or vendor/?

  • Yes
  • No

Does this introduce a breaking change?

  • Yes
  • No

Any relevant logs, error output, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Other information

This change is based on PR microsoft#707, most of the work should be credited to
marley-ma.

microsoft#707

Co-authored-by: marley-ma <https://github.com/marley-ma>
Co-authored-by: stanleyz <https://github.com/stanleyz>"
Copy link
Collaborator

@xuzhang3 xuzhang3 left a comment

Choose a reason for hiding this comment

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

@stanleyz A few changes requested, others looks good to me.
Document website/docs/r/group_entitlement.html.markdown need to be documented in azuredevops.erb

README.md Show resolved Hide resolved
Comment on lines 254 to 256
if !uuidRegexp.MatchString(upn) {
return nil, fmt.Errorf("Only UUID values can used for import [%s]", upn)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if !uuidRegexp.MatchString(upn) {
return nil, fmt.Errorf("Only UUID values can used for import [%s]", upn)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is still required, uuid.parse doesn't valid the same as this regex. See the function TestGroupEntitlement_Import_TestInvalidValue in resource_group_entitlement_test.go

Copy link
Collaborator

Choose a reason for hiding this comment

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

The d.id() is from service which we can trust is a valid UUID. If the ID is not a valid UUID, there is a something wrong with the service

Copy link
Contributor Author

Choose a reason for hiding this comment

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

normally yes, however this function is for importing existing resource, you can't guarantee the users will always have a valid UUID supplied, it's not a big deal but additional check with nice error message always helps.

Copy link
Collaborator

@xuzhang3 xuzhang3 Sep 6, 2023

Choose a reason for hiding this comment

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

UUID already check by _, err := uuid.Parse(d.Id()), no need to verify twice

Copy link
Contributor Author

@stanleyz stanleyz Sep 7, 2023

Choose a reason for hiding this comment

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

cool, updated. That was my impression in the first look, double checked, there was a logic error in the test, not the uuid.Parse. I've updated the test and import function.

stanleyz and others added 4 commits September 4, 2023 21:46
…rce_group_entitlement.go

Co-authored-by: xuzhang3 <57888764+xuzhang3@users.noreply.github.com>
Co-authored-by: xuzhang3 <57888764+xuzhang3@users.noreply.github.com>
@stanleyz
Copy link
Contributor Author

stanleyz commented Sep 4, 2023

@stanleyz A few changes requested, others looks good to me. Document website/docs/r/group_entitlement.html.markdown need to be documented in azuredevops.erb

@xuzhang3 I've added the link to the azuredevops.erb, also commented on the ones that haven't been resolved, can you please check? Thanks.

@xuzhang3
Copy link
Collaborator

xuzhang3 commented Sep 8, 2023

=== RUN   TestAccGroupEntitlement_Create
=== PAUSE TestAccGroupEntitlement_Create
=== RUN   TestAccGroupEntitlement_AAD_Create
=== PAUSE TestAccGroupEntitlement_AAD_Create
=== CONT  TestAccGroupEntitlement_Create
=== CONT  TestAccGroupEntitlement_AAD_Create
--- PASS: TestAccGroupEntitlement_AAD_Create (32.29s)
--- PASS: TestAccGroupEntitlement_Create (32.78s)
PASS
ok      github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/acceptancetests        38.848s

@xuzhang3 xuzhang3 merged commit ebbda03 into microsoft:main Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants