Skip to content

[BUG]: github_repository_file rejects valid file paths containing ':' in v6.11.1 #3335

@dannysauer

Description

@dannysauer

Expected Behavior

github_repository_file should continue to support valid GitHub repository file paths that include a literal colon (:) in the filename, such as repro/example:one.yaml.

After creating a file at exactly repro/example:one.yaml with provider 6.11.0, upgrading to 6.11.1 should still allow refresh and plan to succeed.

Actual Behavior

After upgrading integrations/github from 6.11.0 to 6.11.1, terraform plan / tofu plan fails during refresh for existing github_repository_file resources whose file path contains :.

The provider returns:

Error: failed to build ID: unescaped separator in non-final part "repro/example:one.yaml"

This appears to come from github_repository_file building its resource ID with buildID(repo, file, branch), while buildID rejects : in all non-final parts.

Terraform Version

OpenTofu v1.11.5
on linux_amd64
+ provider registry.terraform.io/integrations/github v6.11.1

Affected Resource(s)

  • github_repository_file

Terraform Configuration Files

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "6.11.1"
    }
  }
}

variable "github_token" {
  type      = string
  sensitive = true
}

variable "owner" {
  type = string
}

variable "repository" {
  type = string
}

provider "github" {
  token = var.github_token
  owner = var.owner
}

resource "github_repository_file" "marker" {
  repository          = var.repository
  branch              = "main"
  file                = "repro/README.md"
  commit_message      = "create repro directory"
  overwrite_on_create = true
  content             = "Files in this directory are managed by Terraform."
}

resource "github_repository_file" "colon_filename" {
  repository          = var.repository
  branch              = "main"
  file                = "repro/example:one.yaml"
  commit_message      = "manage colon filename repro"
  overwrite_on_create = true
  content = yamlencode({
    apiVersion = "v1"
    kind       = "ConfigMap"
    metadata = {
      name = "example-one"
    }
  })
}

Steps to Reproduce

  1. Create an empty test repository with a main branch.
  2. Apply the configuration above with integrations/github 6.11.0 so the resource manages the literal path repro/example:one.yaml and stores it in state.
  3. Change only the provider version to 6.11.1.
  4. Run terraform plan or tofu plan again.
  5. Observe refresh fail before planning completes.

Debug Output

Error: failed to build ID: unescaped separator in non-final part "repro/example:one.yaml"

In my original production case, the same failure occurred on existing file paths like:

trivial-apps/infra-misc/kyverno/irsa/tf/nes-backstage:nes-backstage.yaml
trivial-apps/infra-misc/kyverno/irsa/tf/ack:ack-rds-controller.yaml
trivial-apps/infra-misc/kyverno/irsa/tf/kube-system:s3-csi-driver-sa.yaml

Panic Output

N/A

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions