|
9 | 9 |
|
10 | 10 | func resourceGithubRepositoryProject() *schema.Resource { |
11 | 11 | return &schema.Resource{ |
12 | | - 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.", |
| 12 | + DeprecationMessage: "Repository projects have been replaced by Projects V2 which are organization or user-scoped. This resource is no longer functional and will be removed in a future version. Please use github_organization_project instead.", |
13 | 13 |
|
14 | 14 | Create: resourceGithubRepositoryProjectCreate, |
15 | 15 | Read: resourceGithubRepositoryProjectRead, |
@@ -65,118 +65,17 @@ func resourceGithubRepositoryProject() *schema.Resource { |
65 | 65 | } |
66 | 66 |
|
67 | 67 | func resourceGithubRepositoryProjectCreate(d *schema.ResourceData, meta any) error { |
68 | | - return fmt.Errorf("projects v1 are no longer supported by github") |
69 | | - |
70 | | - // client := meta.(*Owner).v3client |
71 | | - |
72 | | - // owner := meta.(*Owner).name |
73 | | - // repoName := d.Get("repository").(string) |
74 | | - // name := d.Get("name").(string) |
75 | | - // body := d.Get("body").(string) |
76 | | - |
77 | | - // options := github.ProjectOptions{ |
78 | | - // Name: &name, |
79 | | - // Body: &body, |
80 | | - // } |
81 | | - // ctx := context.Background() |
82 | | - |
83 | | - // project, _, err := client.Repositories.CreateProject(ctx, |
84 | | - // owner, repoName, &options) |
85 | | - // if err != nil { |
86 | | - // return err |
87 | | - // } |
88 | | - // d.SetId(strconv.FormatInt(project.GetID(), 10)) |
89 | | - |
90 | | - // return resourceGithubRepositoryProjectRead(d, meta) |
| 68 | + return fmt.Errorf("Repository projects are no longer supported. Projects V2 are organization or user-scoped and cannot be created via the REST API. Please create the project through the GitHub web interface and use github_organization_project instead") |
91 | 69 | } |
92 | 70 |
|
93 | 71 | func resourceGithubRepositoryProjectRead(d *schema.ResourceData, meta any) error { |
94 | | - return fmt.Errorf("projects v1 are no longer supported by github") |
95 | | - |
96 | | - // client := meta.(*Owner).v3client |
97 | | - // owner := meta.(*Owner).name |
98 | | - |
99 | | - // projectID, err := strconv.ParseInt(d.Id(), 10, 64) |
100 | | - // if err != nil { |
101 | | - // return unconvertibleIdErr(d.Id(), err) |
102 | | - // } |
103 | | - // ctx := context.WithValue(context.Background(), ctxId, d.Id()) |
104 | | - // if !d.IsNewResource() { |
105 | | - // ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) |
106 | | - // } |
107 | | - |
108 | | - // project, resp, err := client.Projects.GetProject(ctx, projectID) |
109 | | - // if err != nil { |
110 | | - // var ghErr *github.ErrorResponse |
111 | | - // if errors.As(err, &ghErr) { |
112 | | - // if ghErr.Response.StatusCode == http.StatusNotModified { |
113 | | - // return nil |
114 | | - // } |
115 | | - // if ghErr.Response.StatusCode == http.StatusNotFound { |
116 | | - // log.Printf("[INFO] Removing repository project %s from state because it no longer exists in GitHub", |
117 | | - // d.Id()) |
118 | | - // d.SetId("") |
119 | | - // return nil |
120 | | - // } |
121 | | - // } |
122 | | - // return err |
123 | | - // } |
124 | | - |
125 | | - // if err = d.Set("etag", resp.Header.Get("ETag")); err != nil { |
126 | | - // return err |
127 | | - // } |
128 | | - // if err = d.Set("name", project.GetName()); err != nil { |
129 | | - // return err |
130 | | - // } |
131 | | - // if err = d.Set("body", project.GetBody()); err != nil { |
132 | | - // return err |
133 | | - // } |
134 | | - // if err := d.Set("url", fmt.Sprintf("https://github.com/%s/%s/projects/%d", |
135 | | - // owner, d.Get("repository"), project.GetNumber())); err != nil { |
136 | | - // return err |
137 | | - // } |
138 | | - |
139 | | - // return nil |
| 72 | + return fmt.Errorf("Repository projects are no longer supported. Projects V2 are organization or user-scoped. Please migrate to github_organization_project") |
140 | 73 | } |
141 | 74 |
|
142 | 75 | func resourceGithubRepositoryProjectUpdate(d *schema.ResourceData, meta any) error { |
143 | | - return fmt.Errorf("projects v1 are no longer supported by github") |
144 | | - |
145 | | - // client := meta.(*Owner).v3client |
146 | | - |
147 | | - // name := d.Get("name").(string) |
148 | | - // body := d.Get("body").(string) |
149 | | - |
150 | | - // options := github.ProjectOptions{ |
151 | | - // Name: &name, |
152 | | - // Body: &body, |
153 | | - // } |
154 | | - |
155 | | - // projectID, err := strconv.ParseInt(d.Id(), 10, 64) |
156 | | - // if err != nil { |
157 | | - // return unconvertibleIdErr(d.Id(), err) |
158 | | - // } |
159 | | - // ctx := context.WithValue(context.Background(), ctxId, d.Id()) |
160 | | - |
161 | | - // _, _, err = client.Projects.UpdateProject(ctx, projectID, &options) |
162 | | - // if err != nil { |
163 | | - // return err |
164 | | - // } |
165 | | - |
166 | | - // return resourceGithubRepositoryProjectRead(d, meta) |
| 76 | + return fmt.Errorf("Repository projects are no longer supported. Projects V2 are organization or user-scoped and cannot be updated via the REST API") |
167 | 77 | } |
168 | 78 |
|
169 | 79 | func resourceGithubRepositoryProjectDelete(d *schema.ResourceData, meta any) error { |
170 | | - return fmt.Errorf("projects v1 are no longer supported by github") |
171 | | - |
172 | | - // client := meta.(*Owner).v3client |
173 | | - |
174 | | - // projectID, err := strconv.ParseInt(d.Id(), 10, 64) |
175 | | - // if err != nil { |
176 | | - // return unconvertibleIdErr(d.Id(), err) |
177 | | - // } |
178 | | - // ctx := context.WithValue(context.Background(), ctxId, d.Id()) |
179 | | - |
180 | | - // _, err = client.Projects.DeleteProject(ctx, projectID) |
181 | | - // return err |
| 80 | + return fmt.Errorf("Repository projects are no longer supported. Projects V2 are organization or user-scoped and cannot be deleted via the REST API") |
182 | 81 | } |
0 commit comments