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

Import group labels #339

Merged
merged 3 commits into from
Aug 1, 2020
Merged

Conversation

aquavitae
Copy link
Contributor

This simply adds support for importing group labels, e.g.:

$ terraform import gitlab_deploy_key_enable.example 12345:fixme

@ghost ghost added size/M and removed size/XXL labels Jun 19, 2020
Copy link
Collaborator

@armsnyder armsnyder left a comment

Choose a reason for hiding this comment

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

Looks straight forward enough. Just one clarification.

return nil, err
}

err = resourceGitlabGroupLabelRead(d, meta)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it necessary to read here? Doesn't Terraform perform a read for you before the next operation anyway? I don't think it changes the provider behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly... I was modelling this on how all the other Importers were implemented?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes I think it makes sense to read and make sure the resource you try to import exists.

@roidelapluie roidelapluie merged commit 840a3fb into gitlabhq:master Aug 1, 2020
sfang97 pushed a commit to sfang97/terraform-provider-gitlab that referenced this pull request Sep 8, 2020
* add support for importing gitlab group labels

* fix resource name in the acceptance test

* convert group ID to string

Co-authored-by: David Townshend <david.townshend@allangray.co.za>
sfang97 pushed a commit to sfang97/terraform-provider-gitlab that referenced this pull request Sep 15, 2020
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600137187 -0500

parent 1cbab81
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600137111 -0500

parent 1cbab81
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600136946 -0500

Fix required Go version

Add instance clusters to Terraform provider

Add support for instance level cluster management via the Gitlab
Terraform provider.

Add instance cluster to provider

Add instance cluster go file

Add instance clusters to website

Only test read instance cluster for now

Add functionality to CRUD

Tests mostly passing now, except a weird invalid URL escape thing, will
investigate this

Remove instance_clusters.go from this PR

Contributed the instance API file to the upstream repo
github.com/xanzy/go-gitlab, so removing from this PR

Readding instance_clusters for failed pipeline

Replace required libary in go mod

Replace vendor with upstream in go mod

Remove vendor files

Remove changes to gitlab go

Remove instance clusters from README

Add management project param back in

Rerun CI build

Removing line for CI build

Rerun CI pipeline

Undo change to xanzy README

Undo another change to README

Change the commit to replace go-gitlab requirement

Add go mod vendor to travis

Move go mod vendors command to lint stage

Change function names based on vendor change

Remove replace package

feat: Add support to create projects from templates

Undo cherry pick

This reverts commit 5191839.

Update go mod to latest go-gitlab

Remove changes to travis

Remove newline for new pipeline

Update docs, no instance ID

Add backlashes so no italics

Remove instance from example usage

Remove white space, change instance link

Address PR comments

Add forcenew back to auth type

run make fmt

Prepare changelog for release

v2.11.0

Cleanup after v2.11.0 release

