Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_branch_default *always* returns 422 Visibility is already private. [] on deletion #620

Closed
kiddom-kq opened this issue Dec 4, 2020 · 3 comments
Labels
r/branch_default Type: Bug Something isn't working as documented

Comments

@kiddom-kq
Copy link

kiddom-kq commented Dec 4, 2020

I've found an issue that seems to crop up on repo deletion.
The issue appears to be with private repos that have a `` resource set.

Terraform Version

This issue is reproducible on the latest versions. (as of today; 2020-12-04)

❯ terraform version --json
{
  "terraform_version": "0.14.0",
  "terraform_revision": "",
  "provider_selections": {
    "registry.terraform.io/hashicorp/aws": "3.19.0",
    "registry.terraform.io/hashicorp/github": "4.1.0"
  },
  "terraform_outdated": false
}

Affected Resource(s)

  • github_branch_default

Terraform Configuration Files

Here is a simple test-case that is identical to the test case I used to find/document this bug. I have stripped out org/personal information and substituted generic tokens in place:

terraform {

  backend "s3" {
   # omitted...
  }

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3"
    }
    github = {
      source = "hashicorp/github"
      version = "~> 4"
    }
  }
}

provider "github" {
  token = var.GITHUB_TOKEN
  organization = var.GITHUB_ORGANIZATION
}

resource "github_repository" "myOrg_testing" {
  name = "gh-issue-test"
  visibility = "private"

  has_issues = true
  has_projects = false
  has_wiki = false
  is_template = false
  allow_merge_commit = true
  allow_squash_merge = true
  allow_rebase_merge = true
  delete_branch_on_merge = false
  has_downloads = false
  auto_init = false
  archived = false
  vulnerability_alerts = true
  gitignore_template = ""
  license_template = ""
}

# See: https://github.com/terraform-providers/terraform-provider-github/blob/master/website/docs/r/branch_default.html.markdown
resource "github_branch_default" "myOrg_testing" {
  repository = github_repository.myOrg_testing.name
  branch     = "MyNonMainDefaultBranch"
}

resource "github_branch_protection" "myOrg_testing" {
  repository_id = github_repository.myOrg_testing.node_id
  pattern       = "MyNonMainDefaultBranch"
  enforce_admins = false
}

#####
# Access Control
#####
resource "github_team_repository" "testing-ops-team-access" {
  team_id    = github_team.ops.id
  repository = github_repository.myOrg_testing.name
  permission = "admin"
}

# Rest of org
resource "github_team_repository" "testing-developers-team-access" {
  team_id    = github_team.developers.id
  repository = github_repository.myOrg_testing.name
  permission = "push"
}

Debug Output

Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Here is a short version:

