From c1ea667f160000d9913034a7912f1d0672cf90e1 Mon Sep 17 00:00:00 2001 From: futuretea Date: Tue, 31 Jan 2023 20:15:32 +0800 Subject: [PATCH] Support sshkey from templatefile Signed-off-by: futuretea --- .../virtualmachine/resource_virtualmachine_validator.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/provider/virtualmachine/resource_virtualmachine_validator.go b/internal/provider/virtualmachine/resource_virtualmachine_validator.go index 49bc10f3..e3d88c85 100644 --- a/internal/provider/virtualmachine/resource_virtualmachine_validator.go +++ b/internal/provider/virtualmachine/resource_virtualmachine_validator.go @@ -94,7 +94,7 @@ Either remove unused ssh keys from "ssh_keys" or add ssh public keys to cloud-in return nil } -func inCloudConfig(parentKey, parent, key, value interface{}) bool { +func inCloudConfig(parentKey, parent, key interface{}, value string) bool { switch section := parent.(type) { case map[interface{}]interface{}: for k, v := range section { @@ -109,8 +109,10 @@ func inCloudConfig(parentKey, parent, key, value interface{}) bool { } } case interface{}: - if parentKey == key && section == value { - return true + if parentKey == key { + if sectionStr, ok := section.(string); ok && strings.TrimSpace(sectionStr) == strings.TrimSpace(value) { + return true + } } } return false