Fix Jira Service error handling (gitlabhq#363)

Fix nil pointer dereferences during error handling (gitlabhq#364)

* Fix error handling when deleting deploy key
There was the possibility of a panic if response was nil, and the GitLab client already treats the 204 code as a success, so the extra check was not needed.

* Fix nil pointer dereference issues in error messages

correct management_project_id argument in documentation (gitlabhq#368)

Fix incorrect description of valid access levels (gitlabhq#342)

This minor change corrects a mistake showing `master` as a valid level
of `group_access_level`.

Import group labels (gitlabhq#339)

* add support for importing gitlab group labels

* fix resource name in the acceptance test

* convert group ID to string

Co-authored-by: David Townshend <david.townshend@allangray.co.za>

Add importer to resource_gitlab_project_push_rules (gitlabhq#360)

* Add importer to resource_gitlab_project_push_rules

* Fix apparent copy-paste problem and inconsistency in push rules debug logs

Bump go-gitlab to v.0.34.1 (gitlabhq#378)

* Fix variable passed to ListLabelsOptions

Needed to fix nested struct format

* Don't need go mod changes

* Add back go mod

* Bump to 0.34.1

* Add 0.34.1 to modules.txt

* Revert "Add 0.34.1 to modules.txt"

This reverts commit 2ac4e3e.

* Add vendor files for bump

Co-authored-by: sfang97 <sfang@gitlab.com>

Renamed the Github organization after the migration to https://github.com/gitlabhq

Change isRunningInEE test

Fix import packages

Call configure in provider test

Only initialize provider in acceptance tests

Remove undefined resource reference

Add undefined testenvvar

Had to run make fmt

Remove unused variable

Reference testenvvar resource correctly

Add group_ldap_link to index

Signed-off-by: Sune Keller <absukl@almbrand.dk>

Adding project miorror and tests

responding to PR comments, removing import state verify for acceptance test

Setting all properties in SetToState

removed commented out ignore

adding docs page

adding to index

Store more attributes into the state

Fix missing test checks in the resource user

Allow to change user email address without creating a new resource

Fix the external flag being mapped to admin instead

Switching the external flag makes tests fail

Add new data source gitlab_group_membership

Allow to filter members by their access_level

Add new doc page to gitlab.erb

Update website/gitlab.erb

Co-authored-by: Adam Snyder <armsnyder@gmail.com>

Added Quotes in the example for group cluster

Prepare changelog for release

Cleanup after v2.11.0 release

Fix Jira Service error handling (gitlabhq#363)

Fix nil pointer dereferences during error handling (gitlabhq#364)

* Fix error handling when deleting deploy key
There was the possibility of a panic if response was nil, and the GitLab client already treats the 204 code as a success, so the extra check was not needed.

* Fix nil pointer dereference issues in error messages

correct management_project_id argument in documentation (gitlabhq#368)

Fix incorrect description of valid access levels (gitlabhq#342)

This minor change corrects a mistake showing `master` as a valid level
of `group_access_level`.

Import group labels (gitlabhq#339)

* add support for importing gitlab group labels

* fix resource name in the acceptance test

* convert group ID to string

Co-authored-by: David Townshend <david.townshend@allangray.co.za>

Add importer to resource_gitlab_project_push_rules (gitlabhq#360)

* Add importer to resource_gitlab_project_push_rules

* Fix apparent copy-paste problem and inconsistency in push rules debug logs

Bump go-gitlab to v.0.34.1 (gitlabhq#378)

* Fix variable passed to ListLabelsOptions

Needed to fix nested struct format

* Don't need go mod changes

* Add back go mod

* Bump to 0.34.1

* Add 0.34.1 to modules.txt

* Revert "Add 0.34.1 to modules.txt"

This reverts commit 2ac4e3e.

* Add vendor files for bump

Co-authored-by: sfang97 <sfang@gitlab.com>

Change isRunningInEE test

Fix import packages

Call configure in provider test

Only initialize provider in acceptance tests

Remove undefined resource reference

Add undefined testenvvar

Had to run make fmt

Remove unused variable

Reference testenvvar resource correctly

Add group_ldap_link to index

Signed-off-by: Sune Keller <absukl@almbrand.dk>

Adding project miorror and tests

responding to PR comments, removing import state verify for acceptance test

Setting all properties in SetToState

removed commented out ignore

adding docs page

adding to index

Store more attributes into the state

Fix missing test checks in the resource user

Allow to change user email address without creating a new resource

Fix the external flag being mapped to admin instead

Switching the external flag makes tests fail

Allow to filter members by their access_level

Update website/gitlab.erb

Co-authored-by: Adam Snyder <armsnyder@gmail.com>

Added Quotes in the example for group cluster

Remove redundant test func

Add managed test

Address PR comments

Revert "Address PR comments"

This reverts commit a963eaf.

Remove managed and enabled for now
sfang97 added a commit that referenced this pull request Sep 15, 2020
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600137187 -0500

parent 1cbab81
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600137111 -0500

parent 1cbab81
author Ringo De Smet <ringo@de-smet.name> 1592760067 +0200
committer sfang97 <sfang@gitlab.com> 1600136946 -0500

Fix required Go version

Add instance clusters to Terraform provider

Add support for instance level cluster management via the Gitlab
Terraform provider.

Add instance cluster to provider

Add instance cluster go file

Add instance clusters to website

Only test read instance cluster for now

Add functionality to CRUD

Tests mostly passing now, except a weird invalid URL escape thing, will
investigate this

Remove instance_clusters.go from this PR

Contributed the instance API file to the upstream repo
github.com/xanzy/go-gitlab, so removing from this PR

Readding instance_clusters for failed pipeline

Replace required libary in go mod

Replace vendor with upstream in go mod

Remove vendor files

Remove changes to gitlab go

Remove instance clusters from README

Add management project param back in

Rerun CI build

Removing line for CI build

Rerun CI pipeline

Undo change to xanzy README

Undo another change to README

Change the commit to replace go-gitlab requirement

Add go mod vendor to travis

Move go mod vendors command to lint stage

Change function names based on vendor change

Remove replace package

feat: Add support to create projects from templates

Undo cherry pick

This reverts commit 5191839.

Update go mod to latest go-gitlab

Remove changes to travis

Remove newline for new pipeline

Update docs, no instance ID

Add backlashes so no italics

Remove instance from example usage

Remove white space, change instance link

Address PR comments

Add forcenew back to auth type

run make fmt

Prepare changelog for release

v2.11.0

Cleanup after v2.11.0 release

Fix Jira Service error handling (#363)

Fix nil pointer dereferences during error handling (#364)

* Fix error handling when deleting deploy key
There was the possibility of a panic if response was nil, and the GitLab client already treats the 204 code as a success, so the extra check was not needed.

* Fix nil pointer dereference issues in error messages

correct management_project_id argument in documentation (#368)

Fix incorrect description of valid access levels (#342)

This minor change corrects a mistake showing `master` as a valid level
of `group_access_level`.

Import group labels (#339)

* add support for importing gitlab group labels

* fix resource name in the acceptance test

* convert group ID to string

Co-authored-by: David Townshend <david.townshend@allangray.co.za>

Add importer to resource_gitlab_project_push_rules (#360)

* Add importer to resource_gitlab_project_push_rules

* Fix apparent copy-paste problem and inconsistency in push rules debug logs

Bump go-gitlab to v.0.34.1 (#378)

* Fix variable passed to ListLabelsOptions

Needed to fix nested struct format

* Don't need go mod changes

* Add back go mod

* Bump to 0.34.1

* Add 0.34.1 to modules.txt

* Revert "Add 0.34.1 to modules.txt"

This reverts commit 2ac4e3e.

* Add vendor files for bump

Co-authored-by: sfang97 <sfang@gitlab.com>

Renamed the Github organization after the migration to https://github.com/gitlabhq

Change isRunningInEE test

Fix import packages

Call configure in provider test

Only initialize provider in acceptance tests

Remove undefined resource reference

Add undefined testenvvar

Had to run make fmt

Remove unused variable

Reference testenvvar resource correctly

Add group_ldap_link to index

Signed-off-by: Sune Keller <absukl@almbrand.dk>

Adding project miorror and tests

responding to PR comments, removing import state verify for acceptance test

Setting all properties in SetToState

removed commented out ignore

adding docs page

adding to index

Store more attributes into the state

Fix missing test checks in the resource user

Allow to change user email address without creating a new resource

Fix the external flag being mapped to admin instead

Switching the external flag makes tests fail

Add new data source gitlab_group_membership

Allow to filter members by their access_level

Add new doc page to gitlab.erb

Update website/gitlab.erb

Co-authored-by: Adam Snyder <armsnyder@gmail.com>

Added Quotes in the example for group cluster

Prepare changelog for release

Cleanup after v2.11.0 release

Fix Jira Service error handling (#363)

Fix nil pointer dereferences during error handling (#364)

* Fix error handling when deleting deploy key
There was the possibility of a panic if response was nil, and the GitLab client already treats the 204 code as a success, so the extra check was not needed.

* Fix nil pointer dereference issues in error messages

correct management_project_id argument in documentation (#368)

Fix incorrect description of valid access levels (#342)

This minor change corrects a mistake showing `master` as a valid level
of `group_access_level`.

Import group labels (#339)

* add support for importing gitlab group labels

* fix resource name in the acceptance test

* convert group ID to string

Co-authored-by: David Townshend <david.townshend@allangray.co.za>

Add importer to resource_gitlab_project_push_rules (#360)

* Add importer to resource_gitlab_project_push_rules

* Fix apparent copy-paste problem and inconsistency in push rules debug logs

Bump go-gitlab to v.0.34.1 (#378)

* Fix variable passed to ListLabelsOptions

Needed to fix nested struct format

* Don't need go mod changes

* Add back go mod

* Bump to 0.34.1

* Add 0.34.1 to modules.txt

* Revert "Add 0.34.1 to modules.txt"

This reverts commit 2ac4e3e.

* Add vendor files for bump

Co-authored-by: sfang97 <sfang@gitlab.com>

Change isRunningInEE test

Fix import packages

Call configure in provider test

Only initialize provider in acceptance tests

Remove undefined resource reference

Add undefined testenvvar

Had to run make fmt

Remove unused variable

Reference testenvvar resource correctly

Add group_ldap_link to index

Signed-off-by: Sune Keller <absukl@almbrand.dk>

Adding project miorror and tests

responding to PR comments, removing import state verify for acceptance test

Setting all properties in SetToState

removed commented out ignore

adding docs page

adding to index

Store more attributes into the state

Fix missing test checks in the resource user

Allow to change user email address without creating a new resource

Fix the external flag being mapped to admin instead

Switching the external flag makes tests fail

Allow to filter members by their access_level

Update website/gitlab.erb

Co-authored-by: Adam Snyder <armsnyder@gmail.com>

Added Quotes in the example for group cluster

Remove redundant test func

Add managed test

Address PR comments

Revert "Address PR comments"

This reverts commit a963eaf.

Remove managed and enabled for now

Co-authored-by: Ringo De Smet <ringo@de-smet.name>
@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.
Development

Successfully merging this pull request may close these issues.

3 participants