❯ terraform destroy --target=github_branch_default.myOrg_testing
github_branch_default.myOrg_testing: Refreshing state... [id=gh-issue-test]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # github_branch_default.myOrg_testing will be destroyed
  - resource "github_branch_default" "myOrg_testing" {
      - branch     = "MyNonMainDefaultBranch" -> null
      - id         = "gh-issue-test" -> null
      - repository = "gh-issue-test" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.


Warning: Resource targeting is in effect

You are creating a plan with the -target option...<snip>

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

github_branch_default.myOrg_testing: Destroying... [id=gh-issue-test]

Warning: Applied changes may be incomplete

The plan was created with the -target option in effect...<snip>

Note that the -target option is not suitable for routine use...<snip>

Error: PATCH https://api.github.com/repos/myOrg/gh-issue-test: 422 Visibility is already private. []

Note: I get the same result if I comment out only the github_branch_default resource and then run a normal terraform apply. I just used --target to hone which resource caused the error.

I am more than happy to provide the full TF_LOG=TRACE output, but it's 3K lines long with the --target flag. I've included the relevant bits below:

2020-12-04T09:34:24.880-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: -----------------------------------------------------
2020-12-04T09:34:24.880-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: 2020/12/04 09:34:24 [TRACE] Acquiring lock for GitHub API request (%!q(<nil>))
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: 2020/12/04 09:34:25 [TRACE] Releasing lock for GitHub API request (%!q(<nil>))
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: 2020/12/04 09:34:25 [DEBUG] Github API Response Details:
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: ---[ RESPONSE ]--------------------------------------
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: HTTP/1.1 422 Unprocessable Entity
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Content-Length: 93
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Access-Control-Allow-Origin: *
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Content-Security-Policy: default-src 'none'
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Content-Type: application/json; charset=utf-8
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Date: Fri, 04 Dec 2020 17:34:25 GMT
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Server: GitHub.com
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Status: 422 Unprocessable Entity
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: Vary: Accept-Encoding, Accept, X-Requested-With
2020-12-04T09:34:25.306-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Accepted-Oauth-Scopes:
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Content-Type-Options: nosniff
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Frame-Options: deny
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Github-Media-Type: github.baptiste-preview; format=json, github.nebula-preview; format=json
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Github-Request-Id: E775:1715:749DA3:8FD7A3:5FCA7320
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Oauth-Scopes: admin:org, delete_repo, repo
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Ratelimit-Limit: 5000
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Ratelimit-Remaining: 4997
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Ratelimit-Reset: 1607106864
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Ratelimit-Used: 3
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: X-Xss-Protection: 1; mode=block
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4:
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: {
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4:  "message": "Visibility is already private.",
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4:  "documentation_url": "https://github.com/pricing"
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: }
2020-12-04T09:34:25.307-0800 [DEBUG] plugin.terraform-provider-github_v4.1.0_x4: -----------------------------------------------------
2020/12/04 09:34:25 [DEBUG] github_branch_default.myOrg_testing: apply errored, but we're indicating that via the Error pointer rather than returning it: PATCH https://api.github.com/repos/myOrg/gh-issue-test: 422 Visibility is already private. []
2020/12/04 09:34:25 [TRACE] EvalWriteState: writing current state object for github_branch_default.myOrg_testing
2020/12/04 09:34:25 [TRACE] vertex "github_branch_default.myOrg_testing (destroy)": visit complete
2020/12/04 09:34:25 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/github\"] (close)" errored, so skipping
2020/12/04 09:34:25 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/12/04 09:34:25 [TRACE] dag/walk: upstream of "root" errored, so skipping

Panic Output

No panic produced.

Expected Behavior

I would expect the default branch configuration to be deleted w/o the 422 API error.

Actual Behavior

I get this error returned from GH API:

Error: PATCH https://api.github.com/repos/myOrg/gh-issue-test: 422 Visibility is already private. []

Steps to Reproduce

  1. (see note2 below) comment out the github_branch_default resource in the above 'test case' configuration.
  2. run tf apply against the config and observe that 4 resources are created, one of which is the repo.
  3. un-comment out the github_branch_default resource in the above 'test-case' config.
  4. use either the web UI or git checkout -b && git push to make the branch called MyNonMainDefaultBranch in the new repo
  5. run tf apply against the config and observe that one new resource will be created
  6. determine that the repo and associated resources created in the test config must now be deleted
  7. comment out all the resources in the above test case
  8. run tf apply against the config and observe that 5 resources will be destroyed
  9. observe that some resources have been deleted:
  • github_team_repository.testing-ops-team-access: Destruction complete after 0s
  • github_team_repository.testing-developers-team-access: Destruction complete after 2s
  • github_branch_protection.myOrg_testing: Destruction complete after 3s
  1. (see note1 below). Manually remove the github_branch_default resource from the state file
  2. run tf apply against the config and observe that the remaining resource (the github_repository.myOrg_testing ) will be destroyed

Note1:: If, instead of manually removing the github_branch_default resource from the state file as in step 10, you leave ONLY the github_repository resource un-commented, terraform will still only destroy the github_branch_default.myOrg_testing resource. This tells me that the dependency resolution is logically correct but inefficient/un-optimized; the deletion of the github_branch_default does not matter if the github_repository is to be deleted. Deleting the repo necessarily deletes the default branch config.

Note2: Failure to comment out the github_branch_default resource in step 1 will result in an error:

Error: PATCH https://api.github.com/repos/myOrg/gh-issue-test: 422 Validation Failed [{Resource:Repository Field:default_branch Code:invalid Message:Cannot update default branch for an empty repository. Please init the repository and push first.}]

Important Factoids

I can reproduce this behavior with the token that was allocated specifically for our automated Terraform ci/cd pipeline and with my personal token which has 'Owner' level permissions attached to it.

The workaround is to:

  1. comment out / delete the github_branch_default resource from the *.tf file(s).

  2. manually remove the github_branch_default resource from the state file: terraform state rm github_branch_default.myOrg_testing:

Removed github_branch_default.myOrg_testing
Successfully removed 1 resource instance(s).
  1. re-run terraform apply and let it observe that the github_repository is missing and thus should be deleted. Deleting the repo necessarily deletes the repos' default branch config.

References

These issues seem related:

https://github.com/terraform-providers/terraform-provider-github/issues/580

@jcudit jcudit added r/branch_default Type: Bug Something isn't working as documented labels Dec 23, 2020
dee-kryvenko added a commit to dee-kryvenko/terraform-provider-github that referenced this issue Jan 21, 2021
jcudit pushed a commit that referenced this issue Jan 22, 2021
#666)

* github_branch_default: send only fields that changed. Fixes #625 #620.

* fix failing test and update docs

Co-authored-by: Jeremy Udit <[email protected]>
@onurg
Copy link

onurg commented Jan 25, 2021

just hit the same issue on a terratest run:

  • we're creating a dummy repo with visibility set to private
  • we apply, test and destroy
  • on destroy it fails
TestRepositoryValidity 2021-01-25T19:58:34Z logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_branch_default.default_branch: Destroying... [id=test-dummy-repo-1]
TestRepositoryValidity 2021-01-25T19:58:35Z logger.go:66: 
TestRepositoryValidity 2021-01-25T19:58:35Z logger.go:66: Error: PATCH https://api.github.com/repos/xxxx/test-dummy-repo-1: 422 Visibility is already private. []
TestRepositoryValidity 2021-01-25T19:58:35Z logger.go:66: 
TestRepositoryValidity 2021-01-25T19:58:35Z logger.go:66: 
TestRepositoryValidity 2021-01-25T19:58:35Z retry.go:80: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: PATCH https://api.github.com/repos/xxxx/test-dummy-repo-1: 422 Visibility is already private. []

}
    destroy.go:11: 
        	Error Trace:	destroy.go:11
        	            				terratest.go:56
        	            				tests_test.go:50
        	Error:      	Received unexpected error:
        	            	FatalError{Underlying: error while running command: exit status 1; 
        	            	Error: PATCH https://api.github.com/repos/xxxx/test-dummy-repo-1: 422 Visibility is already private. []
        	            	
        	            	}

