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

Bug: github_enterprise_organization cannot edit organisation member owners

Open marknet15 opened this issue 2 years ago • 2 comments

Overview

I recently started trying to use github_enterprise_organization that was added here: https://github.com/integrations/terraform-provider-github/pull/1478 However there seems to be a bug around editing admin_logins after the organization is initially created. Creation works just fine.

Just to add, I'm currently targeting a GitHub enterprise v3.6 self-hosted instance.

The exact error is:

 Error: AddEnterpriseOrganizationMemberInput isn't a defined input type (on $input)

I only really have basic knowledge of Go but after some digging into the code, I think it might be that the v4 API doesn't have a mutator for updating the organisation members similar to the case around organisation description updates noted here: https://github.com/integrations/terraform-provider-github/blob/f60e5567722fdb563234371e538788fa3f45c3f3/github/resource_github_enterprise_organization.go#L86-L87

My tf

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 5.0"
    }
  }
}

data "github_enterprise" "enterprise" {
  slug = var.github_enterprise
}

resource "github_enterprise_organization" "organization" {
  enterprise_id = data.github_enterprise.enterprise.id
  name          = var.name
  description   = var.description
  billing_email = var.billing_email
  admin_logins  = var.organization_owners
}

Full debug output

2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0: {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:  "errors": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "path": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "mutation"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "extensions": {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "code": "variableRequiresValidType",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "typeName": "AddEnterpriseOrganizationMemberInput",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "variableName": "input"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    },
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "locations": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "line": 1,
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "column": 10
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     }
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "message": "AddEnterpriseOrganizationMemberInput isn't a defined input type (on $input)"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   },
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "path": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "mutation",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "addEnterpriseOrganizationMember"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "extensions": {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "code": "undefinedField",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "typeName": "Mutation",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "fieldName": "addEnterpriseOrganizationMember"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    },
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "locations": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "line": 1,
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "column": 56
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     }
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "message": "Field 'addEnterpriseOrganizationMember' doesn't exist on type 'Mutation'"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   },
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "path": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "mutation"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "extensions": {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "code": "variableNotUsed",
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     "variableName": "input"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    },
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "locations": [
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     {
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "line": 1,
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:      "column": 1
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:     }
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    ],
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:    "message": "Variable $input is declared by anonymous mutation but not used"
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:   }
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0:  ]
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0: }
2023-01-27T11:53:03.140Z [DEBUG] provider.terraform-provider-github_v5.16.0: -----------------------------------------------------
2023-01-27T11:53:03.146Z [ERROR] vertex "module.github_organization[\"markw-test4\"].github_enterprise_organization.organization" error: AddEnterpriseOrganizationMemberInput isn't a defined input type (on $input)
╷
│ Error: AddEnterpriseOrganizationMemberInput isn't a defined input type (on $input)
│ 
│   with module.github_organization["markw-test4"].github_enterprise_organization.organization,
│   on ../../modules/github_organization/main.tf line 14, in resource "github_enterprise_organization" "organization":
│   14: resource "github_enterprise_organization" "organization" {
│ 
╵
╷
│ Error: AddEnterpriseOrganizationMemberInput isn't a defined input type (on $input)
│ 
│   with module.github_organization["markw-test2"].github_enterprise_organization.organization,
│   on ../../modules/github_organization/main.tf line 14, in resource "github_enterprise_organization" "organization":
│   14: resource "github_enterprise_organization" "organization" {
│ 

marknet15 avatar Jan 27 '23 12:01 marknet15