integrations / terraform-provider-github

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

[BUG]: `github_actions_runner_group` return error. #2162

Closed WilliamB17 closed 5 months ago

WilliamB17 commented 6 months ago

Expected Behavior

Normally, the way I use the resource, I should be able to create group runners without any errors.

resource "github_actions_runner_group" "runner_group" {
  for_each = local.runners

  name       = each.key
  visibility = "private"
}

Actual Behavior

When the resource is used, it returns an error, but the resource has been created.

github_actions_runner_group.runner_group["infrastructure"]: Creating...
│ Error: Invalid address to set: []string{"id"}
│ 
│   with github_actions_runner_group.runner_group["infrastructure"],
│   on main.tf line 22, in resource "github_actions_runner_group" "runner_group":
│   22: resource "github_actions_runner_group" "runner_group" {
│ 

Terraform Version

Terraform v1.7.3 on darwin_arm64

github = {
      source  = "integrations/github"
      version = "6.0.0"
 }

Affected Resource(s)

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

j-nix commented 6 months ago

Can confirm I'm experiencing the same issue with 6.0.0, if I revert back to 5.45.0 there are no issues.

david-heward-unmind commented 6 months ago

Also the same here.

andreas-aman commented 6 months ago

Have the same issue but already when running terraform plan

$ terraform plan
github_actions_runner_group.this: Refreshing state... [id=8]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Invalid address to set: []string{"id"}
│
│   with github_actions_runner_group.this,
│   on main.tf line 1, in resource "github_actions_runner_group" "this":
│    1: resource "github_actions_runner_group" "this" {
│

I assume it's the same underlying issue.

laughedelic commented 6 months ago

I have the same issue trying to import a group:

import {
  to = github_actions_runner_group.test
  id = "5"
}

(Terrafrom 1.7.4, provider 6.0.0)

I tried adding the target resource or using terraform plan -generate-config-out=gen.tf. Either way it fails with the cryptic

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Invalid address to set: []string{"id"}

In my case it doesn't even point to the problematic resource/block.

oliverwiegers commented 6 months ago

+1

ohookins commented 6 months ago

Same error here.

kfcampbell commented 6 months ago

My guess is that's related to us checking the result of this call to d.Set("id". PRs are appreciated!

chrheg commented 6 months ago

+1

kfcampbell commented 6 months ago

The naive, quick thing to do would be to replace

    if err = d.Set("id", runnerGroup.GetID()); err != nil {
        return err
    }

with

    _ = d.Set("id", runnerGroup.GetID())

but I don't love that. The better thing to do would be to debug the provider to figure out why the Set is erroring.

ViacheslavKudinov commented 5 months ago

Same on v6.2.0