integrations / integrations/terraform-provider-github

[BUG]: github_actions_hosted_runner resource must be replaced after import

Open
#3,405 1 comment 2 reactions 1 assignee Claimed by @deiga View on GitHub
r/actions_hosted_runner Type: Bug
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Expected Behavior

`github_actions_hosted_runner` resources should be importable without requiring any destructive replacements.

### Actual Behavior

When importing `github_actions_hosted_runner` resources, the imported state does not include the `image` block. Since the resource treats this as an immutable field, this causes Terraform to plan a destroy + recreation of the hosted runner.

### Terraform Version

Terraform v1.15.2
on darwin_arm64
+ provider registry.terraform.io/integrations/github v6.12.1

### Affected Resource(s)

- github_actions_hosted_runner

### Terraform Configuration Files

```hcl
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6"
}
}
}

provider "github" {
owner = "my-example-org"
}

import {
to = github_actions_hosted_runner.my_example_runner
id = "1"
}

resource "github_actions_hosted_runner" "my_example_runner" {
image_gen = false
image_version = null
maximum_runners = 50
name = "my-example-runner"
public_ip_enabled = false
runner_group_id = 1
size = "2-core"
image {
id = "2306"
source = "github"
}
}
```

### Steps to Reproduce

1. In an enterprise organization, create a new GitHub-hosted runner in the **Default** runner group called `my-example-runner`. Use all the default values:
- Platform: `Linux x64`
- Size: `2-cores`
- Image name: `Ubuntu Latest (24.04)`
3. Retrieve the runner ID from the URL (e.g. `https://github.com/organizations/my-example-org/settings/actions/github-hosted-runners/1` -> `1`)
4. Import the resource using an `import` block
5. Run the Terraform plan:
```bash
terraform plan
```

**Result**: Terraform wants to replace the runner

```
Terraform will perform the following actions:

# github_actions_hosted_runner.my_example_runner must be replaced
# (imported from "1")
# Warning: this will destroy the imported resource
-/+ resource "github_actions_hosted_runner" "my_example_runner" {
~ id = "1" -> (known after apply)
image_gen = false
~ last_active_on = "2026-05-06T16:27:22.8271735Z" -> (known after apply)
~ machine_size_details = [
- {
- cpu_cores = 2
- id = "2-core"
- memory_gb = 8
- storage_gb = 75
},
] -> (known after apply)
maximum_runners = 50
name = "my-example-runner"
~ platform = "linux-x64" -> (known after apply)
public_ip_enabled = false
~ public_ips = [] -> (known after apply)
runner_group_id = 1
size = "2-core"
~ status = "Ready" -> (known after apply)

+ image { # forces replacement
+ id = "2306"
+ size_gb = (known after apply)
+ source = "github"
}
}

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

### Debug Output

```shell

```

### Panic Output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.