terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: Repository resource is generating errors in 6.2.3

Open peter-murray opened this issue 7 months ago • 2 comments

Expected Behavior

GitHub Repository resources to be created and it not to error

Actual Behavior

I my cases the repository is created, but the terraform resource is erroring a consistent complaint on repository resources:

│ Error: json: cannot unmarshal array into Go struct field Repository.custom_properties of type string
│ 
│   with module.demo_repository.github_repository.repository,
│   on ../../demo_template/.demo/terraform/repository/main.tf line 28, in resource "github_repository" "repository":
│   28: resource "github_repository" "repository" {

It then does not get marked as successful or completed in its creation, but subsequent runs of the terraform complain that the resource is already there with 422 errors. This only happens at apply and not plan.

Terraform Version

OpenTofu version: 1.7.2 Go runtime version: go1.21.3 Installing integrations/github v6.2.3

Affected Resource(s)

  • github_repository

Terraform Configuration Files

resource "github_repository" "repository" {
  name                   = var.github_repository.repo
  description            = "Codespaces v1.5 demo repository for @${var.requestor_handle}"
  visibility             = "private"
  has_issues             = true
  delete_branch_on_merge = true

  # This is required otherwise we do not get a default branch for other follow on usage
  # of the repository to operate.
  auto_init              = true
}

Steps to Reproduce

Create a terraform module that leverages the github_repository resource and run an apply

tofu init
tofu apply -auto-approve -compact-warnings -input=false 

Debug Output

No response

Panic Output

module.demo_repository.github_repository.repository: Creating...
Error: -09T23:43:27.373Z [ERROR] provider.terraform-provider-github_v6.2.3: Response contains error diagnostic: @module=sdk.proto diagnostic_severity=ERROR tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail="" diagnostic_summary="json: cannot unmarshal array into Go struct field Repository.custom_properties of type string" tf_provider_addr=provider tf_req_id=39145ff4-9620-06c5-730d-671120ff10e6 tf_resource_type=github_repository tf_proto_version=5.6 timestamp=2024-07-09T23:43:27.373Z
Error: -09T23:43:27.374Z [ERROR] vertex "module.demo_repository.github_repository.repository" error: json: cannot unmarshal array into Go struct field Repository.custom_properties of type string

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

peter-murray avatar Jul 10 '24 17:07 peter-murray