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

Update project shared_with_groups option: change type to TypeSet #86

Merged
merged 2 commits into from
Feb 8, 2019

Conversation

jorcau
Copy link
Collaborator

@jorcau jorcau commented Feb 7, 2019

Hi,

This is a small fix for the shared_with_groups option in the project resource.

This makes shared_with_groups a TypeSet instead of TypeList in order to discard group list order and improve the plan.

@ghost ghost added the size/XS label Feb 7, 2019
@jorcau
Copy link
Collaborator Author

jorcau commented Feb 7, 2019

Acceptance tests results:

➜ make testacc TEST=./gitlab TESTARGS='-run=TestAccGitlabProject_*'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./gitlab -v -run=TestAccGitlabProject_* -timeout 120m
=== RUN   TestAccGitlabProjectHook_basic
--- PASS: TestAccGitlabProjectHook_basic (10.22s)
=== RUN   TestAccGitlabProjectMembership_basic
--- PASS: TestAccGitlabProjectMembership_basic (9.79s)
=== RUN   TestAccGitlabProject_basic
--- PASS: TestAccGitlabProject_basic (16.57s)
=== RUN   TestAccGitlabProject_import
--- PASS: TestAccGitlabProject_import (7.33s)
=== RUN   TestAccGitlabProject_nestedImport
--- PASS: TestAccGitlabProject_nestedImport (7.31s)
=== RUN   TestAccGitlabProjectVariable_basic
--- PASS: TestAccGitlabProjectVariable_basic (10.67s)
PASS
ok  	github.com/terraform-providers/terraform-provider-gitlab/gitlab	61.923s

@pdecat
Copy link
Contributor

pdecat commented Feb 7, 2019

@jorcau how does it behave on existing states? No weird behavior?

gitlab/resource_gitlab_project.go Outdated Show resolved Hide resolved
gitlab/resource_gitlab_project.go Outdated Show resolved Hide resolved
gitlab/resource_gitlab_project_test.go Outdated Show resolved Hide resolved
@jorcau
Copy link
Collaborator Author

jorcau commented Feb 7, 2019

@jorcau how does it behave on existing states? No weird behavior?

@pdecat It works seamlessly with existing states. No diff at plan.

@jorcau jorcau force-pushed the fix_project_shared-with-groups branch from b8a5d84 to e5c8d95 Compare February 7, 2019 17:05
@ghost ghost added size/S and removed size/XS labels Feb 7, 2019
if v, ok := d.GetOk("shared_with_groups"); ok {
options := expandSharedWithGroupsOptions(v.([]interface{}))
if _, ok := d.GetOk("shared_with_groups"); ok {
options := expandSharedWithGroupsOptions(d)
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not mean to pass d but v 😕

@@ -298,10 +298,11 @@ func resourceGitlabProjectDelete(d *schema.ResourceData, meta interface{}) error
return nil
}

func expandSharedWithGroupsOptions(d []interface{}) []*gitlab.ShareWithGroupOptions {
func expandSharedWithGroupsOptions(d *schema.ResourceData) []*gitlab.ShareWithGroupOptions {
v := d.Get("shared_with_groups").(*schema.Set).List()
Copy link
Contributor

Choose a reason for hiding this comment

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

The d.Get("shared_with_groups") part should have stayed outside.

@jorcau jorcau force-pushed the fix_project_shared-with-groups branch from e5c8d95 to 1a159c2 Compare February 8, 2019 09:51
@ghost ghost added size/XS and removed size/S labels Feb 8, 2019
@roidelapluie roidelapluie merged commit d2f7ebb into gitlabhq:master Feb 8, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 participants