Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed diff in publishing_options #9926

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}