Skip to content

Fix resourceGithubDependabotOrganizationSecretCreateOrUpdate#1759

Merged
kfcampbell merged 1 commit intointegrations:mainfrom
OpenSourceProjects:fix-regression
Jun 27, 2023
Merged

Fix resourceGithubDependabotOrganizationSecretCreateOrUpdate#1759
kfcampbell merged 1 commit intointegrations:mainfrom
OpenSourceProjects:fix-regression

Conversation

@frankywahl
Copy link
Copy Markdown
Contributor

@frankywahl frankywahl commented Jun 27, 2023

Fixes a regression used when trying to create/update a dependabot organization secret. List is an int so cannot be cast to a different type. We therefore double convert it.

There was a regression introduced by version 5.27. This happened as the go-github client moved over to using int64 as ids in v53.0.0

terraform {
  required_providers {
    github = {
      source = "integrations/github"
      version = "5.27.0"
    }
  }
}

provider "github" {
  owner = var.owner
}

variable "owner" {
  type = string
}

resource "github_repository" "example" {
  name        = "example"
  description = "My awesome codebase"
  visibility = "public"
}

resource "github_dependabot_organization_secret" "example" {
  secret_name     = "example"
  visibility      = "selected"
  plaintext_value = "anything"
  selected_repository_ids = [
    github_repository.example.repo_id,
  ]
}

Resolves #1746

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

It should fix an issue after the provider get upgraded.

  • No

Notes:

Comment thread github/resource_github_dependabot_organization_secret.go
Fixes a regression used when trying to create/update a dependabot
organization secret. List is an `int` so cannot be cast to a different
type. We therefore double convert it.

There was a regression introduced by version 5.27. This
happened as the go-github client moved over to using int64 as ids in
v53.0.0

```hcl
terraform {
  required_providers {
    github = {
      source = "integrations/github"
      version = "5.27.0"
    }
  }
}

provider "github" {
  owner = var.owner
}

variable "owner" {
  type = string
}

resource "github_repository" "example" {
  name        = "example"
  description = "My awesome codebase"
  visibility = "public"
}

resource "github_dependabot_organization_secret" "example" {
  secret_name     = "example"
  visibility      = "selected"
  plaintext_value = "anything"
  selected_repository_ids = [
    github_repository.example.repo_id,
  ]
}
```
@frankywahl frankywahl marked this pull request as ready for review June 27, 2023 14:32
Copy link
Copy Markdown
Contributor

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kfcampbell kfcampbell merged commit db1c41c into integrations:main Jun 27, 2023
@frankywahl frankywahl deleted the fix-regression branch June 27, 2023 20:34
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
…rations#1759)

Fixes a regression used when trying to create/update a dependabot
organization secret. List is an `int` so cannot be cast to a different
type. We therefore double convert it.

There was a regression introduced by version 5.27. This
happened as the go-github client moved over to using int64 as ids in
v53.0.0

```hcl
terraform {
  required_providers {
    github = {
      source = "integrations/github"
      version = "5.27.0"
    }
  }
}

provider "github" {
  owner = var.owner
}

variable "owner" {
  type = string
}

resource "github_repository" "example" {
  name        = "example"
  description = "My awesome codebase"
  visibility = "public"
}

resource "github_dependabot_organization_secret" "example" {
  secret_name     = "example"
  visibility      = "selected"
  plaintext_value = "anything"
  selected_repository_ids = [
    github_repository.example.repo_id,
  ]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Regression with Dependabot Organization secret since v5.27.0

2 participants