diff --git a/.changelog/6816.txt b/.changelog/6816.txt new file mode 100644 index 0000000000..9c659a7134 --- /dev/null +++ b/.changelog/6816.txt @@ -0,0 +1,3 @@ +```release-note:bug +cloudbuild: fixed the failure when BITBUCKET is provided for `repo_type` on `google_cloudbuild_trigger` +``` diff --git a/google/resource_cloudbuild_trigger.go b/google/resource_cloudbuild_trigger.go index 0473921654..f459c0f0a3 100644 --- a/google/resource_cloudbuild_trigger.go +++ b/google/resource_cloudbuild_trigger.go @@ -737,9 +737,9 @@ When using Pub/Sub, Webhook or Manual set the file name using git_file_source in "repo_type": { Type: schema.TypeString, Required: true, - ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}), + ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"}), Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL). -Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`, +Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"]`, }, "revision": { Type: schema.TypeString, @@ -960,9 +960,9 @@ One of 'trigger_template', 'github', 'pubsub_config' 'webhook_config' or 'source "repo_type": { Type: schema.TypeString, Required: true, - ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}), + ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"}), Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL). -Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`, +Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"]`, }, "uri": { Type: schema.TypeString, diff --git a/google/resource_cloudbuild_trigger_test.go b/google/resource_cloudbuild_trigger_test.go index 3db0c74f05..344280e384 100644 --- a/google/resource_cloudbuild_trigger_test.go +++ b/google/resource_cloudbuild_trigger_test.go @@ -209,6 +209,27 @@ func TestAccCloudBuildTrigger_fullStep(t *testing.T) { }) } +func TestAccCloudBuildTrigger_basic_bitbucket(t *testing.T) { + t.Parallel() + name := fmt.Sprintf("tf-test-%d", randInt(t)) + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccCloudBuildTrigger_basic_bitbucket(name), + }, + { + ResourceName: "google_cloudbuild_trigger.build_trigger", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccCloudBuildTrigger_basic(name string) string { return fmt.Sprintf(` resource "google_cloudbuild_trigger" "build_trigger" { @@ -266,6 +287,25 @@ resource "google_cloudbuild_trigger" "build_trigger" { `, name) } +func testAccCloudBuildTrigger_basic_bitbucket(name string) string { + return fmt.Sprintf(` +resource "google_cloudbuild_trigger" "build_trigger" { + name = "%s" + description = "acceptance test build trigger on bitbucket" + trigger_template { + branch_name = "main" + repo_name = "some-repo" + } + git_file_source { + path = "cloudbuild.yaml" + uri = "https://bitbucket.org/myorg/myrepo" + revision = "refs/heads/develop" + repo_type = "BITBUCKET_SERVER" + } +} +`, name) +} + func testAccCloudBuildTrigger_basicDisabled(name string) string { return fmt.Sprintf(` resource "google_cloudbuild_trigger" "build_trigger" { diff --git a/website/docs/r/cloudbuild_trigger.html.markdown b/website/docs/r/cloudbuild_trigger.html.markdown index 7a5aac87c6..47bf3289d5 100644 --- a/website/docs/r/cloudbuild_trigger.html.markdown +++ b/website/docs/r/cloudbuild_trigger.html.markdown @@ -501,8 +501,8 @@ The following arguments are supported: * `repo_type` - (Required) The type of the repo, since it may not be explicit from the repo field (e.g from a URL). - Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET - Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET`. + Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER + Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET_SERVER`. * `revision` - (Optional) @@ -523,8 +523,8 @@ The following arguments are supported: * `repo_type` - (Required) The type of the repo, since it may not be explicit from the repo field (e.g from a URL). - Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET - Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET`. + Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER + Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET_SERVER`. The `trigger_template` block supports: