jfrog/terraform-provider-artifactory

Allow creating a webhook 'build' only based on include/exclude patterns

Closed this issue · 1 comments

Describe the bug

When creating a Webhook with the domain build using Artifactory Create a New Webhook Subscription REST API, we are able to execute it with the parameters "anyBuild": false, "selectedBuilds": [] and only provide include/exclude patterns.

When creating a webhook with selected_builds empty, we get the following error:
image

Requirements for and issue

Terraform script:

terraform {
  required_providers {
    artifactory = {
      source  = "jfrog/artifactory"
      version = "10.0.2"
    }
  }
}

#Configure Artifactory
provider "artifactory" {
  url = "https://elinaf.jfrog.io/artifactory"
  access_token = "cmVmdGt...FpVHpq"
}

#Create custom webhook
resource "artifactory_build_custom_webhook" "build-custom-webhook" {
  key         = "create-terraform-webhook"
  event_types = ["promoted"]
  criteria {
    any_build         = false
    selected_builds   = []
    include_patterns  = ["foo/**"]
    exclude_patterns  = []
  }

  handler{
    url    = "https://webhook.site/a0e58f81-c91f-42bb-9e0b-18d155e017d0"
    secrets   = {
      secretName1 = "value1"
      secretName2 = "value2"
    }
    http_headers = {
        header-1 = "value-1"
        header-2 = "value-2"
    }
 }
}

Artifactory version: 7.87.3
Terraform version: 1.5.7

Expected behavior
selected_builds can be empty when any_build is false.

@NoffarLevi Thanks for the report! I've added this to our plan to fix.