Skip to content

Commit

Permalink
fixed diff in publishing_options (#5045) (#9926)
Browse files Browse the repository at this point in the history
* fixed diff in publishing_options

* Update api.yaml

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 27, 2021
1 parent 2154b77 commit bfb0353
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/5045.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
privateca: fixed a permadiff bug for `publishing_options` on `google_privateca_ca_pool` when both attributes set false
```
9 changes: 5 additions & 4 deletions google/resource_privateca_ca_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,11 @@ An object containing a list of "key": value pairs. Example: { "name": "wrench",
Elem: &schema.Schema{Type: schema.TypeString},
},
"publishing_options": {
Type: schema.TypeList,
Optional: true,
Description: `The PublishingOptions to follow when issuing Certificates from any CertificateAuthority in this CaPool.`,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
DiffSuppressFunc: emptyOrUnsetBlockDiffSuppress,
Description: `The PublishingOptions to follow when issuing Certificates from any CertificateAuthority in this CaPool.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"publish_ca_cert": {
Expand Down
42 changes: 42 additions & 0 deletions google/resource_privateca_ca_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit bfb0353

Please sign in to comment.