@@ -128,9 +128,10 @@ func TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssu
128
128
129
129
random_suffix := acctest .RandString (t , 10 )
130
130
context := map [string ]interface {}{
131
- "root_location" : "us-central1" ,
132
- "sub_location" : "australia-southeast1" ,
133
- "random_suffix" : random_suffix ,
131
+ "root_location" : "us-central1" ,
132
+ "sub_location" : "australia-southeast1" ,
133
+ "random_suffix" : random_suffix ,
134
+ "first_label_value" : "bar" ,
134
135
}
135
136
136
137
resourceName := "google_privateca_certificate_authority.sub-1"
@@ -176,6 +177,47 @@ func TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssu
176
177
})
177
178
}
178
179
180
+ func TestAccPrivatecaCertificateAuthority_subordinateCaCanUpdateLabel (t * testing.T ) {
181
+ t .Parallel ()
182
+ acctest .SkipIfVcr (t )
183
+
184
+ random_suffix := acctest .RandString (t , 10 )
185
+ context1 := map [string ]interface {}{
186
+ "root_location" : "us-central1" ,
187
+ "sub_location" : "australia-southeast1" ,
188
+ "random_suffix" : random_suffix ,
189
+ "first_label_value" : "bar-1" ,
190
+ }
191
+
192
+ context2 := map [string ]interface {}{
193
+ "root_location" : "us-central1" ,
194
+ "sub_location" : "australia-southeast1" ,
195
+ "random_suffix" : random_suffix ,
196
+ "first_label_value" : "bar-2" ,
197
+ }
198
+
199
+ resourceName := "google_privateca_certificate_authority.sub-1"
200
+ acctest .VcrTest (t , resource.TestCase {
201
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
202
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
203
+ CheckDestroy : testAccCheckPrivatecaCertificateAuthorityDestroyProducer (t ),
204
+ Steps : []resource.TestStep {
205
+ {
206
+ Config : testAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateWithFirstPartyIssuer (context1 ),
207
+ Check : resource .ComposeTestCheckFunc (
208
+ resource .TestCheckResourceAttr (resourceName , "labels.first_label" , context1 ["first_label_value" ].(string )),
209
+ ),
210
+ },
211
+ {
212
+ Config : testAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateWithFirstPartyIssuer (context2 ),
213
+ Check : resource .ComposeTestCheckFunc (
214
+ resource .TestCheckResourceAttr (resourceName , "labels.first_label" , context2 ["first_label_value" ].(string )),
215
+ ),
216
+ },
217
+ },
218
+ })
219
+ }
220
+
179
221
func testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityBasicRoot (context map [string ]interface {}) string {
180
222
return acctest .Nprintf (`
181
223
resource "google_privateca_certificate_authority" "default" {
@@ -470,6 +512,10 @@ resource "google_privateca_certificate_authority" "sub-1" {
470
512
}
471
513
type = "SUBORDINATE"
472
514
515
+ labels = {
516
+ first_label = "%{first_label_value}"
517
+ }
518
+
473
519
// Disable CA deletion related safe checks for easier cleanup.
474
520
deletion_protection = false
475
521
skip_grace_period = true
0 commit comments