-
Notifications
You must be signed in to change notification settings - Fork 948
integration/terraform-provider-github auth doesn't work: "resource can only be used in the context of an organization" #878
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
AuthenticationStatus: StaleUsed by stalebot to clean houseUsed by stalebot to clean houseType: BugSomething isn't working as documentedSomething isn't working as documented
Description
Terraform Version
terraform -v
Terraform v1.0.4
on darwin_amd64
Affected Resource(s)
Please list the resources as a list, for example:
- github_team
Terraform Configuration Files
terraform {
required_providers {
github = {
source = "hashicorp/github"
version = "= 2.9.0"
}
}
}
# Exported GITHUB_TOKEN, GITHUB_OWNER, and GITHUB_ORGANIZATION to shell
provider "github" {}
resource "github_team" "some_team" {
name = "some-team"
description = "Some cool team"
privacy = "closed"
}Debug Output
Debug in gist:
https://gist.github.com/KyMidd/12336386b5a65db6fac73c1f6bab29f6
Expected Behavior
Terraform should use PAT to make changes to enterprise org.
Actual Behavior
Terraform provider reports either empty user, user name same as org name (?), PAT user's username, and reports "Error: This resource can only be used in the context of an organization, "KyMidd" is a user."
Terraform will perform the following actions:
# github_team.some_team will be created
+ resource "github_team" "some_team" {
+ create_default_maintainer = false
+ description = "Some cool team"
+ etag = (known after apply)
+ id = (known after apply)
+ members_count = (known after apply)
+ name = "some-team"
+ node_id = (known after apply)
+ privacy = "closed"
+ slug = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
github_team.some_team: Creating...
╷
│ Error: This resource can only be used in the context of an organization, "KyMidd" is a user.
│
│ with github_team.some_team,
│ on main.tf line 17, in resource "github_team" "some_team":
│ 17: resource "github_team" "some_team" {
│ Steps to Reproduce
- Create above config
- Exported GITHUB_TOKEN, GITHUB_OWNER, and GITHUB_ORGANIZATION to shell
- terraform init
- terraform apply
Important Factoids
- Normal GitHub org within enterprise. PAT has full admin access to Org.
- Have tested 2.9.0 provider, as well as newest version (4.13.0) of github/terraform-provider-github as well as integrations/terraform-provider-github
- I've read about the bugs this provider has around reading env variables vs provider static info, Org vs Owner, and have tried lots of combinations. None has worked so far.
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AuthenticationStatus: StaleUsed by stalebot to clean houseUsed by stalebot to clean houseType: BugSomething isn't working as documentedSomething isn't working as documented