Open giveadamakick opened 7 months ago
I had a quick look at what could cause this, and it seems to be caused by the encoding of the body to JSON of the client. The following struct defines the pipelines configuration entity:
type PipelinesConfig struct {
Type_ string `json:"type"`
Enabled bool `json:"enabled,omitempty"`
Repository *Repository `json:"repository,omitempty"`
}
The problem here is that omitempty
is also applied when Enabled: false
, thus the value is never sent to the Bitbucket API.
The code solution is to transform the type to a pointer, so the value is only omitted when nil
.
Related issue: https://github.com/swagger-api/swagger-codegen/issues/7391
Terraform Version
1.6.1
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
The "Enable Pipelines" setting of the repo should have been set to false.
Actual Behavior
The "Enable Pipelines" setting of the repo was still set to true.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
bitbucket_repository
resource withpipelines_enabled
set totrue
.terraform apply
the new resource.pipelines_enabled
tofalse
in the Terraform config for that repo.terraform apply
the change.Important Factoids
Creating a new repo with
pipelines_enabled
initially tofalse
does work - pipelines are disabled. This bug only occurs when a repo that previously had pipelines enabled is updated to disable pipelines.References