-
Notifications
You must be signed in to change notification settings - Fork 948
provider wants to endlessly change the branches attribute of github_repository resource when repo is archived #1037
Copy link
Copy link
Closed
Description
Hey,
What the title says basically. The provider keeps trying to change the branches attribute of the github_repository resource, when the repo is archived. Even after applying, which outputs no error, the drift persists.
I presume this is related to the fact that even via the UI, when a repo is archived, it is read-only and thus branches config cannot change. So when visiting https://github.com/$org/$repo$/settings/branches one gets this message:

Terraform Version
1.1.2
Affected Resource(s)
- github_repository
Terraform Configuration Files
resource "github_repository" "r" {
name = var.name
description = var.description
visibility = var.visibility
homepage_url = var.homepage_url
allow_merge_commit = var.allow_merge_commit
allow_squash_merge = var.allow_squash_merge
allow_rebase_merge = var.allow_rebase_merge
vulnerability_alerts = var.vul_alerts
has_downloads = var.has_downloads
has_issues = var.has_issues
archived = var.archived
archive_on_destroy = var.archive_on_destroy
topics = var.topics
is_template = var.is_template
delete_branch_on_merge = var.delete_br_on_merge
auto_init = true
allow_auto_merge = var.allow_auto_merge
dynamic "template" {
for_each = length(var.template_name) > 0 ? [""] : []
content {
owner = "$redacted"
repository = var.template_name
}
}
lifecycle {
ignore_changes = [auto_init]
}
}Expected Behavior
No drift to be outputted
Actual Behavior
# module.repo_test-repo.github_repository.r will be updated in-place
~ resource "github_repository" "r" {
+ branches = (known after apply)
id = "$redacted"
name = "$redacted"
# (28 unchanged attributes hidden)
}
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- import an archived repo (or archive it after creating it via terraform)
- plan
- see drift being outputted
- issue is mitigated when
branchesis included in theignore_changesarray, but this could lead to other issues too
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels