From b21ab2e7583ccefde339b1d824c2a64ebc016a41 Mon Sep 17 00:00:00 2001 From: Dustin Strobel Date: Mon, 6 May 2024 20:02:19 +0200 Subject: [PATCH] refactor: to gowindows v1.0.1 --- go.mod | 20 +-- go.sum | 45 +++--- .../provider/local/local_group_data_source.go | 6 +- .../local/local_group_member_resource.go | 14 +- .../provider/local/local_group_resource.go | 14 +- .../local/local_groups_data_source.go | 2 +- .../provider/local/local_user_data_source.go | 6 +- .../provider/local/local_user_resource.go | 16 +-- .../provider/local/local_users_data_source.go | 2 +- internal/provider/provider.go | 132 ++++++++---------- internal/provider/validate.go | 24 ---- 11 files changed, 126 insertions(+), 155 deletions(-) diff --git a/go.mod b/go.mod index 21c24d2..dbcba25 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module terraform-provider-windows -go 1.21 +go 1.22 -toolchain go1.21.1 +toolchain go1.22.0 require ( - github.com/d-strobel/gowindows v0.0.0-20240105224217-566c4d2dcc50 + github.com/d-strobel/gowindows v1.0.1 github.com/hashicorp/terraform-plugin-docs v0.17.0 github.com/hashicorp/terraform-plugin-framework v1.5.0 github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 @@ -27,7 +27,6 @@ require ( github.com/bodgit/ntlmssp v0.0.0-20231122144230-2b2bca29f22b // indirect github.com/bodgit/windows v1.0.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/d-strobel/winrm v1.0.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/gofrs/uuid v4.4.0+incompatible // indirect @@ -49,7 +48,7 @@ require ( github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect - github.com/huandu/xstrings v1.3.3 // indirect + github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.15 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect @@ -58,6 +57,7 @@ require ( github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect + github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect @@ -75,14 +75,14 @@ require ( github.com/yuin/goldmark v1.6.0 // indirect github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.14.1 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/grpc v1.60.0 // indirect google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 058b521..eae759a 100644 --- a/go.sum +++ b/go.sum @@ -34,10 +34,8 @@ github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vc github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/d-strobel/gowindows v0.0.0-20240105224217-566c4d2dcc50 h1:3j7moxfRVmEWlmKCErzrPrExQpHwOo6gZANcraNTAtA= -github.com/d-strobel/gowindows v0.0.0-20240105224217-566c4d2dcc50/go.mod h1:jwYJOku/gGM7U/KE7imA3n9SJBNPoFv398qtJSpj1Rc= -github.com/d-strobel/winrm v1.0.0 h1:QJOMMaRRJ49VRAWrCQCUVE3lA/ANi80IS5QttC7murU= -github.com/d-strobel/winrm v1.0.0/go.mod h1:9ZZwC8e70eKRZeD0Y7lC5RRscFbZ9ewwDUZJ1S/HMGI= +github.com/d-strobel/gowindows v1.0.1 h1:VcmQH4HA507T5BPdFQwRvHIkUVDSRGO1UebSy2fXWog= +github.com/d-strobel/gowindows v1.0.1/go.mod h1:cssWAaTQlW99zi2m8i/RIZM6RM7sl1wNbWop8uUk3Vk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -120,8 +118,9 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= +github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= @@ -149,6 +148,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77 h1:psY7rHKhnfqjTEgkleIYpF1vVxVfYsUYFTO/cL5Z6xM= +github.com/masterzen/winrm v0.0.0-20231227165926-e811dad5ac77/go.mod h1:otHfftEJdo9JWGoq9GcJRaeNLp/uhqNq8JOk5lL+8Ks= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -192,8 +193,9 @@ github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -201,8 +203,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/transform v0.0.0-20201103190739-32f242e2dbde h1:AMNpJRc7P+GTwVbl8DkK2I9I8BBUzNiHuH/tlxrpan0= github.com/tidwall/transform v0.0.0-20201103190739-32f242e2dbde/go.mod h1:MvrEmduDUz4ST5pGZ7CABCnOU5f3ZiOAZzT6b1A6nX8= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= @@ -224,8 +226,8 @@ golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -240,8 +242,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -260,29 +262,29 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= @@ -299,8 +301,9 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/provider/local/local_group_data_source.go b/internal/provider/local/local_group_data_source.go index 9c9db21..a589fc3 100644 --- a/internal/provider/local/local_group_data_source.go +++ b/internal/provider/local/local_group_data_source.go @@ -6,7 +6,7 @@ import ( "terraform-provider-windows/internal/generate/datasource_local_group" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/windows/local" + "github.com/d-strobel/gowindows/windows/local/accounts" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -60,12 +60,12 @@ func (d *localGroupDataSource) Read(ctx context.Context, req datasource.ReadRequ } // Read API call logic - params := local.GroupReadParams{ + params := accounts.GroupReadParams{ Name: data.Name.ValueString(), SID: data.Sid.ValueString(), } - winResp, err := d.client.Local.GroupRead(ctx, params) + winResp, err := d.client.LocalAccounts.GroupRead(ctx, params) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local security group, got error: %s", err)) return diff --git a/internal/provider/local/local_group_member_resource.go b/internal/provider/local/local_group_member_resource.go index f53817f..51a9e34 100644 --- a/internal/provider/local/local_group_member_resource.go +++ b/internal/provider/local/local_group_member_resource.go @@ -6,7 +6,7 @@ import ( "terraform-provider-windows/internal/generate/resource_local_group_member" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/windows/local" + "github.com/d-strobel/gowindows/windows/local/accounts" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -58,12 +58,12 @@ func (r *localGroupMemberResource) Create(ctx context.Context, req resource.Crea } // Create API call logic - params := local.GroupMemberCreateParams{ + params := accounts.GroupMemberCreateParams{ SID: data.GroupId.ValueString(), Member: data.MemberId.ValueString(), } - if err := r.client.Local.GroupMemberCreate(ctx, params); err != nil { + if err := r.client.LocalAccounts.GroupMemberCreate(ctx, params); err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create local group member, got error: %s", err)) return } @@ -86,12 +86,12 @@ func (r *localGroupMemberResource) Read(ctx context.Context, req resource.ReadRe } // Read API call logic - params := local.GroupMemberReadParams{ + params := accounts.GroupMemberReadParams{ SID: data.GroupId.ValueString(), Member: data.MemberId.ValueString(), } - if _, err := r.client.Local.GroupMemberRead(ctx, params); err != nil { + if _, err := r.client.LocalAccounts.GroupMemberRead(ctx, params); err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete local group member, got error: %s", err)) return } @@ -115,12 +115,12 @@ func (r *localGroupMemberResource) Delete(ctx context.Context, req resource.Dele } // Delete API call logic - params := local.GroupMemberDeleteParams{ + params := accounts.GroupMemberDeleteParams{ SID: data.GroupId.ValueString(), Member: data.MemberId.ValueString(), } - if err := r.client.Local.GroupMemberDelete(ctx, params); err != nil { + if err := r.client.LocalAccounts.GroupMemberDelete(ctx, params); err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete local group member, got error: %s", err)) return } diff --git a/internal/provider/local/local_group_resource.go b/internal/provider/local/local_group_resource.go index ab70cf3..10a04a5 100644 --- a/internal/provider/local/local_group_resource.go +++ b/internal/provider/local/local_group_resource.go @@ -6,7 +6,7 @@ import ( "terraform-provider-windows/internal/generate/resource_local_group" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/windows/local" + "github.com/d-strobel/gowindows/windows/local/accounts" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" @@ -63,12 +63,12 @@ func (r *localGroupResource) Create(ctx context.Context, req resource.CreateRequ } // Create API call logic - params := local.GroupCreateParams{ + params := accounts.GroupCreateParams{ Name: data.Name.ValueString(), Description: data.Description.ValueString(), } - winResp, err := r.client.Local.GroupCreate(ctx, params) + winResp, err := r.client.LocalAccounts.GroupCreate(ctx, params) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create local security group, got error: %s", err)) return @@ -95,7 +95,7 @@ func (r *localGroupResource) Read(ctx context.Context, req resource.ReadRequest, } // Read API call logic - winResp, err := r.client.Local.GroupRead(ctx, local.GroupReadParams{SID: data.Id.ValueString()}) + winResp, err := r.client.LocalAccounts.GroupRead(ctx, accounts.GroupReadParams{SID: data.Id.ValueString()}) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local security group, got error: %s", err)) return @@ -121,12 +121,12 @@ func (r *localGroupResource) Update(ctx context.Context, req resource.UpdateRequ } // Update API call logic - params := local.GroupUpdateParams{ + params := accounts.GroupUpdateParams{ SID: data.Sid.ValueString(), Description: data.Description.ValueString(), } - err := r.client.Local.GroupUpdate(ctx, params) + err := r.client.LocalAccounts.GroupUpdate(ctx, params) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to update local security group, got error: %s", err)) return @@ -147,7 +147,7 @@ func (r *localGroupResource) Delete(ctx context.Context, req resource.DeleteRequ } // Delete API call logic - err := r.client.Local.GroupDelete(ctx, local.GroupDeleteParams{SID: data.Sid.ValueString()}) + err := r.client.LocalAccounts.GroupDelete(ctx, accounts.GroupDeleteParams{SID: data.Sid.ValueString()}) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete local security group, got error: %s", err)) return diff --git a/internal/provider/local/local_groups_data_source.go b/internal/provider/local/local_groups_data_source.go index 0e70d80..f8ef828 100644 --- a/internal/provider/local/local_groups_data_source.go +++ b/internal/provider/local/local_groups_data_source.go @@ -57,7 +57,7 @@ func (d *localGroupsDataSource) Read(ctx context.Context, req datasource.ReadReq } // Read API call logic - winResp, err := d.client.Local.GroupList(ctx) + winResp, err := d.client.LocalAccounts.GroupList(ctx) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local security groups, got error: %s", err)) return diff --git a/internal/provider/local/local_user_data_source.go b/internal/provider/local/local_user_data_source.go index 5a00426..d7bd7cf 100644 --- a/internal/provider/local/local_user_data_source.go +++ b/internal/provider/local/local_user_data_source.go @@ -7,7 +7,7 @@ import ( "time" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/windows/local" + "github.com/d-strobel/gowindows/windows/local/accounts" "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -62,12 +62,12 @@ func (d *localUserDataSource) Read(ctx context.Context, req datasource.ReadReque } // Read API call logic - params := local.UserReadParams{ + params := accounts.UserReadParams{ Name: data.Name.ValueString(), SID: data.Sid.ValueString(), } - winResp, err := d.client.Local.UserRead(ctx, params) + winResp, err := d.client.LocalAccounts.UserRead(ctx, params) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local user, got error: %s", err)) return diff --git a/internal/provider/local/local_user_resource.go b/internal/provider/local/local_user_resource.go index cd72a65..d312429 100644 --- a/internal/provider/local/local_user_resource.go +++ b/internal/provider/local/local_user_resource.go @@ -7,7 +7,7 @@ import ( "time" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/windows/local" + "github.com/d-strobel/gowindows/windows/local/accounts" "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" @@ -66,7 +66,7 @@ func (r *localUserResource) Create(ctx context.Context, req resource.CreateReque } // Create API call logic - params := local.UserCreateParams{ + params := accounts.UserCreateParams{ Name: data.Name.ValueString(), FullName: data.FullName.ValueString(), Description: data.Description.ValueString(), @@ -77,7 +77,7 @@ func (r *localUserResource) Create(ctx context.Context, req resource.CreateReque AccountExpires: accountExpiresPlanValue, } - winResp, err := r.client.Local.UserCreate(ctx, params) + winResp, err := r.client.LocalAccounts.UserCreate(ctx, params) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create local user, got error: %s", err)) return @@ -126,7 +126,7 @@ func (r *localUserResource) Read(ctx context.Context, req resource.ReadRequest, } // Read API call logic - winResp, err := r.client.Local.UserRead(ctx, local.UserReadParams{SID: data.Sid.ValueString()}) + winResp, err := r.client.LocalAccounts.UserRead(ctx, accounts.UserReadParams{SID: data.Sid.ValueString()}) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local user, got error: %s", err)) return @@ -178,7 +178,7 @@ func (r *localUserResource) Update(ctx context.Context, req resource.UpdateReque } // Update API call logic - params := local.UserUpdateParams{ + params := accounts.UserUpdateParams{ AccountExpires: accountExpiresValue, Description: data.Description.ValueString(), Enabled: data.Enabled.ValueBool(), @@ -189,12 +189,12 @@ func (r *localUserResource) Update(ctx context.Context, req resource.UpdateReque SID: data.Sid.ValueString(), } - if err := r.client.Local.UserUpdate(ctx, params); err != nil { + if err := r.client.LocalAccounts.UserUpdate(ctx, params); err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to update local user, got error: %s", err)) return } - winResp, err := r.client.Local.UserRead(ctx, local.UserReadParams{SID: data.Sid.ValueString()}) + winResp, err := r.client.LocalAccounts.UserRead(ctx, accounts.UserReadParams{SID: data.Sid.ValueString()}) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local user after update, got error: %s", err)) return @@ -242,7 +242,7 @@ func (r *localUserResource) Delete(ctx context.Context, req resource.DeleteReque } // Delete API call logic - err := r.client.Local.UserDelete(ctx, local.UserDeleteParams{SID: data.Sid.ValueString()}) + err := r.client.LocalAccounts.UserDelete(ctx, accounts.UserDeleteParams{SID: data.Sid.ValueString()}) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete local user, got error: %s", err)) return diff --git a/internal/provider/local/local_users_data_source.go b/internal/provider/local/local_users_data_source.go index 8ba135e..4a6cac5 100644 --- a/internal/provider/local/local_users_data_source.go +++ b/internal/provider/local/local_users_data_source.go @@ -58,7 +58,7 @@ func (d *localUsersDataSource) Read(ctx context.Context, req datasource.ReadRequ } // Read API call logic - winResp, err := d.client.Local.UserList(ctx) + winResp, err := d.client.LocalAccounts.UserList(ctx) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read local users, got error: %s", err)) return diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 7e814cc..da79c49 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -14,7 +14,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/d-strobel/gowindows" - "github.com/d-strobel/gowindows/connection" + "github.com/d-strobel/gowindows/connection/ssh" + "github.com/d-strobel/gowindows/connection/winrm" ) const ( @@ -35,10 +36,6 @@ const ( envWinRMInsecure string = "WIN_WINRM_INSECURE" envWinRMUseTLS string = "WIN_WINRM_USE_TLS" - // WinRM Kerberos environment variables. - envKerberosRealm string = "WIN_KRB_REALM" - envKerberosConfigFile string = "WIN_KRB_CONFIG_FILE" - // SSH default values. defaultSSHPort int = 22 defaultSSHInsecure bool = false @@ -73,166 +70,167 @@ Check examples below for reference. ` } +// Configue sets up the provider client. +// This includes the connection to the Windows system via WinRM or SSH. func (p *WindowsProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { var data provider_windows.WindowsModel + var client *gowindows.Client resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - // Init connection configuration - config := &connection.Config{} - - // Check and setup WinRM configuration + // Check the WinRM config and setup the connection. if !data.Winrm.IsNull() { - config.WinRM = &connection.WinRMConfig{} + config := &winrm.Config{} // Endpoint - config.WinRM.WinRMHost = data.Endpoint.ValueString() + config.Host = data.Endpoint.ValueString() // Username - config.WinRM.WinRMUsername = data.Winrm.Password.ValueString() + config.Username = data.Winrm.Password.ValueString() if data.Winrm.Password.IsNull() { - config.WinRM.WinRMUsername = os.Getenv(envWinRMUsername) + config.Username = os.Getenv(envWinRMUsername) } // Password - config.WinRM.WinRMPassword = data.Winrm.Password.ValueString() + config.Password = data.Winrm.Password.ValueString() if data.Winrm.Password.IsNull() { - config.WinRM.WinRMPassword = os.Getenv(envWinRMPassword) + config.Password = os.Getenv(envWinRMPassword) } // Port - config.WinRM.WinRMPort = defaultWinRMPort + config.Port = defaultWinRMPort if !data.Winrm.Port.IsNull() { - config.WinRM.WinRMPort = int(data.Winrm.Port.ValueInt64()) + config.Port = int(data.Winrm.Port.ValueInt64()) } else if os.Getenv(envWinRMPort) != "" { winrmPort, err := strconv.Atoi(os.Getenv(envWinRMPort)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to integer. Error: %s", envWinRMPort, err)) } - config.WinRM.WinRMPort = winrmPort + config.Port = winrmPort } // Timeout - config.WinRM.WinRMTimeout = defaultWinRMTimeout + config.Timeout = defaultWinRMTimeout if !data.Winrm.Timeout.IsNull() { - config.WinRM.WinRMTimeout = time.Duration(data.Winrm.Timeout.ValueInt64()) + config.Timeout = time.Duration(data.Winrm.Timeout.ValueInt64()) } else if os.Getenv(envWinRMTimeout) != "" { winrmTimeout, err := strconv.Atoi(os.Getenv(envWinRMTimeout)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to integer. Error: %s", envWinRMTimeout, err)) } - config.WinRM.WinRMTimeout = time.Duration(winrmTimeout) + config.Timeout = time.Duration(winrmTimeout) } // UseTLS (https) - config.WinRM.WinRMUseTLS = defaultWinRMUseTLS + config.UseTLS = defaultWinRMUseTLS if !data.Winrm.UseTls.IsNull() { - config.WinRM.WinRMUseTLS = data.Winrm.UseTls.ValueBool() + config.UseTLS = data.Winrm.UseTls.ValueBool() } else if os.Getenv(envWinRMUseTLS) != "" { winrmUseTls, err := strconv.ParseBool(os.Getenv(envWinRMUseTLS)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to integer. Error: %s", envWinRMUseTLS, err)) } - config.WinRM.WinRMUseTLS = winrmUseTls + config.UseTLS = winrmUseTls } // Insecure - config.WinRM.WinRMInsecure = defaultWinRMInsecure + config.Insecure = defaultWinRMInsecure if !data.Winrm.Insecure.IsNull() { - config.WinRM.WinRMInsecure = data.Winrm.Insecure.ValueBool() + config.Insecure = data.Winrm.Insecure.ValueBool() } else if os.Getenv(envWinRMInsecure) != "" { winrmInsecure, err := strconv.ParseBool(os.Getenv(envWinRMInsecure)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to bool. Error: %s", envWinRMInsecure, err)) } - config.WinRM.WinRMUseTLS = winrmInsecure + config.UseTLS = winrmInsecure } - // Kerberos - if !data.Kerberos.IsNull() { - config.WinRM.WinRMKerberos = &connection.KerberosConfig{} - - // Realm - if !data.Kerberos.Realm.IsNull() { - config.WinRM.WinRMKerberos.Realm = data.Kerberos.Realm.ValueString() - } else if os.Getenv(envKerberosRealm) != "" { - config.WinRM.WinRMKerberos.Realm = os.Getenv(envKerberosRealm) - } - - // Krb config file - if !data.Kerberos.KrbConfigFile.IsNull() { - config.WinRM.WinRMKerberos.KrbConfigFile = data.Kerberos.KrbConfigFile.ValueString() - } else if os.Getenv(envKerberosConfigFile) != "" { - config.WinRM.WinRMKerberos.KrbConfigFile = os.Getenv(envKerberosConfigFile) - } + // Connect to the Windows system. + conn, err := winrm.NewConnection(config) + if err != nil { + resp.Diagnostics.AddError("Unable to setup a new connection via WinRM", err.Error()) + return } + + // Setup the gowindows client. + client = gowindows.NewClient(conn) } - // Check and set SSH configuration + // Check the SSH config and setup the connection. if !data.Ssh.IsNull() { - config.SSH = &connection.SSHConfig{} + config := &ssh.Config{} // Endpoint - config.SSH.SSHHost = data.Endpoint.ValueString() + config.Host = data.Endpoint.ValueString() // Username if !data.Ssh.Username.IsNull() { - config.SSH.SSHUsername = data.Ssh.Username.ValueString() + config.Username = data.Ssh.Username.ValueString() } else if os.Getenv(envSSHUsername) != "" { - config.SSH.SSHUsername = os.Getenv(envSSHUsername) + config.Username = os.Getenv(envSSHUsername) } // Password if !data.Ssh.Password.IsNull() { - config.SSH.SSHPassword = data.Ssh.Password.ValueString() + config.Password = data.Ssh.Password.ValueString() } else if os.Getenv(envSSHPassword) != "" { - config.SSH.SSHPassword = os.Getenv(envSSHPassword) + config.Password = os.Getenv(envSSHPassword) } // Private Key if !data.Ssh.PrivateKey.IsNull() { - config.SSH.SSHPrivateKey = data.Ssh.PrivateKey.ValueString() + config.PrivateKey = data.Ssh.PrivateKey.ValueString() } else if os.Getenv(envSSHPrivateKey) != "" { - config.SSH.SSHPrivateKey = os.Getenv(envSSHPrivateKey) + config.PrivateKey = os.Getenv(envSSHPrivateKey) } // Private Key path if !data.Ssh.PrivateKeyPath.IsNull() { - config.SSH.SSHPrivateKeyPath = data.Ssh.PrivateKeyPath.ValueString() + config.PrivateKeyPath = data.Ssh.PrivateKeyPath.ValueString() } else if os.Getenv(envSSHPrivateKeyPath) != "" { - config.SSH.SSHPrivateKeyPath = os.Getenv(envSSHPrivateKeyPath) + config.PrivateKeyPath = os.Getenv(envSSHPrivateKeyPath) } // Port - config.SSH.SSHPort = defaultSSHPort + config.Port = defaultSSHPort if !data.Ssh.Port.IsNull() { - config.SSH.SSHPort = int(data.Ssh.Port.ValueInt64()) + config.Port = int(data.Ssh.Port.ValueInt64()) } else if os.Getenv(envSSHPort) != "" { sshPort, err := strconv.Atoi(os.Getenv(envSSHPort)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to integer. Error: %s", envSSHPort, err)) } - config.SSH.SSHPort = sshPort + config.Port = sshPort } // Insecure - config.SSH.SSHInsecureIgnoreHostKey = defaultSSHInsecure + config.InsecureIgnoreHostKey = defaultSSHInsecure if !data.Ssh.Insecure.IsNull() { - config.SSH.SSHInsecureIgnoreHostKey = data.Ssh.Insecure.ValueBool() + config.InsecureIgnoreHostKey = data.Ssh.Insecure.ValueBool() } else if os.Getenv(envSSHInsecure) != "" { sshInsecure, err := strconv.ParseBool(os.Getenv(envSSHInsecure)) if err != nil { resp.Diagnostics.AddError("Environment variable conversion error", fmt.Sprintf("Failed to convert environment variable '%s' to bool. Error: %s", envSSHInsecure, err)) } - config.SSH.SSHInsecureIgnoreHostKey = sshInsecure + config.InsecureIgnoreHostKey = sshInsecure } // Known hosts path if !data.Ssh.KnownHostsPath.IsNull() { - config.SSH.SSHKnownHostsPath = data.Ssh.KnownHostsPath.ValueString() + config.KnownHostsPath = data.Ssh.KnownHostsPath.ValueString() } else if os.Getenv(envSSHKnownHostsPath) != "" { - config.SSH.SSHKnownHostsPath = os.Getenv(envSSHKnownHostsPath) + config.KnownHostsPath = os.Getenv(envSSHKnownHostsPath) } + + // Connect to the Windows system. + conn, err := ssh.NewConnection(config) + if err != nil { + resp.Diagnostics.AddError("Unable to setup a new connection via SSH", err.Error()) + return + } + + // Setup the gowindows client. + client = gowindows.NewClient(conn) } // Do not setup client if any errors occur @@ -240,13 +238,7 @@ func (p *WindowsProvider) Configure(ctx context.Context, req provider.ConfigureR return } - // Setup client - client, err := gowindows.NewClient(config) - if err != nil { - resp.Diagnostics.AddError("Unable to setup client", err.Error()) - return - } - + // Set the client in the provider. resp.DataSourceData = client resp.ResourceData = client } diff --git a/internal/provider/validate.go b/internal/provider/validate.go index 7fc6872..57a4c4c 100644 --- a/internal/provider/validate.go +++ b/internal/provider/validate.go @@ -18,10 +18,6 @@ func (p *WindowsProvider) ConfigValidators(ctx context.Context) []provider.Confi path.MatchRoot("winrm"), path.MatchRoot("ssh"), ), - providervalidator.Conflicting( - path.MatchRoot("ssh"), - path.MatchRoot("kerberos"), - ), } } @@ -51,26 +47,6 @@ func (p *WindowsProvider) ValidateConfig(ctx context.Context, req provider.Valid } } - // Check Kerberos attributes - if !data.Kerberos.IsNull() { - - // Kerberos realm must be set via config or environment variable - if data.Kerberos.Realm.IsNull() && os.Getenv(envKerberosRealm) == "" { - resp.Diagnostics.AddAttributeError(path.Root("kerberos"), - "Missing config attribute", - fmt.Sprintf("Parameter 'realm' or environment variable '%s' must be set.", envKerberosRealm), - ) - } - - // Kerberos config file must be set via config or environment variable - if data.Kerberos.KrbConfigFile.IsNull() && os.Getenv(envKerberosConfigFile) == "" { - resp.Diagnostics.AddAttributeError(path.Root("kerberos"), - "Missing config attribute", - fmt.Sprintf("Parameter 'krb_config_file' or environment variable '%s' must be set.", envKerberosConfigFile), - ) - } - } - // Check SSH attributes if !data.Ssh.IsNull() {