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

provider/gitlab: add gitlab_deploy_key #14734

Merged
merged 3 commits into from
May 24, 2017

Conversation

richardc
Copy link
Contributor

As suggested in #14471 this adds a gitlab_deploy_key resource to manage deploy keys.

@richardc
Copy link
Contributor Author

richardc commented May 22, 2017

Todo:

To expand on that pending merge request, the /v3 api cannot currently manage the can_push attribute, so it is stuck at the default value (false). That means given this snippet:

resource "gitlab_deploy_key" "example" {
  project = "${gitlab_project.test1.id}"
  title = "test"
  key = "${chomp(file("/Users/richardc/.ssh/id_rsa.pub"))}"
  can_push = true
}

Terraform will repeatedly delete and recreate the deploy key. The merge request will fix that, but will take integration and releasing.

Here we extend the gitlab provider further by adding a `gitlab_deploy_key`
resource.  This resource allows management of a projects deploy
keys.
@richardc richardc force-pushed the feature/add_gitlab_deploy_key branch from 017576a to 3245071 Compare May 23, 2017 07:29
@richardc
Copy link
Contributor Author

I've split out a commit to remove the testing of the can_push attribute, so we can move this on. It should be safe (if misleading) to ship as-is, as the can_push attribute won't be correctly managed until the gitlab api is fixed. I look to the terraform maintainers for guidance here.

@richardc richardc changed the title [WIP] provider/gitlab: add gitlab_deploy_key provider/gitlab: add gitlab_deploy_key May 23, 2017
Here we remove the testing of the `can_push` attribute.  This makes the
tests less comprehensive, but will allow them to work with the current
release of gitlab-ce.

This change is staged as a distinct commit so it can be easily
dropped/reverted once gitlab MR !11607 has reached a released state.

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11607
@richardc richardc force-pushed the feature/add_gitlab_deploy_key branch from 9d5a04e to af7c5cb Compare May 23, 2017 07:43
@stack72
Copy link
Contributor

stack72 commented May 23, 2017

Hi @richardc

I agree with your move to remove that param for now - we should just document this as a NOTE on the resource - to say that it can't currently be managed (not the reason) and then tell the user what gitlab defaults to

Sound ok?

Paul

@stack72 stack72 added new-resource provider/gitlab waiting-response An issue/pull request is waiting for a response from the community labels May 23, 2017
@stack72 stack72 self-assigned this May 23, 2017
@richardc
Copy link
Contributor Author

@stack72 So just patch website/source/docs/providers/gitlab/r/deploy_key.html.markdown to indicate the attribute isn't fully functional? I don't see a mechanism to do this in the code from a skim of schema.Schema.

@stack72
Copy link
Contributor

stack72 commented May 23, 2017

@richardc yeah there is no formal way to do this. The Markdown looks as follows

~> **NOTE::** My Note here

Note that the can_push attribute of gitlab_deploy_key doesn't currently
work.  This note can be removed once
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11607 is merged
and in general circulation.
@richardc
Copy link
Contributor Author

@stack72 How's the wording on that?

@stack72
Copy link
Contributor

stack72 commented May 24, 2017

Hi @richardc

This works - if it's not clear to users, we can change it up :)

Thanks for this! Tests are green as expected:

% make testacc TEST=./builtin/providers/gitlab                                                                                             ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/24 11:39:31 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/gitlab -v  -timeout 120m
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccGitlabDeployKey_basic
--- PASS: TestAccGitlabDeployKey_basic (39.50s)
=== RUN   TestAccGitlabProjectHook_basic
--- PASS: TestAccGitlabProjectHook_basic (31.64s)
=== RUN   TestAccGitlabProject_basic
--- PASS: TestAccGitlabProject_basic (30.03s)
=== RUN   TestGitlab_validation
--- PASS: TestGitlab_validation (0.00s)
=== RUN   TestGitlab_visbilityHelpers
--- PASS: TestGitlab_visbilityHelpers (0.00s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/gitlab	101.189s

Paul

@stack72 stack72 merged commit 395f1d5 into hashicorp:master May 24, 2017
@richardc richardc deleted the feature/add_gitlab_deploy_key branch May 25, 2017 08:26
@ghost
Copy link

ghost commented Apr 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
provider/gitlab waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants