integrations / terraform-provider-github

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

[BUG]: github_organization_webhook resource creation fake-failure #2142

Closed gm-hyp-2 closed 5 months ago

gm-hyp-2 commented 7 months ago

Expected Behavior

When creating this resource:

resource "github_organization_webhook" "generic_webhook" {
  configuration {
    url          = "<hidden>"
    content_type = "json"
    insecure_ssl = false
    secret = var.gh_api_token
  }
  active = var.active_regions_api["us-west-2"]
  events = ["push", "pull_request" ]
}

This should create a new webhook, as described in the documentation: https://registry.terraform.io/providers/integrations/github/latest/docs/resources/organization_webhook#configuration

Actual Behavior

TF throws an error:

╷
│ Error: configuration.0.insecure_ssl: '' expected type 'bool', got unconvertible type 'string', value: '0'
│ 
│   with github_organization_webhook.generic_webhook,
│   on webhooks.tf line 1, in resource "github_organization_webhook" "generic_webhook":
│    1: resource "github_organization_webhook" "generic_webhook" {
│ 
╵

The problem is that we web hook actually gets created:

Screenshot 2024-02-12 at 11 03 20

So the next execution will delete and recreate the resource.

Additionally, the same resource type that was created with v5.x of the provider works just fine. The bug affects only the creation of a new webhook.

Terraform Version

Terraform 1.7.2 on linux_amd64 Affected versions: v6.0.0.0-rc2 (I have tested the creation of a new webhook only on this one)

Affected Resource(s)

github_organization_webhook

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

gm-hyp-2 commented 7 months ago

One additional comment - if I remove the key insecure_ssl and let the provider use the default, it still produces the same behavior.

kfcampbell commented 7 months ago

My guess is this is related to #2133 in which we're checking and returning an error that was previously ignored. This could be a good first issue for a new contributor to handle.