-
Notifications
You must be signed in to change notification settings - Fork 949
Unsupported (?) API call to github API causes github pages to not work properly #1198
Copy link
Copy link
Closed
Description
Impacted resource: github_repository
If we want to change the publishing source for a github repository, the provider uses the following arguments:
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: -----------------------------------------------------
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: 2022/06/21 11:41:13 [DEBUG] Github API Request Details:
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: ---[ REQUEST ]---------------------------------------
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: PUT /repos/Scopevisio/TestRepo/pages HTTP/1.1
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: Host: api.github.com
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: User-Agent: go-github
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: Content-Length: 37
2022-06-21T11:41:13.197+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: Accept: application/vnd.github.v3+json
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: Content-Type: application/json
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: Accept-Encoding: gzip
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1:
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: {
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: "cname": null,
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: "source": "main /docs"
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1: }
2022-06-21T11:41:13.198+0200 [DEBUG] provider.terraform-provider-github_v4.26.1:
The documentation of the Github API, however specify a different method to set the branch and path:
{
"cname": null,
"source": {"branch":"main","path":"/docs"}
}
(https://docs.github.com/en/rest/pages#update-information-about-a-github-pages-site)
If we make the request using the method used by the terraform provider, we get an error:
2022-06-21T11:41:14.382+0200 [ERROR] vertex "github_repository.test" error: PUT https://api.github.com/repos/Scopevisio/TestRepo/pages: 422 Invalid request.
Invalid property /source: `main /docs` is not a possible value. Must be one of the following: gh-pages, master, master /docs. []
We can replicate this issue in CURL, but if we use the way provided in the GitHub API documentation it works flawlessly.
I am no expert in Go, but the corresponding source seems to be here:
| source += fmt.Sprintf(" %s", v) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels