Bug: inconsistent result after apply for `gitlab_pipeline_schedule` resource (`ref` attribute)
Bug Report
Scope
A regression appears to have been introduced with version 16.8.1 and is still present in the latest release (currently 16.10.0). The regression is not present in version 16.8.0.
The behaviour can be replicated on an existing gitlab_pipeline_schedule resource (see below) that was previously working fine in earlier provider versions.
Behaviour
When terraform apply-ing, even with no code changes, the provider fails with the following Terraform error message:
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to
│ module.foo.gitlab_pipeline_schedule.this, provider
│ "provider[\"registry.terraform.io/gitlabhq/gitlab\"]" produced an
│ unexpected new value: .ref: was cty.StringVal("main"), but now
│ cty.StringVal("refs/heads/main").
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
Extra info
Of note, the GitLab Pipeline schedules API documentation describes that for the ref argument:
-
the write operations (namely, create and update) will accept short refs but will implicitly expand them:
Attribute Type Required Description refstring ... The branch or tag name that is triggered. Both the short (e.g. main) and full (e.g.refs/heads/mainorrefs/tags/main) ref versions are accepted. If a short version is provided, it is automatically expanded to the full ref version but, if the ref is ambiguous, it will be rejected -
the read operation will return the expanded ref (as per the documented API response examples).
Additionally, the gitlabhq/gitlab provider documentation also describes an example ref argument value as the short ref (docs source).
Relevant Terraform Configuration
// module/foo/versions.tf
terraform {
required_providers {
gitlab = {
source = "gitlabhq/gitlab"
version = "16.8.1"
}
}
}
// module/foo/main.tf...
resource "gitlab_pipeline_schedule" "this" {
...
ref = "main"
take_ownership = true
}
resource "gitlab_pipeline_schedule_variable" "this" { ... }
Relevant Terraform Command
terraform apply...
Relevant Log Output
These are the debug logs of the `terraform` command output:
[see above]
Additional Details
- GitLab Terraform Provider Version:
16.8.1 - GitLab Version:
16.10 - Terraform Version:
1.8.0