@@ -46,6 +46,7 @@ func TestAccKerberosAuthBackendConfig_basic(t *testing.T) {
4646 ImportStateId : fmt .Sprintf ("auth/%s/config" , path ),
4747 ImportStateVerify : true ,
4848 ImportStateVerifyIdentifierAttribute : consts .FieldMount ,
49+ ImportStateVerifyIgnore : []string {consts .FieldKeytabWOVersion },
4950 },
5051 },
5152 })
@@ -87,6 +88,7 @@ func TestAccKerberosAuthBackendConfig_update(t *testing.T) {
8788 ImportStateId : fmt .Sprintf ("auth/%s/config" , path ),
8889 ImportStateVerify : true ,
8990 ImportStateVerifyIdentifierAttribute : consts .FieldMount ,
91+ ImportStateVerifyIgnore : []string {consts .FieldKeytabWOVersion },
9092 },
9193 },
9294 })
@@ -131,28 +133,6 @@ func TestAccKerberosAuthBackendConfig_updateAndReplacement(t *testing.T) {
131133 })
132134}
133135
134- // TestAccKerberosAuthBackendConfig_defaultCheck tests to check default values
135- func TestAccKerberosAuthBackendConfig_defaultCheck (t * testing.T ) {
136- serviceAccount := "vault/localhost@EXAMPLE.COM"
137-
138- resource .Test (t , resource.TestCase {
139- PreCheck : func () { acctestutil .TestAccPreCheck (t ) },
140- ProtoV5ProviderFactories : providertest .ProtoV5ProviderFactories ,
141- Steps : []resource.TestStep {
142- {
143- Config : testAccKerberosAuthBackendConfigConfig_defaultValues (serviceAccount ),
144- Check : resource .ComposeTestCheckFunc (
145- resource .TestCheckResourceAttr ("vault_kerberos_auth_backend_config.config" , consts .FieldMount , "kerberos" ),
146- resource .TestCheckResourceAttr ("vault_kerberos_auth_backend_config.config" , consts .FieldServiceAccount , serviceAccount ),
147- resource .TestCheckNoResourceAttr ("vault_kerberos_auth_backend_config.config" , consts .FieldKeytabWO ),
148- resource .TestCheckNoResourceAttr ("vault_kerberos_auth_backend_config.config" , consts .FieldRemoveInstanceName ),
149- resource .TestCheckNoResourceAttr ("vault_kerberos_auth_backend_config.config" , consts .FieldAddGroupAliases ),
150- ),
151- },
152- },
153- })
154- }
155-
156136// TestAccKerberosAuthBackendConfig_validationErrors tests various validation errors
157137func TestAccKerberosAuthBackendConfig_validationErrors (t * testing.T ) {
158138 path := acctest .RandomWithPrefix ("kerberos" )
@@ -162,16 +142,6 @@ func TestAccKerberosAuthBackendConfig_validationErrors(t *testing.T) {
162142 PreCheck : func () { acctestutil .TestAccPreCheck (t ) },
163143 ProtoV5ProviderFactories : providertest .ProtoV5ProviderFactories ,
164144 Steps : []resource.TestStep {
165- // Test missing keytab
166- {
167- Config : testAccKerberosAuthBackendConfigConfig_missingKeytab (path , serviceAccount ),
168- ExpectError : regexp .MustCompile (`(attribute|argument) "keytab_wo" is required` ),
169- },
170- // Test missing service account
171- {
172- Config : testAccKerberosAuthBackendConfigConfig_missingServiceAccount (path ),
173- ExpectError : regexp .MustCompile (`(attribute|argument) "service_account" is required` ),
174- },
175145 // Test empty service account - empty string passes Terraform validation but fails at Vault API
176146 {
177147 Config : testAccKerberosAuthBackendConfigConfig_emptyServiceAccount (path ),
@@ -269,6 +239,7 @@ func TestAccKerberosAuthBackendConfig_namespace(t *testing.T) {
269239 ImportStateId : fmt .Sprintf ("auth/%s/config" , path ),
270240 ImportStateVerify : true ,
271241 ImportStateVerifyIdentifierAttribute : consts .FieldMount ,
242+ ImportStateVerifyIgnore : []string {consts .FieldKeytabWOVersion },
272243 },
273244 {
274245 // Cleanup step needed for the import step above
@@ -282,36 +253,6 @@ func TestAccKerberosAuthBackendConfig_namespace(t *testing.T) {
282253 })
283254}
284255
285- // Configuration templates for negative tests
286-
287- func testAccKerberosAuthBackendConfigConfig_missingKeytab (path , serviceAccount string ) string {
288- return fmt .Sprintf (`
289- resource "vault_auth_backend" "kerberos" {
290- type = "kerberos"
291- path = %q
292- }
293-
294- resource "vault_kerberos_auth_backend_config" "config" {
295- mount = vault_auth_backend.kerberos.path
296- service_account = %q
297- }
298- ` , path , serviceAccount )
299- }
300-
301- func testAccKerberosAuthBackendConfigConfig_missingServiceAccount (path string ) string {
302- return fmt .Sprintf (`
303- resource "vault_auth_backend" "kerberos" {
304- type = "kerberos"
305- path = %q
306- }
307-
308- resource "vault_kerberos_auth_backend_config" "config" {
309- mount = vault_auth_backend.kerberos.path
310- keytab_wo = %q
311- }
312- ` , path , testKeytab )
313- }
314-
315256func testAccKerberosAuthBackendConfigConfig_emptyServiceAccount (path string ) string {
316257 return fmt .Sprintf (`
317258resource "vault_auth_backend" "kerberos" {
@@ -320,9 +261,10 @@ resource "vault_auth_backend" "kerberos" {
320261}
321262
322263resource "vault_kerberos_auth_backend_config" "config" {
323- mount = vault_auth_backend.kerberos.path
324- keytab_wo = %q
325- service_account = ""
264+ mount = vault_auth_backend.kerberos.path
265+ keytab_wo = %q
266+ keytab_wo_version = 1
267+ service_account = ""
326268}
327269` , path , testKeytab )
328270}
@@ -335,9 +277,10 @@ resource "vault_auth_backend" "kerberos" {
335277}
336278
337279resource "vault_kerberos_auth_backend_config" "config" {
338- mount = vault_auth_backend.kerberos.path
339- keytab_wo = ""
340- service_account = %q
280+ mount = vault_auth_backend.kerberos.path
281+ keytab_wo = ""
282+ keytab_wo_version = 1
283+ service_account = %q
341284}
342285` , path , serviceAccount )
343286}
@@ -352,9 +295,10 @@ resource "vault_auth_backend" "kerberos" {
352295}
353296
354297resource "vault_kerberos_auth_backend_config" "config" {
355- mount = vault_auth_backend.kerberos.path
356- keytab_wo = %q
357- service_account = %q
298+ mount = vault_auth_backend.kerberos.path
299+ keytab_wo = %q
300+ keytab_wo_version = 1
301+ service_account = %q
358302}
359303` , path , testKeytab , serviceAccount )
360304}
@@ -369,6 +313,7 @@ resource "vault_auth_backend" "kerberos" {
369313resource "vault_kerberos_auth_backend_config" "config" {
370314 mount = vault_auth_backend.kerberos.path
371315 keytab_wo = %q
316+ keytab_wo_version = 1
372317 service_account = %q
373318 remove_instance_name = %t
374319 add_group_aliases = %t
@@ -384,27 +329,14 @@ resource "vault_auth_backend" "kerberos" {
384329}
385330
386331resource "vault_kerberos_auth_backend_config" "config" {
387- mount = vault_auth_backend.kerberos.path
388- keytab_wo = %q
389- service_account = %q
332+ mount = vault_auth_backend.kerberos.path
333+ keytab_wo = %q
334+ keytab_wo_version = 2
335+ service_account = %q
390336}
391337` , path , keytab , serviceAccount )
392338}
393339
394- func testAccKerberosAuthBackendConfigConfig_defaultValues (serviceAccount string ) string {
395- return fmt .Sprintf (`
396- resource "vault_auth_backend" "kerberos" {
397- type = "kerberos"
398- }
399-
400- resource "vault_kerberos_auth_backend_config" "config" {
401- mount = vault_auth_backend.kerberos.path
402- keytab_wo = %q
403- service_account = %q
404- }
405- ` , testKeytab , serviceAccount )
406- }
407-
408340func testAccKerberosAuthBackendConfigConfig_namespace (namespace , path , serviceAccount string ) string {
409341 return fmt .Sprintf (`
410342resource "vault_namespace" "test" {
@@ -418,10 +350,11 @@ resource "vault_auth_backend" "kerberos" {
418350}
419351
420352resource "vault_kerberos_auth_backend_config" "config" {
421- namespace = vault_namespace.test.path
422- mount = vault_auth_backend.kerberos.path
423- keytab_wo = %q
424- service_account = %q
353+ namespace = vault_namespace.test.path
354+ mount = vault_auth_backend.kerberos.path
355+ keytab_wo = %q
356+ keytab_wo_version = 1
357+ service_account = %q
425358}
426359` , namespace , path , testKeytab , serviceAccount )
427360}
0 commit comments