From 46e5962004671d64207ebb5c64ada886887bb37d Mon Sep 17 00:00:00 2001 From: Alik Send Date: Thu, 1 Aug 2024 18:46:01 -0500 Subject: [PATCH] Rename option --- provider/provider.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/provider/provider.go b/provider/provider.go index 836fb58..ecb1050 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -46,11 +46,11 @@ type dokkuProviderModel struct { SshPort types.Int64 `tfsdk:"ssh_port"` SshUser types.String `tfsdk:"ssh_user"` SshCert types.String `tfsdk:"ssh_cert"` + SshSkipHostKeyCheck types.Bool `tfsdk:"ssh_skip_host_key_check"` SshHostKey types.String `tfsdk:"ssh_host_key"` LogSshCommands types.Bool `tfsdk:"log_ssh_commands"` UploadAppName types.String `tfsdk:"upload_app_name"` UploadSplitBytes types.Int64 `tfsdk:"upload_split_bytes"` - SkipKnownHostsCheck types.Bool `tfsdk:"skip_known_hosts_check"` } func (p *dokkuProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) { @@ -93,6 +93,10 @@ func (p *dokkuProvider) Schema(ctx context.Context, req provider.SchemaRequest, stringvalidator.LengthAtLeast(1), }, }, + "ssh_skip_host_key_check": schema.BoolAttribute{ + Optional: true, + Description: "Skip the host key check. Insecure, should not be used in production. Default: false", + }, "ssh_host_key": schema.StringAttribute{ Optional: true, Description: strings.Join([]string{ @@ -140,10 +144,6 @@ func (p *dokkuProvider) Schema(ctx context.Context, req provider.SchemaRequest, int64validator.AtLeast(1), }, }, - "skip_known_hosts_check": schema.BoolAttribute{ - Optional: true, - Description: "Skip the known hosts check. Default: false", - }, }, } } @@ -271,9 +271,9 @@ func (p *dokkuProvider) Configure(ctx context.Context, req provider.ConfigureReq tflog.Debug(ctx, "ssh connection", map[string]any{"host": host, "port": port, "user": sshUsername}) - skipKnownHostsCheck := false - if !config.SkipKnownHostsCheck.IsNull() { - skipKnownHostsCheck = config.SkipKnownHostsCheck.ValueBool() + skipHostKeyCheck := false + if !config.SshSkipHostKeyCheck.IsNull() { + skipHostKeyCheck = config.SshSkipHostKeyCheck.ValueBool() } sshConfig := &goph.Config{ @@ -284,7 +284,7 @@ func (p *dokkuProvider) Configure(ctx context.Context, req provider.ConfigureReq Callback: verifyHost, } - if skipKnownHostsCheck { + if skipHostKeyCheck { sshConfig.Callback = ssh.InsecureIgnoreHostKey() } else if !config.SshHostKey.IsNull() { _, _, publicKey, _, _, err := ssh.ParseKnownHosts([]byte(config.SshHostKey.ValueString()))