From 256a7908f07241e4cbb72a552c22ed15cb2bbf33 Mon Sep 17 00:00:00 2001 From: Mario Machado Date: Mon, 6 Feb 2023 12:10:38 -0500 Subject: [PATCH 1/2] Adds enterprise_config_resource_name field to cloudbuild trigger resource in order to support github enterprise triggers --- mmv1/products/cloudbuild/api.yaml | 5 +++++ mmv1/products/cloudbuild/terraform.yaml | 4 ++++ .../cloudbuild_trigger_github_enterprise.tf.erb | 15 +++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb diff --git a/mmv1/products/cloudbuild/api.yaml b/mmv1/products/cloudbuild/api.yaml index 9d261c96c261..c2b92452134a 100644 --- a/mmv1/products/cloudbuild/api.yaml +++ b/mmv1/products/cloudbuild/api.yaml @@ -443,6 +443,11 @@ objects: exactly_one_of: - github.0.push.0.branch - github.0.push.0.tag + - !ruby/object:Api::Type::String + name: 'enterpriseConfigResourceName' + description: | + The resource name of the github enterprise config that should be applied to this installation. + For example: "projects/{$projectId}/locations/{$locationId}/githubEnterpriseConfigs/{$configId}" - !ruby/object:Api::Type::NestedObject name: "bitbucketServerTriggerConfig" description: | diff --git a/mmv1/products/cloudbuild/terraform.yaml b/mmv1/products/cloudbuild/terraform.yaml index e9c35e7fbdd2..6374465b7721 100644 --- a/mmv1/products/cloudbuild/terraform.yaml +++ b/mmv1/products/cloudbuild/terraform.yaml @@ -71,6 +71,10 @@ overrides: !ruby/object:Overrides::ResourceOverrides - !ruby/object:Provider::Terraform::Examples name: "cloudbuild_trigger_bitbucket_server_pull_request" primary_resource_id: "bbs-pull-request-trigger" + - !ruby/object:Provider::Terraform::Examples + name: "cloudbuild_trigger_github_enterprise" + primary_resource_id: "ghe-trigger" + skip_test: true properties: id: !ruby/object:Overrides::Terraform::PropertyOverride diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb new file mode 100644 index 000000000000..8215812ecbb9 --- /dev/null +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb @@ -0,0 +1,15 @@ +resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { + name = "terraform-ghe-trigger" + location = "us-central1" + + github { + owner = "hashicorp" + name = "terraform-provider-google" + push { + branch = "^main$" + } + enterprise_config_resource_name = "projects/123456789/locations/us-central1/githubEnterpriseConfigs/configID" + } + + filename = "cloudbuild.yaml" +} \ No newline at end of file From 4f3e927a702dc43a1e959e5eb35142bfb728014a Mon Sep 17 00:00:00 2001 From: Mario Machado Date: Mon, 13 Feb 2023 14:02:02 -0500 Subject: [PATCH 2/2] Fix newline at EOF --- .../examples/cloudbuild_trigger_github_enterprise.tf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb index 8215812ecbb9..dd69e7caa0bc 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.erb @@ -12,4 +12,4 @@ resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { } filename = "cloudbuild.yaml" -} \ No newline at end of file +}