You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fork parameter can be set to true to track the forked status of pre-existing github_repository resources that manage fork repositories, or left blank to prevent terraform from recreating the repository.
Actual Behavior
Terraform tries to recreate pre-existing github_repository resources that manage fork repositories on newer versions of the provider when the fork parameter is set to true.
terraform {
required_version=">= 1.5.7"required_providers {
github={
source ="integrations/github"
version ="6.8.3"
}
}
}
provider"github" {
owner="owner-here"
}
resource"github_repository""repository" {
name="fork-bug-terraform-provider-github"allow_update_branch=falseauto_init=falsedescription="Repository forked to troubleshoot provider issue when reading repository properties"has_discussions=falsehas_downloads=truehas_issues=falsehas_projects=truehas_wiki=falsehomepage_url="https://www.terraform.io/docs/providers/github/"# Added after upgrading to v6.8.3 from 6.7.5fork=truesource_repo="terraform-provider-github"source_owner="integrations"
}
Steps to Reproduce
Manually fork a repository using the Github Web UI
Import the repository to a github_repository in a terraform-provider-github version previous to feat(core): add fork functionality #2678 (6.7.5 was used in this case)
Run a successful apply that imports the resource, then upgrade to terraform-provider-github version 6.8.3
Set the resource fork, source_owner and source_repo parameters accordingly, then run terraform plan
Debug Output
Terraform will perform the following actions:
# github_repository.repository must be replaced
-/+ resource "github_repository""repository" {
~ default_branch = "main" -> (known after apply)
~ etag = "W/\"...\"" -> (known after apply)
+ fork = true# forces replacement~ full_name = "owner-here/fork-bug-terraform-provider-github" -> (known after apply)
~ git_clone_url = "git://github.com/owner-here/fork-bug-terraform-provider-github.git" -> (known after apply)
~ html_url = "https://github.com/owner-here/fork-bug-terraform-provider-github" -> (known after apply)
~ http_clone_url = "https://github.com/owner-here/fork-bug-terraform-provider-github.git" -> (known after apply)
~ id = "fork-bug-terraform-provider-github" -> (known after apply)
- is_template = false -> null
name = "fork-bug-terraform-provider-github"~ node_id = "..." -> (known after apply)
~ primary_language = "Go" -> (known after apply)
~ private = false -> (known after apply)
~ repo_id = ... -> (known after apply)
+ source_owner = "integrations"# forces replacement
+ source_repo = "terraform-provider-github"# forces replacement~ ssh_clone_url = "git@github.com:owner-here/fork-bug-terraform-provider-github.git" -> (known after apply)
~ svn_url = "https://github.com/owner-here/fork-bug-terraform-provider-github" -> (known after apply)
~ topics = [] -> (known after apply)
~ visibility = "public" -> (known after apply)
~ vulnerability_alerts = false -> (known after apply)
# (20 unchanged attributes hidden)
- security_and_analysis {
- secret_scanning {
- status = "enabled" -> null
}
- secret_scanning_push_protection {
- status = "enabled" -> null
}
}
}
Plan: 1 to add, 0 to change, 1 to destroy.
Expected Behavior
The
forkparameter can be set to true to track the forked status of pre-existinggithub_repositoryresources that manage fork repositories, or left blank to prevent terraform from recreating the repository.Actual Behavior
Terraform tries to recreate pre-existing
github_repositoryresources that manage fork repositories on newer versions of the provider when theforkparameter is set to true.Terraform Version
Terraform v1.5.7
on linux_amd64
Affected Resource(s)
github_repository
Terraform Configuration Files
Steps to Reproduce
github_repositoryin a terraform-provider-github version previous to feat(core): add fork functionality #2678 (6.7.5 was used in this case)fork,source_ownerandsource_repoparameters accordingly, then runterraform planDebug Output
Panic Output
Code of Conduct