From b6e70cc6c521be73e15b030938c337852e619ad5 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Wed, 24 Apr 2019 10:53:17 -0300 Subject: [PATCH 1/2] Bump go-github to v24 --- github/config.go | 2 +- github/data_source_github_repositories.go | 2 +- github/data_source_github_team.go | 2 +- github/resource_github_branch_protection.go | 2 +- github/resource_github_branch_protection_test.go | 2 +- github/resource_github_issue_label.go | 2 +- github/resource_github_issue_label_test.go | 2 +- github/resource_github_membership.go | 2 +- github/resource_github_membership_test.go | 2 +- github/resource_github_organization_project.go | 2 +- github/resource_github_organization_project_test.go | 2 +- github/resource_github_organization_webhook.go | 2 +- github/resource_github_organization_webhook_test.go | 2 +- github/resource_github_project_column.go | 2 +- github/resource_github_project_column_test.go | 2 +- github/resource_github_repository.go | 2 +- github/resource_github_repository_collaborator.go | 2 +- github/resource_github_repository_deploy_key.go | 2 +- github/resource_github_repository_project.go | 2 +- github/resource_github_repository_project_test.go | 2 +- github/resource_github_repository_test.go | 2 +- github/resource_github_repository_webhook.go | 2 +- github/resource_github_repository_webhook_test.go | 2 +- github/resource_github_team.go | 2 +- github/resource_github_team_membership.go | 2 +- github/resource_github_team_membership_test.go | 2 +- github/resource_github_team_repository.go | 2 +- github/resource_github_team_repository_test.go | 2 +- github/resource_github_team_test.go | 2 +- github/resource_github_user_gpg_key.go | 2 +- github/resource_github_user_gpg_key_test.go | 2 +- github/resource_github_user_ssh_key.go | 2 +- github/resource_github_user_ssh_key_test.go | 2 +- github/transport.go | 2 +- github/transport_test.go | 2 +- github/util_permissions.go | 2 +- go.mod | 2 +- go.sum | 4 ++++ 38 files changed, 41 insertions(+), 37 deletions(-) diff --git a/github/config.go b/github/config.go index 39f88190c8..67643e75bf 100644 --- a/github/config.go +++ b/github/config.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/logging" "golang.org/x/oauth2" ) diff --git a/github/data_source_github_repositories.go b/github/data_source_github_repositories.go index 501335d265..81595fbcf1 100644 --- a/github/data_source_github_repositories.go +++ b/github/data_source_github_repositories.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/data_source_github_team.go b/github/data_source_github_team.go index 06f358da2e..6b9a9d037b 100644 --- a/github/data_source_github_team.go +++ b/github/data_source_github_team.go @@ -6,7 +6,7 @@ import ( "log" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index 59018c6dab..90b2ec46b5 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_branch_protection_test.go b/github/resource_github_branch_protection_test.go index c2dabc1128..8ac50221ab 100644 --- a/github/resource_github_branch_protection_test.go +++ b/github/resource_github_branch_protection_test.go @@ -6,7 +6,7 @@ import ( "sort" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_issue_label.go b/github/resource_github_issue_label.go index eb9036204d..ebe083ef8b 100644 --- a/github/resource_github_issue_label.go +++ b/github/resource_github_issue_label.go @@ -5,7 +5,7 @@ import ( "log" "net/http" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_issue_label_test.go b/github/resource_github_issue_label_test.go index 52f3ca21d9..69010c9c99 100644 --- a/github/resource_github_issue_label_test.go +++ b/github/resource_github_issue_label_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_membership.go b/github/resource_github_membership.go index b10a704cc3..4c7e71ad13 100644 --- a/github/resource_github_membership.go +++ b/github/resource_github_membership.go @@ -5,7 +5,7 @@ import ( "log" "net/http" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_membership_test.go b/github/resource_github_membership_test.go index 1e8bef5d20..61d73dee44 100644 --- a/github/resource_github_membership_test.go +++ b/github/resource_github_membership_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) diff --git a/github/resource_github_organization_project.go b/github/resource_github_organization_project.go index 5df7f23df2..9f813a109a 100644 --- a/github/resource_github_organization_project.go +++ b/github/resource_github_organization_project.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_organization_project_test.go b/github/resource_github_organization_project_test.go index ee3a72b885..cfa32b719f 100644 --- a/github/resource_github_organization_project_test.go +++ b/github/resource_github_organization_project_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) diff --git a/github/resource_github_organization_webhook.go b/github/resource_github_organization_webhook.go index a7bbf344bc..854e122ddc 100644 --- a/github/resource_github_organization_webhook.go +++ b/github/resource_github_organization_webhook.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_organization_webhook_test.go b/github/resource_github_organization_webhook_test.go index 4cba335d3d..24c09a0cdb 100644 --- a/github/resource_github_organization_webhook_test.go +++ b/github/resource_github_organization_webhook_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) diff --git a/github/resource_github_project_column.go b/github/resource_github_project_column.go index f4070dfab1..e48cfffba5 100644 --- a/github/resource_github_project_column.go +++ b/github/resource_github_project_column.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_project_column_test.go b/github/resource_github_project_column_test.go index 5fa0077de4..75ac0677a9 100644 --- a/github/resource_github_project_column_test.go +++ b/github/resource_github_project_column_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 88614b1d17..13b0fd5497 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_repository_collaborator.go b/github/resource_github_repository_collaborator.go index ccbf7a1885..8c8e978b9e 100644 --- a/github/resource_github_repository_collaborator.go +++ b/github/resource_github_repository_collaborator.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_repository_deploy_key.go b/github/resource_github_repository_deploy_key.go index 0c77867b07..1f5663cc7b 100644 --- a/github/resource_github_repository_deploy_key.go +++ b/github/resource_github_repository_deploy_key.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_repository_project.go b/github/resource_github_repository_project.go index dd2a50133a..693a361bfc 100644 --- a/github/resource_github_repository_project.go +++ b/github/resource_github_repository_project.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_repository_project_test.go b/github/resource_github_repository_project_test.go index 793e54a8dc..5c416b3a8d 100644 --- a/github/resource_github_repository_project_test.go +++ b/github/resource_github_repository_project_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 327a3787cd..6a27da356f 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_repository_webhook.go b/github/resource_github_repository_webhook.go index 055d8c5fdb..8f651ebfa9 100644 --- a/github/resource_github_repository_webhook.go +++ b/github/resource_github_repository_webhook.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_repository_webhook_test.go b/github/resource_github_repository_webhook_test.go index 1b9109a1a5..83ce5bd2e9 100644 --- a/github/resource_github_repository_webhook_test.go +++ b/github/resource_github_repository_webhook_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_team.go b/github/resource_github_team.go index 4b26c41801..2bd09c6fc4 100644 --- a/github/resource_github_team.go +++ b/github/resource_github_team.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_team_membership.go b/github/resource_github_team_membership.go index 2d2620a270..0c910e93f4 100644 --- a/github/resource_github_team_membership.go +++ b/github/resource_github_team_membership.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_team_membership_test.go b/github/resource_github_team_membership_test.go index b72a1968d3..d647cd1879 100644 --- a/github/resource_github_team_membership_test.go +++ b/github/resource_github_team_membership_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_team_repository.go b/github/resource_github_team_repository.go index 3624159a34..e4adb5a80b 100644 --- a/github/resource_github_team_repository.go +++ b/github/resource_github_team_repository.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_team_repository_test.go b/github/resource_github_team_repository_test.go index efa7ad6430..01cf9e7fa3 100644 --- a/github/resource_github_team_repository_test.go +++ b/github/resource_github_team_repository_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_team_test.go b/github/resource_github_team_test.go index fe24d79247..09f8a5d06a 100644 --- a/github/resource_github_team_test.go +++ b/github/resource_github_team_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/resource_github_user_gpg_key.go b/github/resource_github_user_gpg_key.go index 75dfb1c81b..cfdabb53ae 100644 --- a/github/resource_github_user_gpg_key.go +++ b/github/resource_github_user_gpg_key.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_user_gpg_key_test.go b/github/resource_github_user_gpg_key_test.go index 49fbeed461..81e6158350 100644 --- a/github/resource_github_user_gpg_key_test.go +++ b/github/resource_github_user_gpg_key_test.go @@ -8,7 +8,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) diff --git a/github/resource_github_user_ssh_key.go b/github/resource_github_user_ssh_key.go index d97df1d1c1..83bd8e0ac7 100644 --- a/github/resource_github_user_ssh_key.go +++ b/github/resource_github_user_ssh_key.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/schema" ) diff --git a/github/resource_github_user_ssh_key_test.go b/github/resource_github_user_ssh_key_test.go index f48d6c5ab1..73079bf38b 100644 --- a/github/resource_github_user_ssh_key_test.go +++ b/github/resource_github_user_ssh_key_test.go @@ -7,7 +7,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" diff --git a/github/transport.go b/github/transport.go index be78755611..d9b686bb57 100644 --- a/github/transport.go +++ b/github/transport.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" ) const ( diff --git a/github/transport_test.go b/github/transport_test.go index ea6c1c326d..36e143c45e 100644 --- a/github/transport_test.go +++ b/github/transport_test.go @@ -10,7 +10,7 @@ import ( "net/url" "testing" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" ) func TestEtagTransport(t *testing.T) { diff --git a/github/util_permissions.go b/github/util_permissions.go index edd8b164a4..8dc8448442 100644 --- a/github/util_permissions.go +++ b/github/util_permissions.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/google/go-github/github" + "github.com/google/go-github/v24/github" ) const ( diff --git a/go.mod b/go.mod index f66a5cb29a..229455ed34 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-github require ( - github.com/google/go-github v17.0.0+incompatible + github.com/google/go-github/v24 v24.0.1 github.com/hashicorp/terraform v0.12.0-beta2 github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 github.com/terraform-providers/terraform-provider-tls v1.2.0 diff --git a/go.sum b/go.sum index 0c03e6f340..818623a08a 100644 --- a/go.sum +++ b/go.sum @@ -110,6 +110,8 @@ github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-github/v24 v24.0.1 h1:KCt1LjMJEey1qvPXxa9SjaWxwTsCWSq6p2Ju57UR4Q4= +github.com/google/go-github/v24 v24.0.1/go.mod h1:CRqaW1Uns1TCkP0wqTpxYyRxRjxwvKU/XSS44u6X74M= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -368,6 +370,7 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180816225734-aabede6cba87/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -401,6 +404,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From 6ed8dd185300e75a2379c6c50af37dccc69611d1 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Wed, 24 Apr 2019 11:03:08 -0300 Subject: [PATCH 2/2] Fix compilation issues After bumping to go-github v24, a couple of signatures have changed. One of them, the `name` on `webhooks` has been removed. Previously, the only valid name was `web`, and now, it has been removed from the object. This commit is a breaking change on the provider, as it will not accept more taking `name` on the webhook resources. --- .../resource_github_organization_project.go | 10 ++++++---- .../resource_github_organization_webhook.go | 19 +------------------ ...source_github_organization_webhook_test.go | 9 --------- github/resource_github_repository_project.go | 12 +++++++----- github/resource_github_repository_webhook.go | 10 +--------- ...resource_github_repository_webhook_test.go | 9 --------- 6 files changed, 15 insertions(+), 54 deletions(-) diff --git a/github/resource_github_organization_project.go b/github/resource_github_organization_project.go index 9f813a109a..e70cf2702f 100644 --- a/github/resource_github_organization_project.go +++ b/github/resource_github_organization_project.go @@ -46,14 +46,15 @@ func resourceGithubOrganizationProjectCreate(d *schema.ResourceData, meta interf client := meta.(*Organization).client orgName := meta.(*Organization).name name := d.Get("name").(string) + body := d.Get("body").(string) ctx := context.Background() log.Printf("[DEBUG] Creating organization project: %s (%s)", name, orgName) project, _, err := client.Organizations.CreateProject(ctx, orgName, &github.ProjectOptions{ - Name: name, - Body: d.Get("body").(string), + Name: &name, + Body: &body, }, ) if err != nil { @@ -108,9 +109,10 @@ func resourceGithubOrganizationProjectUpdate(d *schema.ResourceData, meta interf orgName := meta.(*Organization).name name := d.Get("name").(string) + body := d.Get("body").(string) options := github.ProjectOptions{ - Name: name, - Body: d.Get("body").(string), + Name: &name, + Body: &body, } projectID, err := strconv.ParseInt(d.Id(), 10, 64) diff --git a/github/resource_github_organization_webhook.go b/github/resource_github_organization_webhook.go index 854e122ddc..2a37a3b15a 100644 --- a/github/resource_github_organization_webhook.go +++ b/github/resource_github_organization_webhook.go @@ -2,7 +2,6 @@ package github import ( "context" - "fmt" "log" "net/http" "strconv" @@ -23,12 +22,6 @@ func resourceGithubOrganizationWebhook() *schema.Resource { MigrateState: resourceGithubWebhookMigrateState, Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validateGithubOrganizationWebhookName, - }, "events": { Type: schema.TypeSet, Required: true, @@ -53,13 +46,6 @@ func resourceGithubOrganizationWebhook() *schema.Resource { } } -func validateGithubOrganizationWebhookName(v interface{}, k string) (ws []string, errors []error) { - if v.(string) != "web" { - errors = append(errors, fmt.Errorf("Github: name can only be web")) - } - return -} - func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hook { events := []string{} eventSet := d.Get("events").(*schema.Set) @@ -68,7 +54,6 @@ func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hoo } hook := &github.Hook{ - Name: github.String(d.Get("name").(string)), URL: github.String(d.Get("url").(string)), Events: events, Active: github.Bool(d.Get("active").(bool)), @@ -89,8 +74,7 @@ func resourceGithubOrganizationWebhookCreate(d *schema.ResourceData, meta interf webhookObj := resourceGithubOrganizationWebhookObject(d) ctx := context.Background() - log.Printf("[DEBUG] Creating organization webhook: %s (%s)", - webhookObj.GetName(), orgName) + log.Printf("[DEBUG] Creating organization webhook: %d (%s)", webhookObj.GetID(), orgName) hook, _, err := client.Organizations.CreateHook(ctx, orgName, webhookObj) if err != nil { @@ -132,7 +116,6 @@ func resourceGithubOrganizationWebhookRead(d *schema.ResourceData, meta interfac } d.Set("etag", resp.Header.Get("ETag")) - d.Set("name", hook.Name) d.Set("url", hook.URL) d.Set("active", hook.Active) d.Set("events", hook.Events) diff --git a/github/resource_github_organization_webhook_test.go b/github/resource_github_organization_webhook_test.go index 24c09a0cdb..7674d056e5 100644 --- a/github/resource_github_organization_webhook_test.go +++ b/github/resource_github_organization_webhook_test.go @@ -26,7 +26,6 @@ func TestAccGithubOrganizationWebhook_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook), testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{ - Name: "web", Events: []string{"pull_request"}, Configuration: map[string]interface{}{ "url": "https://google.de/webhook", @@ -42,7 +41,6 @@ func TestAccGithubOrganizationWebhook_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook), testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{ - Name: "web", Events: []string{"issues"}, Configuration: map[string]interface{}{ "url": "https://google.de/webhooks", @@ -70,7 +68,6 @@ func TestAccGithubOrganizationWebhook_secret(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook), testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{ - Name: "web", Events: []string{"pull_request"}, Configuration: map[string]interface{}{ "url": "https://www.terraform.io/webhook", @@ -122,9 +119,6 @@ type testAccGithubOrganizationWebhookExpectedAttributes struct { func testAccCheckGithubOrganizationWebhookAttributes(hook *github.Hook, want *testAccGithubOrganizationWebhookExpectedAttributes) resource.TestCheckFunc { return func(s *terraform.State) error { - if *hook.Name != want.Name { - return fmt.Errorf("got hook %q; want %q", *hook.Name, want.Name) - } if *hook.Active != want.Active { return fmt.Errorf("got hook %t; want %t", *hook.Active, want.Active) } @@ -172,7 +166,6 @@ func testAccCheckGithubOrganizationWebhookDestroy(s *terraform.State) error { const testAccGithubOrganizationWebhookConfig = ` resource "github_organization_webhook" "foo" { - name = "web" configuration { url = "https://google.de/webhook" content_type = "json" @@ -185,7 +178,6 @@ resource "github_organization_webhook" "foo" { const testAccGithubOrganizationWebhookUpdateConfig = ` resource "github_organization_webhook" "foo" { - name = "web" configuration { url = "https://google.de/webhooks" content_type = "form" @@ -199,7 +191,6 @@ resource "github_organization_webhook" "foo" { const testAccGithubOrganizationWebhookConfig_secret = ` resource "github_organization_webhook" "foo" { - name = "web" configuration { url = "https://www.terraform.io/webhook" content_type = "json" diff --git a/github/resource_github_repository_project.go b/github/resource_github_repository_project.go index 693a361bfc..025795ef14 100644 --- a/github/resource_github_repository_project.go +++ b/github/resource_github_repository_project.go @@ -62,9 +62,10 @@ func resourceGithubRepositoryProjectCreate(d *schema.ResourceData, meta interfac orgName := meta.(*Organization).name repoName := d.Get("repository").(string) name := d.Get("name").(string) + body := d.Get("body").(string) options := github.ProjectOptions{ - Name: name, - Body: d.Get("body").(string), + Name: &name, + Body: &body, } ctx := context.Background() @@ -120,10 +121,11 @@ func resourceGithubRepositoryProjectRead(d *schema.ResourceData, meta interface{ func resourceGithubRepositoryProjectUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*Organization).client - + name := d.Get("name").(string) + body := d.Get("body").(string) options := github.ProjectOptions{ - Name: d.Get("name").(string), - Body: d.Get("body").(string), + Name: &name, + Body: &body, } projectID, err := strconv.ParseInt(d.Id(), 10, 64) diff --git a/github/resource_github_repository_webhook.go b/github/resource_github_repository_webhook.go index 8f651ebfa9..3e34d653cb 100644 --- a/github/resource_github_repository_webhook.go +++ b/github/resource_github_repository_webhook.go @@ -34,11 +34,6 @@ func resourceGithubRepositoryWebhook() *schema.Resource { MigrateState: resourceGithubWebhookMigrateState, Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, "repository": { Type: schema.TypeString, Required: true, @@ -76,10 +71,8 @@ func resourceGithubRepositoryWebhookObject(d *schema.ResourceData) *github.Hook for _, v := range eventSet.List() { events = append(events, v.(string)) } - name := d.Get("name").(string) hook := &github.Hook{ - Name: &name, URL: &url, Events: events, Active: &active, @@ -101,7 +94,7 @@ func resourceGithubRepositoryWebhookCreate(d *schema.ResourceData, meta interfac hk := resourceGithubRepositoryWebhookObject(d) ctx := context.Background() - log.Printf("[DEBUG] Creating repository webhook: %s (%s/%s)", hk.GetName(), orgName, repoName) + log.Printf("[DEBUG] Creating repository webhook: %d (%s/%s)", hk.GetID(), orgName, repoName) hook, _, err := client.Repositories.CreateHook(ctx, orgName, repoName, hk) if err != nil { return err @@ -141,7 +134,6 @@ func resourceGithubRepositoryWebhookRead(d *schema.ResourceData, meta interface{ } return err } - d.Set("name", hook.Name) d.Set("url", hook.URL) d.Set("active", hook.Active) d.Set("events", hook.Events) diff --git a/github/resource_github_repository_webhook_test.go b/github/resource_github_repository_webhook_test.go index 83ce5bd2e9..19e348d63b 100644 --- a/github/resource_github_repository_webhook_test.go +++ b/github/resource_github_repository_webhook_test.go @@ -28,7 +28,6 @@ func TestAccGithubRepositoryWebhook_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubRepositoryWebhookExists("github_repository_webhook.foo", fmt.Sprintf("foo-%s", randString), &hook), testAccCheckGithubRepositoryWebhookAttributes(&hook, &testAccGithubRepositoryWebhookExpectedAttributes{ - Name: "web", Events: []string{"pull_request"}, Configuration: map[string]interface{}{ "url": "https://google.de/webhook", @@ -44,7 +43,6 @@ func TestAccGithubRepositoryWebhook_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubRepositoryWebhookExists("github_repository_webhook.foo", fmt.Sprintf("foo-%s", randString), &hook), testAccCheckGithubRepositoryWebhookAttributes(&hook, &testAccGithubRepositoryWebhookExpectedAttributes{ - Name: "web", Events: []string{"issues"}, Configuration: map[string]interface{}{ "url": "https://google.de/webhooks", @@ -73,7 +71,6 @@ func TestAccGithubRepositoryWebhook_secret(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGithubRepositoryWebhookExists("github_repository_webhook.foo", fmt.Sprintf("foo-%s", randString), &hook), testAccCheckGithubRepositoryWebhookAttributes(&hook, &testAccGithubRepositoryWebhookExpectedAttributes{ - Name: "web", Events: []string{"pull_request"}, Configuration: map[string]interface{}{ "url": "https://www.terraform.io/webhook", @@ -167,9 +164,6 @@ type testAccGithubRepositoryWebhookExpectedAttributes struct { func testAccCheckGithubRepositoryWebhookAttributes(hook *github.Hook, want *testAccGithubRepositoryWebhookExpectedAttributes) resource.TestCheckFunc { return func(s *terraform.State) error { - if *hook.Name != want.Name { - return fmt.Errorf("got hook %q; want %q", *hook.Name, want.Name) - } if *hook.Active != want.Active { return fmt.Errorf("got hook %t; want %t", *hook.Active, want.Active) } @@ -235,7 +229,6 @@ func testAccGithubRepositoryWebhookConfig(randString string) string { depends_on = ["github_repository.foo"] repository = "foo-%s" - name = "web" configuration { url = "https://google.de/webhook" content_type = "json" @@ -266,7 +259,6 @@ resource "github_repository" "foo" { resource "github_repository_webhook" "foo" { repository = "${github_repository.foo.name}" - name = "web" configuration { url = "https://www.terraform.io/webhook" content_type = "json" @@ -299,7 +291,6 @@ resource "github_repository_webhook" "foo" { depends_on = ["github_repository.foo"] repository = "foo-%s" - name = "web" configuration { url = "https://google.de/webhooks" content_type = "form"