terraform-provider-gitlab
terraform-provider-gitlab copied to clipboard
`public_builds` is always read as `false`
GitLab Provider version
v3.17.0
GitLab version
GitLab Enterprise Edition 15.1.2-ee
Terraform version
v1.2.8
Relevant Terraform Configuration
resource "gitlab_project" "test" {
name = "test"
path = "test"
builds_access_level = "private"
pipelines_enabled = true
public_builds = true
}
# Executing this a second time detects a change in public_builds
# Changing public_builds to false does not detect a change
Relevant log output
No response
Description
Changing public_builds
from true
to false
does not work. This is because the GitLab API changes the name of this field to public_jobs
in the response. PublicBuilds
is thus never set and uses the default false
value.
This inconsistency is known by GitLab, but there has been no recent movement to fix this (this would be a breaking change). One other option would be to map this in the GitLab API client, or this terraform provider.
This isn't quite as bad as it seems at first glance to fix. I did some testing on a 15.0+ gitlab instance, and "public_jobs" is accepted as both a parameter and provided as a response. Since public_jobs and public_builds are synonyms in this case, we should be able to resolve the bug by updating the go-gitlab library upstream to use the proper verbiage and translating that to the public_builds
parameter within the provier.
Flagging as a go-gitlab change along with a bug here.
https://github.com/xanzy/go-gitlab/blob/master/projects.go#L85
Upstream work has been completed so removing go-gitlab label
@Shocktrooper - We should probably add a new test to the provider for this, just to ensure it's fixed. However, it should "just work" now, I think.
It would be awesome if any of you could add a test to verify this 😇