Skip to content

Conversation

@megamih
Copy link

@megamih megamih commented May 5, 2024

Resolves #2254


Before the change?

  • Terraform GitHub provider lacks support for Deploy keys.
resource "github_organization_ruleset" "test" {
	name        = "test-%s"
	target      = "branch"
	enforcement = "active"

	conditions {
		ref_name {
			include = ["~ALL"]
			exclude = []
		}
	}

	bypass_actors {
		actor_id    = 0
		actor_type  = "DeployKey"
		bypass_mode = "always"
	}

	rules {
		creation = true

		update = true

		deletion                = true
		required_linear_history = true

		required_signatures = false

		pull_request {
			required_approving_review_count   = 2
			required_review_thread_resolution = true
			require_code_owner_review         = true
			dismiss_stale_reviews_on_push     = true
			require_last_push_approval        = true
		}

		required_status_checks {

			required_check {
				context = "ci"
			}

			strict_required_status_checks_policy = true
		}

		branch_name_pattern {
			name     = "test"
			negate   = false
			operator = "starts_with"
			pattern  = "test"
		}

		non_fast_forward = true
	}
}

returns an error

│ Error: expected bypass_actors.0.actor_type to be one of [RepositoryRole Team Integration OrganizationAdmin], got DeployKey

After the change?

  • Terraform GitHub provider supports Deploy keys for bypass access:
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # github_organization_ruleset.test will be created
  + resource "github_organization_ruleset" "test" {
  ...
      + bypass_actors {
          + actor_id    = 0
          + actor_type  = "DeployKey"
          + bypass_mode = "always"
        }
  ...
    }

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

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@megamih megamih force-pushed the bypass-deploykey branch from 688c713 to 4f71eeb Compare May 7, 2024 09:43
@kfcampbell
Copy link
Contributor

Unfortunately I can't accept this since it modifies a vendored file, and would be overwritten by any future update to the dependency. Perhaps it could be updated upstream first?

@milpog
Copy link

milpog commented Aug 29, 2024

I would be interested in having this feature added to provider ❤️

Unfortunately I can't accept this since it modifies a vendored file, and would be overwritten by any future update to the dependency. Perhaps it could be updated upstream first?

@kfcampbell I see it has been added in recent version of that go library https://github.com/google/go-github/blob/v64.0.0/github/repos_rules.go#L15-L21

@megamih maybe you could update your PR? Thanks!

@rsmets
Copy link

rsmets commented Oct 17, 2024

Bummed this has not been added to the provider yet.

@stevehipwell
Copy link
Collaborator

@megamih are you planning on continuing to work on this? If not I can add the changes to one of my PRs.

@erihanse
Copy link

erihanse commented Jan 6, 2025

We need this as well. What will require to get this in?

@benjy44
Copy link

benjy44 commented Mar 25, 2025

Is this still being worked on?
It would be really nice to have!

@nickfloyd
Copy link
Contributor

@megamih Thank you for the work here. I'll be closing this one in favor of the work done #2726. Let me know if you think your patch still should be applied, but the PRs are really similar.

@nickfloyd nickfloyd closed this Oct 21, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in 🧰 Octokit Active Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add DeployKey to bypass_actors in github_organization_ruleset and github_repository_ruleset

9 participants