From f276ceafa8f4b29bf33cc8e0cd4970072ec5d8bc Mon Sep 17 00:00:00 2001 From: Edward Sun <42220489+edwardmedia@users.noreply.github.com> Date: Thu, 26 Aug 2021 16:51:25 -0700 Subject: [PATCH] fixed diff in publishing_options (#5045) * fixed diff in publishing_options * Update api.yaml --- mmv1/products/privateca/terraform.yaml | 2 + .../tests/resource_privateca_ca_pool_test.go | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/mmv1/products/privateca/terraform.yaml b/mmv1/products/privateca/terraform.yaml index 1bb8e9baec43..b398ad713dc7 100644 --- a/mmv1/products/privateca/terraform.yaml +++ b/mmv1/products/privateca/terraform.yaml @@ -134,6 +134,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides custom_flatten: 'templates/terraform/custom_flatten/privateca_certificate_509_config.go.erb' issuancePolicy.baselineValues.caOptions.maxIssuerPathLength: !ruby/object:Overrides::Terraform::PropertyOverride send_empty_value: true + publishingOptions: !ruby/object:Overrides::Terraform::PropertyOverride + diff_suppress_func: 'emptyOrUnsetBlockDiffSuppress' iam_policy: !ruby/object:Api::Resource::IamPolicy allowed_iam_role: 'roles/privateca.certificateManager' method_name_separator: ':' diff --git a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go index 4364ef2aebfa..3a08a20b2ff3 100644 --- a/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go +++ b/mmv1/third_party/terraform/tests/resource_privateca_ca_pool_test.go @@ -276,3 +276,45 @@ resource "google_privateca_ca_pool" "default" { } `, context) } + +func TestAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckPrivatecaCaPoolDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(context), + }, + { + ResourceName: "google_privateca_ca_pool.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "location"}, + }, + }, + }) +} + +func testAccPrivatecaCaPool_privatecaCapoolEmptyPublishingOptions(context map[string]interface{}) string { + return Nprintf(` +resource "google_privateca_ca_pool" "default" { + name = "tf-test-my-capool%{random_suffix}" + location = "us-central1" + tier = "ENTERPRISE" + publishing_options { + publish_ca_cert = false + publish_crl = false + } + labels = { + foo = "bar" + } +} +`, context) +}