@jcudit
Copy link
Contributor

jcudit commented Jan 26, 2021

Seems like the fix released in #666 only corrected the create / update operations. We'll need to follow up with the delete operation to finalize the fix. Thanks for reporting @onurg.

Can anyone else confirm the v4.3.1 release is not sufficient here?

@onurg
Copy link

onurg commented Jan 26, 2021

hi @jcudit @kiddom-kq, just verified v4.3.1 fixes it. if somebody else also wants to confirm that the fix was sufficient, feel free to do so.

here's the destroy output from the same run I posted prior:

TestRepositoryValidity 2021-01-26T13:24:28-05:00 retry.go:72: terraform [destroy -auto-approve -input=false -lock=false]
TestRepositoryValidity 2021-01-26T13:24:28-05:00 logger.go:66: Running command terraform with args [destroy -auto-approve -input=false -lock=false]
TestRepositoryValidity 2021-01-26T13:24:29-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team.create_team: Refreshing state... [id=4465638]
TestRepositoryValidity 2021-01-26T13:24:29-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team_membership.add_member["Whitening-McClean"]: Refreshing state... [id=4465638:Whitening-McClean]
TestRepositoryValidity 2021-01-26T13:24:29-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository.create_repo: Refreshing state... [id=test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:29-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_team_repository.team_membership["dummy-team"]: Refreshing state... [id=4465638:test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:29-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_branch_default.default_branch: Refreshing state... [id=test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:30-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository_file.codeowners: Refreshing state... [id=test-dummy-repo-1/.github/CODEOWNERS]
TestRepositoryValidity 2021-01-26T13:24:31-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_team_repository.team_membership["dummy-team"]: Destroying... [id=4465638:test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:31-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository_file.codeowners: Destroying... [id=test-dummy-repo-1/.github/CODEOWNERS]
TestRepositoryValidity 2021-01-26T13:24:31-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_team_repository.team_membership["dummy-team"]: Destruction complete after 1s
TestRepositoryValidity 2021-01-26T13:24:33-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository_file.codeowners: Destruction complete after 3s
TestRepositoryValidity 2021-01-26T13:24:33-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_branch_default.default_branch: Destroying... [id=test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:34-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_branch_default.default_branch: Destruction complete after 1s
TestRepositoryValidity 2021-01-26T13:24:34-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository.create_repo: Destroying... [id=test-dummy-repo-1]
TestRepositoryValidity 2021-01-26T13:24:36-05:00 logger.go:66: module.repositories["repositories/test-dummy-repo-1"].github_repository.create_repo: Destruction complete after 1s
TestRepositoryValidity 2021-01-26T13:24:36-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team_membership.add_member["Whitening-McClean"]: Destroying... [id=4465638:Whitening-McClean]
TestRepositoryValidity 2021-01-26T13:24:37-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team_membership.add_member["Whitening-McClean"]: Destruction complete after 2s
TestRepositoryValidity 2021-01-26T13:24:37-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team.create_team: Destroying... [id=4465638]
TestRepositoryValidity 2021-01-26T13:24:39-05:00 logger.go:66: module.teams["teams/dummy-team"].github_team.create_team: Destruction complete after 1s
TestRepositoryValidity 2021-01-26T13:24:39-05:00 logger.go:66:
TestRepositoryValidity 2021-01-26T13:24:39-05:00 logger.go:66: Destroy complete! Resources: 6 destroyed.

@jcudit jcudit closed this as completed Jan 29, 2021
k24dizzle added a commit to lyft/terraform-provider-github that referenced this issue Feb 22, 2021
* v4.1.0

* Fix unable to resolve node id for branch_protection (integrations#610)

* Don't check node id for length

* Check if node id is valid base 64

Co-authored-by: Willem Gillis <[email protected]>

* temporarily disable PR acceptance testing

these jobs all fail and are confusing to contributors when launched from 
a PR raised by a fork.  there are ways to get around this, but will 
defer until the repository is transferred.  disabling for now.

* remove `ForceNew` on `template*` as they are concerns only at creation time (integrations#609)

There are a number of resources that have been marked as `ForceNew: true` out of a desire in "correctness" by those that do not actually understand how these resources are used in the real world and damage that can be done. No one wants to blow up a repository to change something like this, if they need to there is a mechanism built into terraform called [taint](https://www.terraform.io/docs/commands/taint.html). While there are some things that make sense for using `ForceNew` a repository for source control on properties that the API will ignore outside of creation is not one of them.

Signed-off-by: Ben Abrams <[email protected]>

* Add diff suppression function to the branch protection resource (integrations#614)

Adding a diff suppression function to the branch protection resource to
ignore the strict status check field if no contexts have been specified.

This resolves the issue with the GraphQL API returning a strict status
check value of "true" by default, regardless of contexts being set or
not.

* Add Apps to actor types in branch protection (integrations#615)

Adding Github Apps to actor types in the branch protection resource.

NOTE: Apps as an actor type is only available in push restrictions.

* Added `allowsDeletions`and `allowsForcePushes`settings (integrations#623)

* Added `allowsDeletions`and `allowsForcePushes`settings https://developer.github.com/v4/changelog/2020-11-13-schema-changes/ (#1)

* complete documentation

* update module github.com/shurcooL/githubv4 with `go get github.com/shurcooL/githubv4`

* vendor latest githubv4

* add test for deletions and force pushes

Co-authored-by: Jeremy Udit <[email protected]>

* Fix syntax error

* Conditionally Run GHES Test Suite

* Run gofmt (integrations#645)

Signed-off-by: Stephen Hoekstra <[email protected]>

* Allow dependabot to check github actions (integrations#643)

* Typo: s/visiblity/visibility (integrations#629)

Small typo in the docs.

* github_repository_webhook: describe content_type options (integrations#510)

* change private to visibility (integrations#635)

* Use commit SHA to lookup commit info in github_repository_file resource (integrations#644)

* Fix references to "master"

Signed-off-by: Stephen Hoekstra <[email protected]>

* Use commit SHA to lookup commit info

Currently the provider loops through commits in a repo until it finds the most recent commit containing the managed file. This is inefficient and could lead to you being rate limited if managing a few files that were updated a long time ago.

This commit fixes that by storing the commit SHA when updating the file and using that SHA to lookup the commit info instead of looping through all commits.

Signed-off-by: Stephen Hoekstra <[email protected]>

* add release automation for terraform registry

/cc https://www.terraform.io/docs/registry/providers/publishing.html

* Add v4.2.0 Release (integrations#641)

* add v4.1.1 release items

* correct semver version

* Document Additional Breaking Change For v3.0.0

* add `github_repository_file` bugfix

* move to correct release

* add goreleaser configuration to enable release automation

* resource/repository: add support for enabling github pages (integrations#490)

* add support for enabling github pages

* update resource comments

* add additional comments in expand methods

* add formatting fixes

Co-authored-by: Jeremy Udit <[email protected]>

* Add `github_branch_protection_v3` Resource (integrations#642)

* Add `branch_protection_v3` Resource

- add new resource to `website/github.erb`
- add new resource to `website/docs/r/<resource>.html.markdown`
- add new resource to `github/provider.go`
- add tests for resource in `github/resource_<resource>_test.go`
- implement new resource in `github/resource_<resource>.go`

* fixup! gofmt fixes

* add changelog entries for v4.3.0 release (integrations#658)

* Remove github.com/hashicorp/terraform from dependencies (integrations#628)

* remove github.com/hashicorp/terraform from dependencies

* go mod tidy

* refactor: execute fmt

* Allow dependabot to check go dependencies (integrations#653)

* Fix link to Milestones page (integrations#663)

* github_branch_default: send only fields that changed. Fixes integrations#625 integrations#620. (integrations#666)

* github_branch_default: send only fields that changed. Fixes integrations#625 integrations#620.

* fix failing test and update docs

Co-authored-by: Jeremy Udit <[email protected]>

* Fix error handling (integrations#668)

Do not silently proceed further on receiving an error response.

Signed-off-by: rustyclock <[email protected]>

* Update CHANGELOG.md

* Remove Obsolete Test

My understanding is our use of Terraform Registry makes this failing test unnecessary.

* Update GitHub organization references (integrations#672)

Following the project transfer from `terraform-providers` organization to `integrations`.

* Add Example For `github_team_repository` (integrations#676)

* Add Example For `github_team_repository`

also documents a limitation with `for_each` in this scenario

* fixup! add newline

* changelog: manually fix links to issues (integrations#673)

They were pointing to the old archived repo, which doesn't have newer issues.

* Handle base64 decodable repo names (integrations#684)

* github/config: Fix detection of individual, non-org accounts (integrations#685)

- Previously, whenever an individual user tried to interact with their
  repos, the provider would return an error, rendering v4.3.1 unusable
  _for individuals_:

  ```
  ➜ terraform plan
  Error: GET https://api.github.com/orgs/issyl0: 404 Not Found []
  on /Users/issyl0/repos/terraform/github.tf line 1, in provider "github":
  ```

- `ConfigureOwner` works such that if the `owner.name` is not blank (ie,
  the user had specified `owner = <username>` in their Terraform file),
  the code progresses to check if the `owner.name` is an org.
  Importantly, that check (prior to this change) returned an error if
  `owner.name` was not an org. That final error meant it was impossible
  to run if not using an organisation account.

- Reproduction steps: https://gist.github.com/issyl0/cd61e4cb59de2c2e1e8f45e3cf7c12f5

* add changelog entry for v4.3.2

* Add `create_default_maintainer` Option To `github_team` (integrations#661)

* Add `create_default_maintainer` option to `github_team`

This adds a possible fix to the following issues by providing users with an option to remove the automatic addition of a default maintainer to a team during creation.

/cc integrations#527
/cc integrations#104
/cc integrations#130

* Refresh CONTRIBUTING Documentation (integrations#682)

* refresh contributing docs

* add quick instructions

* add updates for newer versions of terraform

* Add Diff Suppression Option To `repository_collaborator` (integrations#683)

* add diff suppression option to `repository_collaborator`

* fixup! remove comment

* remove hardcoded username from test

* Update CHANGELOG for v4.4.0 release

* Add repo context to error message when branch is not found (integrations#691)

* Add repo context to error message when branch is not found

* fix failing `TestAccGithubRepositoryFile` test

access committer data through `Commit` struct

Co-authored-by: Jeremy Udit <[email protected]>

* fix based on linter (integrations#694)

* add v4.4.1 release notes

* Modify github_team_repository to accept slug as a valid team_id as well (integrations#693)

* First attempt

* Add comment

* Attempt to modify unit tests

* Edit docs to reflect change

* Make sure team_id is set appropriately

* fixing lint

* add passing tests for `github_team_repository`

Co-authored-by: Jeremy Udit <[email protected]>

* add v4.5.0 release notes

* temporarily ignore `darwin/arm64` to unblock releases

/cc integrations#695

* update release notes for v4.5.0

Co-authored-by: tf-release-bot <[email protected]>
Co-authored-by: Polygens <[email protected]>
Co-authored-by: Willem Gillis <[email protected]>
Co-authored-by: Jeremy Udit <[email protected]>
Co-authored-by: Ben Abrams <[email protected]>
Co-authored-by: Patrick Marabeas <[email protected]>
Co-authored-by: Francois BAYART <[email protected]>
Co-authored-by: Stephen Hoekstra <[email protected]>
Co-authored-by: John Losito <[email protected]>
Co-authored-by: Bret <[email protected]>
Co-authored-by: Jakub Holy <[email protected]>
Co-authored-by: Ichinose Shogo <[email protected]>
Co-authored-by: angie pinilla <[email protected]>
Co-authored-by: Shu Kutsuzawa <[email protected]>
Co-authored-by: Oleksandr Dievri <[email protected]>
Co-authored-by: Dee Kryvenko <[email protected]>
Co-authored-by: Ravi <[email protected]>
Co-authored-by: Alexis Gauthiez <[email protected]>
Co-authored-by: Christian Höltje <[email protected]>
Co-authored-by: Issy Long <[email protected]>
Co-authored-by: Michael Barany <[email protected]>
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this issue Jul 26, 2022
…ons#625 integrations#620. (integrations#666)

* github_branch_default: send only fields that changed. Fixes integrations#625 integrations#620.

* fix failing test and update docs

Co-authored-by: Jeremy Udit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r/branch_default Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

4 participants
@jcudit @onurg @kiddom-kq and others