Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_actions_organization_secret problem to manage more than 30 selected_repository_ids #793

Closed
kantipov opened this issue May 18, 2021 · 2 comments
Labels
r/actions_secret Type: Bug Something isn't working as documented

Comments

@kantipov
Copy link

Terraform Version

Terraform v0.15.3 on linux_amd64

  • provider registry.terraform.io/integrations/github v4.9.4

Affected Resource(s)

  • github_actions_organization_secret

Terraform Configuration Files

resource "github_actions_organization_secret" "organization_secret" {
  for_each                = var.ci_secrets
  secret_name             = each.key
  plaintext_value         = each.value
  visibility              = "selected"
  selected_repository_ids = local.repo_ci_id
}

Expected Behavior

The second run of the terraform apply command should return "Infrastructure is up to date".

Actual Behavior

Important moment - our local.repo_ci_id contains 38 elements (I've checked with 30 elements - the issue doesn't appear).
There are no errors and everything is created correctly on the github after initial terraform apply.
But if I change nothing and run terraform apply again - terraform says:

  # github_actions_organization_secret.organization_secret["GH_PACKAGES_READ"] will be updated in-place
  ~ resource "github_actions_organization_secret" "organization_secret" {
        id                      = "GH_PACKAGES_READ"
      ~ selected_repository_ids = [
          + 152713862,
          + 153690132,
          + 172287326,
          + 183595907,
          + 187405088,
          + 227825871,
          + 230234231,
          + 247816281,
            # (30 unchanged elements hidden)
        ]
        # (5 unchanged attributes hidden)
    }

And, if I answer "yes" - I'll get this error:

Error: Provider produced inconsistent result after apply

When applying changes to github_actions_organization_secret.organization_secret["GH_PACKAGES_READ"], provider
"provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

After that everything is still correct on the github, but in the terraform.state there are only 30 id in github_actions_organization_secret.selected_repository_ids.
And, if I run terraform apply again - it will "create" the secret without error. The circle is closed.

Steps to Reproduce

  1. Create at least 31 github repository
  2. Create github_actions_organization_secret with visibility = "selected" and selected_repository_ids from 1.
  3. Run terraform apply
  4. Run terraform apply
@nadenf
Copy link
Contributor

nadenf commented Jun 5, 2021

Looked into this. Blocked on go-github fixing #1882 and then it can be fixed in this provider.

@gmlewis
Copy link

gmlewis commented Jun 5, 2021

I apologize for the omission. Code reviews and approval welcome at: google/go-github#1883 in order to move this along.

xun-guo-anzx added a commit to xun-guo-anzx/terraform-provider-github that referenced this issue Jun 30, 2021
@jcudit jcudit closed this as completed in f85e6c8 Jul 12, 2021
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this issue Jul 26, 2022
* Update go-github version to 36.0.0

* Update go-github to 36.0.0

go-github released the Go client library to [36.0.0][1] 3 days ago.

API changes includes:
* Add ListOptions required by ListSelectedReposForOrgSecret method. As described in change[2]
* Convert repoID used in CreateOrUpdateEnvSecret, GetEnvSecret and DeleteEnvSecret to int from int64. Not sure why it doesn't pop up an error before but seems like this is not a recent change in the new version

[1]: https:/google/go-github/releases/tag/v36.0.0
[2]: google/go-github#1883

* Fetch full list of selected repos in github_actions_organization_secret

Fix integrations#793
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r/actions_secret Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

4 participants