Expected Behavior
When applying a github_repository_ruleset resource with an empty array conditions.ref_name, the provider should either produce a validation error or treat it as empty (not panic).
Actual Behavior
Terraform plan/apply fails with a panic:
panic: interface conversion: interface {} is nil, not map[string]interface {}
Stack trace:
by using the github.com/integrations/terraform-provider-github/v6/github.expandConditions function (util_rules.go:194) when conditions.ref_name is empty array or contains nil, the provider panics rather than failing gracefully.
Terraform Version
Terraform v1.9.5
provider registry.terraform.io/integrations/github v6.11.1
Affected Resource(s)
- github_repository_ruleset
Terraform Configuration Files
resource "github_repository_ruleset" "test" {
repository = "some-repo"
name = "test"
target = "branch"
enforcement = "disabled"
conditions {
ref_name {
# No include/exclude specified or empty arrays
}
}
rules {
creation = true
}
}
Steps to Reproduce
- Write the above github_repository_ruleset resource with an empty array conditions.ref_name block
- Run terraform apply
Debug Output
Panic Output
panic: interface conversion: interface {} is nil, not map[string]interface {}
github.com/integrations/terraform-provider-github/v6/github.expandConditions({0xc00067d2e0, ...}, 0x0)
github.com/integrations/terraform-provider-github/v6/github/util_rules.go:194 +0xb6b
...
Error: The terraform-provider-github_v6.11.1 plugin crashed!
Code of Conduct
Expected Behavior
When applying a github_repository_ruleset resource with an empty array conditions.ref_name, the provider should either produce a validation error or treat it as empty (not panic).
Actual Behavior
Terraform plan/apply fails with a panic:
Stack trace:
by using the github.com/integrations/terraform-provider-github/v6/github.expandConditions function (util_rules.go:194) when conditions.ref_name is empty array or contains nil, the provider panics rather than failing gracefully.
Terraform Version
Terraform v1.9.5
provider registry.terraform.io/integrations/github v6.11.1
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
Debug Output
Panic Output
panic: interface conversion: interface {} is nil, not map[string]interface {} github.com/integrations/terraform-provider-github/v6/github.expandConditions({0xc00067d2e0, ...}, 0x0) github.com/integrations/terraform-provider-github/v6/github/util_rules.go:194 +0xb6b ... Error: The terraform-provider-github_v6.11.1 plugin crashed!Code of Conduct