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

[FEAT]: github_enterprise_actions_runner_group / github_actions_runner_group - Support network configuration

Open audunsolemdal opened this issue 1 year ago • 2 comments

Describe the need

For the resources github_enterprise_actions_runner_group and github_actions_runner_group I would like support for configuring private networking via Terraform. This would help ease setup and maintenance of a great and cost efficient feature.


data "github_enterprise" "example" {
  slug = "example-co"
}

resource "azapi_resource" "subnet_integration" {
  type                      = "GitHub.Network/networkSettings@2024-04-02"
  name                      = "test-subnet-integration"
  location                  = module.vnet.vnet.location
  parent_id                 = module.vnet.rg.id
  schema_validation_enabled = false
  body = jsonencode({
    properties = {
      subnetId   = module.vnet.subnets["test-subnet"].id
      businessId = data.github_enterprise.example.database_id
    }
  })

  lifecycle {
    ignore_changes = [tags]
  }
}

resource "github_enterprise_actions_runner_group" "example" {
  name                       = "my-awesome-runner-group"
  enterprise_slug            = data.github_enterprise.enterprise.slug
  selected_organization_ids  = [github_enterprise_organization.enterprise_organization.database_id]
  
  # NEW
  network_configuration_id   = azapi_resource.subnet_integration.tags["GithubId"] # optional
  disable_network_configuration = false # optional. Only has an effect if network_configuration_id is set
}

resource "azapi_resource" "subnet_integration2" {
  type                      = "GitHub.Network/networkSettings@2024-04-02"
  name                      = "test-subnet-integration"
  location                  = module.vnet.vnet.location
  parent_id                 = module.vnet.rg.id
  schema_validation_enabled = false
  body = jsonencode({
    properties = {
      subnetId   = module.vnet.subnets["test-subnet2"].id
      businessId = data.github_enterprise.example.database_id
    }
  })

  lifecycle {
    ignore_changes = [tags]
  }
}


resource "github_actions_runner_group" "example" {
  name                    = "xxx"
  selected_repository_ids = ["yyy"]

  # NEW
  network_configuration_id   = azapi_resource.subnet_integration2.tags["GithubId"] # optional
  disable_network_configuration = false # optional. Only has an effect if network_configuration_id is set
}

Alternatively an optional block can be used to configue this

resource "github_actions_runner_group" "example" {
...
network_configuration {
  id   = azapi_resource.subnet_integration2.tags["GithubId"] # optional
  disable_configuration = false # optional, defaults to false
}
...
}

Enterprise:

  • https://docs.github.com/en/enterprise-cloud@latest/admin/configuring-settings/configuring-private-networking-for-hosted-compute-products/configuring-private-networking-for-github-hosted-runners-in-your-enterprise#1-add-a-new-network-configuration-for-your-enterprise

Github team:

  • https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#about-azure-private-networking-for-github-hosted-runners

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

audunsolemdal avatar Jun 28 '24 07:06 audunsolemdal

I wanted to give it a go at this one because I would like to automate this part but AFAIK there's no support for it in go-github. It seems like we can only create self-hosted runner but not a runner group that's GitHub hosted. Looking at the API it seems like to me this is not even exposed at the API level according to the documentation.

Am I missing something obvious?

ilmax avatar Jul 23 '24 08:07 ilmax

@kfcampbell / @nickfloyd FYI

ilmax avatar Jul 31 '24 08:07 ilmax

There does not seem to be any mention about support for this in the REST API in the GitHub Public Roadmap.

I urge anyone to vote and discuss on this community discussion to raise awareness about missing support in the REST API: https://github.com/orgs/community/discussions/139852

Laffs2k5 avatar Dec 11 '24 09:12 Laffs2k5

Looks like the APIs for this have just been released: https://github.com/orgs/community/discussions/149651

matt-buchanan avatar Jan 30 '25 13:01 matt-buchanan

Can't wait for this functionality to appear in the TF Provider ❤

CpuID avatar Apr 30 '25 22:04 CpuID