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

feat: add `github_enterprise_actions_runner_group`

Open bradam12 opened this issue 1 year ago • 0 comments

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 = "[email protected]"
  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

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [x] 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
  • [x] No

bradam12 avatar Feb 18 '24 16:02 bradam12