Skip to content

Commit ca3d01c

Browse files
chore: Deprecated classic project resources (#2506)
Signed-off-by: Steve Hipwell <[email protected]> Co-authored-by: Nick Floyd <[email protected]>
1 parent 67382ff commit ca3d01c

12 files changed

+27
-14
lines changed

github/resource_github_organization_project.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
func resourceGithubOrganizationProject() *schema.Resource {
1515
return &schema.Resource{
16+
DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.",
17+
1618
Create: resourceGithubOrganizationProjectCreate,
1719
Read: resourceGithubOrganizationProjectRead,
1820
Update: resourceGithubOrganizationProjectUpdate,

github/resource_github_organization_project_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
)
1414

1515
func TestAccGithubOrganizationProject_basic(t *testing.T) {
16+
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")
17+
1618
if err := testAccCheckOrganization(); err != nil {
1719
t.Skipf("Skipping because %s.", err.Error())
1820
}
@@ -102,7 +104,6 @@ type testAccGithubOrganizationProjectExpectedAttributes struct {
102104

103105
func testAccCheckGithubOrganizationProjectAttributes(project *github.Project, want *testAccGithubOrganizationProjectExpectedAttributes) resource.TestCheckFunc {
104106
return func(s *terraform.State) error {
105-
106107
if name := project.GetName(); name != want.Name {
107108
return fmt.Errorf("got project %q; want %q", name, want.Name)
108109
}

github/resource_github_project_card.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414

1515
func resourceGithubProjectCard() *schema.Resource {
1616
return &schema.Resource{
17+
DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.",
18+
1719
Create: resourceGithubProjectCardCreate,
1820
Read: resourceGithubProjectCardRead,
1921
Update: resourceGithubProjectCardUpdate,
@@ -184,7 +186,6 @@ func resourceGithubProjectCardDelete(d *schema.ResourceData, meta interface{}) e
184186
}
185187

186188
func resourceGithubProjectCardImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
187-
188189
cardIDStr := d.Id()
189190
cardID, err := strconv.ParseInt(cardIDStr, 10, 64)
190191
if err != nil {
@@ -205,5 +206,4 @@ func resourceGithubProjectCardImport(d *schema.ResourceData, meta interface{}) (
205206
}
206207

207208
return []*schema.ResourceData{d}, nil
208-
209209
}

github/resource_github_project_card_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ package github
22

33
import (
44
"fmt"
5-
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
65
"testing"
76

7+
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
8+
89
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
910
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1011
)
1112

1213
func TestAccGithubProjectCard(t *testing.T) {
14+
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")
1315

1416
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
1517

1618
t.Run("creates a project card using a note", func(t *testing.T) {
17-
1819
config := fmt.Sprintf(`
1920
2021
resource "github_organization_project" "project" {
@@ -64,11 +65,9 @@ func TestAccGithubProjectCard(t *testing.T) {
6465
t.Run("with an organization account", func(t *testing.T) {
6566
testCase(t, organization)
6667
})
67-
6868
})
6969

7070
t.Run("creates a project card using an issue", func(t *testing.T) {
71-
7271
config := fmt.Sprintf(`
7372
7473
resource "github_repository" "test" {
@@ -97,7 +96,7 @@ func TestAccGithubProjectCard(t *testing.T) {
9796
resource "github_project_card" "test" {
9897
column_id = github_project_column.test.column_id
9998
content_id = github_issue.test.issue_id
100-
content_type = "Issue"
99+
content_type = "Issue"
101100
}
102101
103102
`, randomID)
@@ -141,6 +140,5 @@ func TestAccGithubProjectCard(t *testing.T) {
141140
t.Run("with an organization account", func(t *testing.T) {
142141
testCase(t, organization)
143142
})
144-
145143
})
146144
}

github/resource_github_project_column.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
func resourceGithubProjectColumn() *schema.Resource {
1515
return &schema.Resource{
16+
DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.",
17+
1618
Create: resourceGithubProjectColumnCreate,
1719
Read: resourceGithubProjectColumnRead,
1820
Update: resourceGithubProjectColumnUpdate,

github/resource_github_project_column_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
)
1313

1414
func TestAccGithubProjectColumn_basic(t *testing.T) {
15+
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")
16+
1517
if err := testAccCheckOrganization(); err != nil {
1618
t.Skipf("Skipping because %s.", err.Error())
1719
}
@@ -107,7 +109,6 @@ type testAccGithubProjectColumnExpectedAttributes struct {
107109

108110
func testAccCheckGithubProjectColumnAttributes(column *github.ProjectColumn, want *testAccGithubProjectColumnExpectedAttributes) resource.TestCheckFunc {
109111
return func(s *terraform.State) error {
110-
111112
if name := column.GetName(); name != want.Name {
112113
return fmt.Errorf("got project column %q; want %q", name, want.Name)
113114
}

github/resource_github_repository_project.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414

1515
func resourceGithubRepositoryProject() *schema.Resource {
1616
return &schema.Resource{
17+
DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.",
18+
1719
Create: resourceGithubRepositoryProjectCreate,
1820
Read: resourceGithubRepositoryProjectRead,
1921
Update: resourceGithubRepositoryProjectUpdate,

github/resource_github_repository_project_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import (
1010
)
1111

1212
func TestAccGithubRepositoryProject(t *testing.T) {
13+
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")
1314

1415
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
1516

1617
t.Run("creates a repository project", func(t *testing.T) {
17-
1818
config := fmt.Sprintf(`
1919
2020
resource "github_repository" "test" {
@@ -60,6 +60,5 @@ func TestAccGithubRepositoryProject(t *testing.T) {
6060
t.Run("with an organization account", func(t *testing.T) {
6161
testCase(t, organization)
6262
})
63-
6463
})
6564
}

website/docs/r/organization_project.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: |-
77

88
# github_organization_project
99

10+
!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release.
11+
1012
This resource allows you to create and manage projects for GitHub organization.
1113

1214
## Example Usage

website/docs/r/project_card.html.markdown

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: |-
77

88
# github_project_card
99

10+
!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release.
11+
1012
This resource allows you to create and manage cards for GitHub projects.
1113

1214
## Example Usage
@@ -68,11 +70,11 @@ The following arguments are supported:
6870

6971
* `note` - (Optional) The note contents of the card. Markdown supported.
7072

71-
* `content_id` - (Optional) [`github_issue.issue_id`](issue.html#argument-reference).
73+
* `content_id` - (Optional) [`github_issue.issue_id`](issue.html#argument-reference).
7274

7375
* `content_type` - (Optional) Must be either `Issue` or `PullRequest`
7476

75-
**Remarks:** You must either set the `note` attribute or both `content_id` and `content_type`.
77+
**Remarks:** You must either set the `note` attribute or both `content_id` and `content_type`.
7678
See [note example](#example-usage) or [issue example](#example-usage-adding-an-issue-to-a-project) for more information.
7779

7880
## Import

0 commit comments

Comments
 (0)