From 036b43eac17a642dd1a9a00ccf23ac98f0a8df73 Mon Sep 17 00:00:00 2001 From: Edward Sun Date: Thu, 5 Aug 2021 11:49:51 -0700 Subject: [PATCH] fixed diff in publishing_options --- mmv1/products/privateca/api.yaml | 2 + mmv1/products/privateca/terraform.yaml | 2 + .../tests/resource_privateca_ca_pool_test.go | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/mmv1/products/privateca/api.yaml b/mmv1/products/privateca/api.yaml index 6003227de9db..c1a3815b8c81 100644 --- a/mmv1/products/privateca/api.yaml +++ b/mmv1/products/privateca/api.yaml @@ -1517,6 +1517,7 @@ objects: - !ruby/object:Api::Type::Boolean name: 'publishCaCert' required: true + send_empty_value: true description: | When true, publishes each CertificateAuthority's CA certificate and includes its URL in the "Authority Information Access" X.509 extension in all issued Certificates. If this is false, the CA certificate will not be published and the corresponding @@ -1524,6 +1525,7 @@ objects: - !ruby/object:Api::Type::Boolean name: 'publishCrl' required: true + send_empty_value: true description: | When true, publishes each CertificateAuthority's CRL and includes its URL in the "CRL Distribution Points" X.509 extension in all issued Certificates. If this is false, CRLs will not be published and the corresponding X.509 extension will not 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) +}