integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
886 stars 726 forks source link

feat: add `github_enterprise_actions_runner_group` #2158

Closed bradam12 closed 5 months ago

bradam12 commented 6 months ago

Resolves #1482

This adds a new resource github_enterprise_actions_runner_group to control runner groups at the enterprise level.

Additional attribute database_id added to data.github_enterprise and resource.github_enterprise_organization. The id fields on these two items are the node ID used for v4, and the "traditional" ID is exposed via DatabaseId. Other items use node_id and id, but I didn't want to introduce a breaking change so I just added as new attributes.

data "github_enterprise" "enterprise" {
  slug = "my-enterprise"
}

resource "github_enterprise_organization" "enterprise_organization" {
  enterprise_id = data.github_enterprise.enterprise.id
  name          = "my-organization"
  billing_email = "octocat@octo.cat"
  admin_logins  = ["octocat"]
}

resource "github_enterprise_actions_runner_group" "example" {
  name                       = "my-awesome-runner-group"
  enterprise_slug            = data.github_enterprise.enterprise.slug
  allows_public_repositories = true
  visibility                 = "selected"
  selected_organization_ids  = [github_enterprise_organization.enterprise_organization.database_id]
  restricted_to_workflows    = true
  selected_workflows         = ["my-organization/my-repo/.github/workflows/cool-workflow.yaml@refs/tags/v1"]
}

Tests are added and running successfully. I set the following env vars: GITHUB_ORGANIZATION, GITHUB_BASE_URL, GITHUB_TOKEN, ENTERPRISE_ACCOUNT, ENTERPRISE_SLUG

--- PASS: TestAccGithubActionsEnterpriseRunnerGroup (88.91s)
    --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/creates_enterprise_runner_groups_without_error (9.65s)
        --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/creates_enterprise_runner_groups_without_error/with_an_enterprise_account (9.65s)
    --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/manages_runner_group_visibility_to_selected_orgs (29.34s)
        --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/manages_runner_group_visibility_to_selected_orgs/with_an_enterprise_account (29.34s)
    --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/imports_an_all_runner_group_without_error (13.57s)
        --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/imports_an_all_runner_group_without_error/with_an_enterprise_account (13.57s)
    --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/imports_a_runner_group_with_selected_orgs_without_error (36.36s)
        --- PASS: TestAccGithubActionsEnterpriseRunnerGroup/imports_a_runner_group_with_selected_orgs_without_error/with_an_enterprise_account (36.36s)
PASS
ok      github.com/integrations/terraform-provider-github/v6/github     88.995s

Pull request checklist

Does this introduce a breaking change?

Please see our docs on breaking changes to help!


ajschmidt8 commented 6 months ago

@bradam12, thanks for your work here. My team could really use this feature.

Looking forward to seeing it merged and deployed.

ajschmidt8 commented 6 months ago

@bradam12, what's the status of this PR? Is there anything left to do or can I tag a maintainer for a final review?

Have these changes been tested on your Enterprise account?

bradam12 commented 6 months ago

@bradam12, what's the status of this PR? Is there anything left to do or can I tag a maintainer for a final review?

Have these changes been tested on your Enterprise account?

Nothing left on my end. I've tested this in our GHES.

ajschmidt8 commented 6 months ago

@kfcampbell, can you review/approve/merge/deploy this when you have some time?

bradam12 commented 6 months ago

I'd love to get this out soon. Is there anything else you need from me @kfcampbell?

kfcampbell commented 5 months ago

No, I'll get this released shortly. Thank you for your patience.