From f8b1d7322d6fecc2362feb52e609c221b9eff431 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Mon, 2 Oct 2023 11:10:59 +0200 Subject: [PATCH] Fix login credential type identifier parsing Values used for type identifier parsing were incorrect Signed-off-by: Kobi Samoray --- nsxt/resource_nsxt_compute_manager.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nsxt/resource_nsxt_compute_manager.go b/nsxt/resource_nsxt_compute_manager.go index d5fdebc83..9e68364e2 100644 --- a/nsxt/resource_nsxt_compute_manager.go +++ b/nsxt/resource_nsxt_compute_manager.go @@ -407,7 +407,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct credType := base.(model.LoginCredential).CredentialType switch credType { - case "saml_login": + case model.SamlTokenLoginCredential__TYPE_IDENTIFIER: entry, errs := converter.ConvertToGolang(credential, model.SamlTokenLoginCredentialBindingType()) if errs != nil { return errs[0] @@ -416,7 +416,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct elem["thumbprint"] = credEntry.Thumbprint elem["token"] = credEntry.Token - case "session_login": + case model.SessionLoginCredential__TYPE_IDENTIFIER: entry, errs := converter.ConvertToGolang(credential, model.SessionLoginCredentialBindingType()) if errs != nil { return errs[0] @@ -425,7 +425,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct elem["session_id"] = credEntry.SessionId elem["thumbprint"] = credEntry.Thumbprint - case "username_password_login": + case model.UsernamePasswordLoginCredential__TYPE_IDENTIFIER: entry, errs := converter.ConvertToGolang(credential, model.UsernamePasswordLoginCredentialBindingType()) if errs != nil { return errs[0] @@ -435,7 +435,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct elem["thumbprint"] = credEntry.Thumbprint elem["password"] = credEntry.Password - case "verifiable_asymmetric_login": + case model.VerifiableAsymmetricLoginCredential__TYPE_IDENTIFIER: entry, errs := converter.ConvertToGolang(credential, model.VerifiableAsymmetricLoginCredentialBindingType()) if errs != nil { return errs[0] @@ -449,7 +449,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct return errors.New("no valid credential found") } - d.Set("credential", elem) + d.Set("credential", []interface{}{elem}) return nil }