Persistent diff when using gitlab_project_pull_mirror and gitlab_project resources together
Bug Report
When using the new resource gitlab_project_pull_mirror in conjunction with the gitlab_project resource, a persistent diff occurs for the gitlab_project.mirror and gitlab_project.import_url attributes.
The gitlab_project resource detects the changes made by the mirror resource and attempts to revert them (setting them to null), causing a diff on every plan.
Relevant Terraform Configuration
Example setup:
resource "gitlab_project" "this" {
name = "project-name"
description = "my description"
namespace_id = 123
default_branch = "main"
## Required workaround
# lifecycle {
# ignore_changes = [mirror,import_url]
# }
}
resource "gitlab_project_pull_mirror" "this" {
project = gitlab_project.this.id
url = "https://github.com/example/repo.git"
enabled = true
auth_user = "user"
auth_password = "pass"
mirror_trigger_builds = true
only_mirror_protected_branches = true
mirror_overwrites_diverged_branches = true
}
The current workaround is to add lifecycle { ignore_changes = [mirror, import_url] } to the gitlab_project resource.
Relevant Log Output
Diff logs
00:10:32.070 STDOUT terraform: # gitlab_project.this will be updated in-place
00:10:32.070 STDOUT terraform: ~ resource "gitlab_project" "this" {
00:10:32.070 STDOUT terraform: id = "123"
00:10:32.070 STDOUT terraform: - import_url = "https://github.com/example/repo.git" -> null
00:10:32.070 STDOUT terraform: - mirror = true -> null
00:10:32.070 STDOUT terraform: name = "project-name"
00:10:32.070 STDOUT terraform: tags = []
Additional Details
- GitLab Terraform Provider Version:
18.8.0 - GitLab Instance Version:
17.11.7 - Terraform Version:
1.13.5 - License Tier:
Premium
Edited by 🤖 GitLab Bot 🤖