Skip to content

Some resources can only be used in the context of an organization #501

@emmahsax

Description

@emmahsax

Terraform Version

Terraform Version: 0.12.28
Provider Version: 2.9.0

Affected Resource(s)

  • github_branch
  • github_issue_label
  • probably others that I don't use as much

Terraform Configuration Files

resource "github_branch" "branch" {
  for_each      = toset(local.branches)
  repository    = github_repository.repo.name
  branch        = each.value
  source_branch = var.source_branch

  lifecycle {
    ignore_changes        = [branch, source_branch]
    create_before_destroy = true
  }
}

resource "github_issue_label" "label" {
  for_each   = var.labels
  repository = github_repository.repo.name
  name       = each.key
  color      = each.value
}

Debug Output

Setting debugging seems to yield any separate results from running w/out debugging.

Panic Output

No panic output.

Expected Behavior

Terraform should've had no problems creating GitHub branches and labels on repositories that are owned by a GitHub user.

Actual Behavior

Terraform erred with the following:

Error: This resource can only be used in the context of an organization, "foobar" is a user.

  on ../tf-library/label.tf line 1, in resource "github_issue_label" "label":
   1: resource "github_issue_label" "label" {

Error: This resource can only be used in the context of an organization, "foobar" is a user.

  on ../tf-library/branch.tf line 6, in resource "github_branch" "branch":
   6: resource "github_branch" "branch" {

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Use provider version 2.9.0 and specify a GitHub user as the owner
  2. Codify creating a new GH branch for a repository the GH user owns
  3. Codify creating a new label for a repository the GH user owns
  4. Run terraform init
  5. Run terraform apply
  6. See errors

Important Factoids

None that I can think of.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions