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

r/github_repository_webhook: Add import #29

Merged
merged 2 commits into from
Jul 5, 2017
Merged

Conversation

grubernaut
Copy link
Contributor

Adds import functionality to the github_repository_webhook resource.

$ make testacc TEST=./github TESTARGS="-run=TestAccGithubRepositoryWebhook_importBasic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./github -v -run=TestAccGithubRepositoryWebhook_importBasic -timeout 120m
=== RUN   TestAccGithubRepositoryWebhook_importBasic
--- PASS: TestAccGithubRepositoryWebhook_importBasic (3.75s)
PASS
ok      github.com/terraform-providers/terraform-provider-github/github 3.753s

Fixes: #12

@grubernaut grubernaut added the Type: Feature New feature or request label Jul 3, 2017
Adds import functionality to the `github_repository_webhook` resource.

```
$ make testacc TEST=./github TESTARGS="-run=TestAccGithubRepositoryWebhook_importBasic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./github -v -run=TestAccGithubRepositoryWebhook_importBasic -timeout 120m
=== RUN   TestAccGithubRepositoryWebhook_importBasic
--- PASS: TestAccGithubRepositoryWebhook_importBasic (3.75s)
PASS
ok      github.com/terraform-providers/terraform-provider-github/github 3.753s
```
Copy link
Contributor

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

This LGTM, just left you two nitpicky comments there.


## Import

Repository Webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook`, separated by a `/` character.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there's one extra backtick here. 👀

@@ -14,6 +16,17 @@ func resourceGithubRepositoryWebhook() *schema.Resource {
Read: resourceGithubRepositoryWebhookRead,
Update: resourceGithubRepositoryWebhookUpdate,
Delete: resourceGithubRepositoryWebhookDelete,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
combined := strings.Split(d.Id(), "/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably a nitpick, but I this variable deserves a better name, e.g. parts or something similar that's plural.

@grubernaut grubernaut merged commit 34e24b7 into master Jul 5, 2017
@grubernaut grubernaut deleted the f-import-webhook branch July 5, 2017 15:36
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
…webhook

r/github_repository_webhook: Add import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants