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

chore: Deprecated classic project resources #2506

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions github/resource_github_organization_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

func resourceGithubOrganizationProject() *schema.Resource {
return &schema.Resource{
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.",

Create: resourceGithubOrganizationProjectCreate,
Read: resourceGithubOrganizationProjectRead,
Update: resourceGithubOrganizationProjectUpdate,
Expand Down
3 changes: 2 additions & 1 deletion github/resource_github_organization_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
)

func TestAccGithubOrganizationProject_basic(t *testing.T) {
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")

if err := testAccCheckOrganization(); err != nil {
t.Skipf("Skipping because %s.", err.Error())
}
Expand Down Expand Up @@ -102,7 +104,6 @@ type testAccGithubOrganizationProjectExpectedAttributes struct {

func testAccCheckGithubOrganizationProjectAttributes(project *github.Project, want *testAccGithubOrganizationProjectExpectedAttributes) resource.TestCheckFunc {
return func(s *terraform.State) error {

if name := project.GetName(); name != want.Name {
return fmt.Errorf("got project %q; want %q", name, want.Name)
}
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_project_card.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (

func resourceGithubProjectCard() *schema.Resource {
return &schema.Resource{
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.",

Create: resourceGithubProjectCardCreate,
Read: resourceGithubProjectCardRead,
Update: resourceGithubProjectCardUpdate,
Expand Down Expand Up @@ -184,7 +186,6 @@ func resourceGithubProjectCardDelete(d *schema.ResourceData, meta interface{}) e
}

func resourceGithubProjectCardImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {

cardIDStr := d.Id()
cardID, err := strconv.ParseInt(cardIDStr, 10, 64)
if err != nil {
Expand All @@ -205,5 +206,4 @@ func resourceGithubProjectCardImport(d *schema.ResourceData, meta interface{}) (
}

return []*schema.ResourceData{d}, nil

}
10 changes: 4 additions & 6 deletions github/resource_github_project_card_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ package github

import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

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

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

t.Run("creates a project card using a note", func(t *testing.T) {

config := fmt.Sprintf(`

resource "github_organization_project" "project" {
Expand Down Expand Up @@ -64,11 +65,9 @@ func TestAccGithubProjectCard(t *testing.T) {
t.Run("with an organization account", func(t *testing.T) {
testCase(t, organization)
})

})

t.Run("creates a project card using an issue", func(t *testing.T) {

config := fmt.Sprintf(`

resource "github_repository" "test" {
Expand Down Expand Up @@ -97,7 +96,7 @@ func TestAccGithubProjectCard(t *testing.T) {
resource "github_project_card" "test" {
column_id = github_project_column.test.column_id
content_id = github_issue.test.issue_id
content_type = "Issue"
content_type = "Issue"
}

`, randomID)
Expand Down Expand Up @@ -141,6 +140,5 @@ func TestAccGithubProjectCard(t *testing.T) {
t.Run("with an organization account", func(t *testing.T) {
testCase(t, organization)
})

})
}
2 changes: 2 additions & 0 deletions github/resource_github_project_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

func resourceGithubProjectColumn() *schema.Resource {
return &schema.Resource{
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.",

Create: resourceGithubProjectColumnCreate,
Read: resourceGithubProjectColumnRead,
Update: resourceGithubProjectColumnUpdate,
Expand Down
3 changes: 2 additions & 1 deletion github/resource_github_project_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
)

func TestAccGithubProjectColumn_basic(t *testing.T) {
t.Skip("Skipping test as the GitHub REST API no longer supports classic projects")

if err := testAccCheckOrganization(); err != nil {
t.Skipf("Skipping because %s.", err.Error())
}
Expand Down Expand Up @@ -107,7 +109,6 @@ type testAccGithubProjectColumnExpectedAttributes struct {

func testAccCheckGithubProjectColumnAttributes(column *github.ProjectColumn, want *testAccGithubProjectColumnExpectedAttributes) resource.TestCheckFunc {
return func(s *terraform.State) error {

if name := column.GetName(); name != want.Name {
return fmt.Errorf("got project column %q; want %q", name, want.Name)
}
Expand Down
2 changes: 2 additions & 0 deletions github/resource_github_repository_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (

func resourceGithubRepositoryProject() *schema.Resource {
return &schema.Resource{
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.",

Create: resourceGithubRepositoryProjectCreate,
Read: resourceGithubRepositoryProjectRead,
Update: resourceGithubRepositoryProjectUpdate,
Expand Down
3 changes: 1 addition & 2 deletions github/resource_github_repository_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
)

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

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

t.Run("creates a repository project", func(t *testing.T) {

config := fmt.Sprintf(`

resource "github_repository" "test" {
Expand Down Expand Up @@ -60,6 +60,5 @@ func TestAccGithubRepositoryProject(t *testing.T) {
t.Run("with an organization account", func(t *testing.T) {
testCase(t, organization)
})

})
}
2 changes: 2 additions & 0 deletions website/docs/r/organization_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: |-

# github_organization_project

!> **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.

This resource allows you to create and manage projects for GitHub organization.

## Example Usage
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/project_card.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: |-

# github_project_card

!> **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.

This resource allows you to create and manage cards for GitHub projects.

## Example Usage
Expand Down Expand Up @@ -68,11 +70,11 @@ The following arguments are supported:

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

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

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

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

## Import
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/project_column.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: |-

# github_project_column

!> **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.

This resource allows you to create and manage columns for GitHub projects.

## Example Usage
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/repository_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: |-

# github_repository_project

!> **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.

This resource allows you to create and manage projects for GitHub repository.

## Example Usage
Expand Down
Loading