Documentation
¶
Index ¶
- Variables
- func New(version string) func() provider.Provider
- func NewSSHExecDataSource() datasource.DataSource
- func NewSSHExecResource() resource.Resource
- func NewSSHFileDataSource() datasource.DataSource
- func NewSSHFileResource() resource.Resource
- type SSHConnectionConfig
- type SSHConnectionModel
- type SSHExecDataSource
- func (d *SSHExecDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, ...)
- func (d *SSHExecDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, ...)
- func (d *SSHExecDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
- func (d *SSHExecDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse)
- type SSHExecDataSourceModel
- type SSHExecResource
- func (r *SSHExecResource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r *SSHExecResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *SSHExecResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *SSHExecResource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r *SSHExecResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *SSHExecResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *SSHExecResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- type SSHExecResourceModel
- type SSHFileDataSource
- func (d *SSHFileDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, ...)
- func (d *SSHFileDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, ...)
- func (d *SSHFileDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
- func (d *SSHFileDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse)
- type SSHFileDataSourceModel
- type SSHFileResource
- func (r *SSHFileResource) Configure(_ context.Context, req resource.ConfigureRequest, ...)
- func (r *SSHFileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *SSHFileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *SSHFileResource) Metadata(_ context.Context, req resource.MetadataRequest, ...)
- func (r *SSHFileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *SSHFileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *SSHFileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- type SSHFileResourceModel
- type SSHManager
- type SSHProvider
- func (p *SSHProvider) Configure(ctx context.Context, req provider.ConfigureRequest, ...)
- func (p *SSHProvider) DataSources(ctx context.Context) []func() datasource.DataSource
- func (p *SSHProvider) Functions(ctx context.Context) []func() function.Function
- func (p *SSHProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
- func (p *SSHProvider) Resources(ctx context.Context) []func() resource.Resource
- func (p *SSHProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
- type SSHProviderModel
Constants ¶
This section is empty.
Variables ¶
View Source
var SSHBastionAttr = rschema.SingleNestedAttribute{ MarkdownDescription: "Bastion host configuration", Optional: true, Attributes: map[string]rschema.Attribute{ "host": SSHConnectionSchema.Host, "port": SSHConnectionSchema.Port, "user": SSHConnectionSchema.User, "password": SSHConnectionSchema.Password, "private_key": SSHConnectionSchema.PrivateKey, }, }
View Source
var SSHConnectionSchema = struct { Host rschema.StringAttribute User rschema.StringAttribute Password rschema.StringAttribute PrivateKey rschema.StringAttribute Port rschema.Int64Attribute UseProviderAsBastion rschema.BoolAttribute Bastion rschema.SingleNestedAttribute }{ Host: rschema.StringAttribute{ MarkdownDescription: "Override the provider's host configuration", Optional: true, }, User: rschema.StringAttribute{ MarkdownDescription: "Override the provider's user configuration", Optional: true, }, Password: rschema.StringAttribute{ MarkdownDescription: "Override the provider's password configuration", Optional: true, Sensitive: true, }, PrivateKey: rschema.StringAttribute{ MarkdownDescription: "Override the provider's private key configuration", Optional: true, Sensitive: true, }, Port: rschema.Int64Attribute{ MarkdownDescription: "The port number to connect to", Optional: true, }, UseProviderAsBastion: rschema.BoolAttribute{ MarkdownDescription: "Use the provider's connection as a bastion host", Optional: true, }, Bastion: rschema.SingleNestedAttribute{ MarkdownDescription: "Bastion host configuration", Optional: true, Attributes: map[string]rschema.Attribute{ "host": rschema.StringAttribute{ MarkdownDescription: "The hostname or IP address of the bastion host", Required: true, }, "port": rschema.Int64Attribute{ MarkdownDescription: "The port number of the bastion host", Optional: true, }, "user": rschema.StringAttribute{ MarkdownDescription: "The username for bastion host authentication", Required: true, }, "password": rschema.StringAttribute{ MarkdownDescription: "The password for bastion host authentication", Optional: true, Sensitive: true, }, "private_key": rschema.StringAttribute{ MarkdownDescription: "The private key for bastion host authentication", Optional: true, Sensitive: true, }, }, }, }
View Source
var SSHExecAttrs = struct { Command rschema.StringAttribute Output rschema.StringAttribute ExitCode rschema.Int64Attribute FailIfNonzero__Resource rschema.BoolAttribute FailIfNonzero__DataSource rschema.BoolAttribute OnDestroy rschema.StringAttribute ID rschema.StringAttribute }{ Command: rschema.StringAttribute{ MarkdownDescription: "Command to execute", Required: true, }, Output: rschema.StringAttribute{ MarkdownDescription: "Output of the command", Computed: true, }, ExitCode: rschema.Int64Attribute{ MarkdownDescription: "Exit code of the command", Computed: true, }, FailIfNonzero__Resource: rschema.BoolAttribute{ MarkdownDescription: "Whether to fail if the command returns a non-zero exit code. Defaults to true if not specified.", Optional: true, Computed: true, Default: booldefault.StaticBool(true), }, FailIfNonzero__DataSource: rschema.BoolAttribute{ MarkdownDescription: "Whether to fail if the command returns a non-zero exit code", Optional: true, }, OnDestroy: rschema.StringAttribute{ MarkdownDescription: "Command to execute when the resource is destroyed", Optional: true, }, ID: rschema.StringAttribute{ MarkdownDescription: "Unique identifier for this execution", Computed: true, }, }
View Source
var SSHExecDataSourceSchema = dschema.Schema{ MarkdownDescription: "Execute commands over SSH", Attributes: map[string]dschema.Attribute{ "command": SSHExecAttrs.Command, "output": SSHExecAttrs.Output, "exit_code": SSHExecAttrs.ExitCode, "fail_if_nonzero": SSHExecAttrs.FailIfNonzero__DataSource, "id": SSHExecAttrs.ID, "host": SSHConnectionSchema.Host, "user": SSHConnectionSchema.User, "password": SSHConnectionSchema.Password, "private_key": SSHConnectionSchema.PrivateKey, "port": SSHConnectionSchema.Port, "use_provider_as_bastion": SSHConnectionSchema.UseProviderAsBastion, "bastion": SSHConnectionSchema.Bastion, }, }
View Source
var SSHExecResourceSchema = rschema.Schema{ MarkdownDescription: "Execute commands over SSH with potential side effects", Attributes: map[string]rschema.Attribute{ "command": SSHExecAttrs.Command, "output": SSHExecAttrs.Output, "exit_code": SSHExecAttrs.ExitCode, "fail_if_nonzero": SSHExecAttrs.FailIfNonzero__Resource, "on_destroy": SSHExecAttrs.OnDestroy, "id": SSHExecAttrs.ID, "host": SSHConnectionSchema.Host, "user": SSHConnectionSchema.User, "password": SSHConnectionSchema.Password, "private_key": SSHConnectionSchema.PrivateKey, "port": SSHConnectionSchema.Port, "use_provider_as_bastion": SSHConnectionSchema.UseProviderAsBastion, "bastion": SSHConnectionSchema.Bastion, }, }
View Source
var SSHFileAttrs = struct { Path rschema.StringAttribute Content__Resource rschema.StringAttribute Content__DataSource rschema.StringAttribute Permissions rschema.StringAttribute FailIfAbsent rschema.BoolAttribute DeleteOnDestroy rschema.BoolAttribute ID rschema.StringAttribute }{ Path: rschema.StringAttribute{ MarkdownDescription: "Path to the file", Required: true, }, Content__Resource: rschema.StringAttribute{ MarkdownDescription: "Content of the file", Required: true, }, Content__DataSource: rschema.StringAttribute{ MarkdownDescription: "Content of the file", Computed: true, }, Permissions: rschema.StringAttribute{ MarkdownDescription: "File permissions (e.g., '0644')", Optional: true, Computed: true, Default: stringdefault.StaticString("0644"), }, FailIfAbsent: rschema.BoolAttribute{ MarkdownDescription: "Whether to fail if the file does not exist", Optional: true, }, DeleteOnDestroy: rschema.BoolAttribute{ MarkdownDescription: "Whether to delete the file when the resource is destroyed. Defaults to true.", Optional: true, Computed: true, Default: booldefault.StaticBool(true), }, ID: rschema.StringAttribute{ MarkdownDescription: "Unique identifier for this file", Computed: true, }, }
View Source
var SSHFileDataSourceSchema = dschema.Schema{ MarkdownDescription: "Read files over SSH", Attributes: map[string]dschema.Attribute{ "path": SSHFileAttrs.Path, "content": SSHFileAttrs.Content__DataSource, "permissions": SSHFileAttrs.Permissions, "fail_if_absent": SSHFileAttrs.FailIfAbsent, "id": SSHFileAttrs.ID, "host": SSHConnectionSchema.Host, "user": SSHConnectionSchema.User, "password": SSHConnectionSchema.Password, "private_key": SSHConnectionSchema.PrivateKey, "port": SSHConnectionSchema.Port, "use_provider_as_bastion": SSHConnectionSchema.UseProviderAsBastion, "bastion": SSHConnectionSchema.Bastion, }, }
View Source
var SSHFileResourceSchema = rschema.Schema{ MarkdownDescription: "Manage files over SSH with potential side effects", Attributes: map[string]rschema.Attribute{ "path": SSHFileAttrs.Path, "content": SSHFileAttrs.Content__Resource, "permissions": SSHFileAttrs.Permissions, "fail_if_absent": SSHFileAttrs.FailIfAbsent, "delete_on_destroy": SSHFileAttrs.DeleteOnDestroy, "id": SSHFileAttrs.ID, "host": SSHConnectionSchema.Host, "user": SSHConnectionSchema.User, "password": SSHConnectionSchema.Password, "private_key": SSHConnectionSchema.PrivateKey, "port": SSHConnectionSchema.Port, "use_provider_as_bastion": SSHConnectionSchema.UseProviderAsBastion, "bastion": SSHConnectionSchema.Bastion, }, }
View Source
var SSHProviderAttrs = struct { Host rschema.StringAttribute Port rschema.Int64Attribute User rschema.StringAttribute Password rschema.StringAttribute PrivateKey rschema.StringAttribute Bastion rschema.SingleNestedAttribute }{ Host: rschema.StringAttribute{ MarkdownDescription: "The hostname or IP address of the target SSH server", Optional: true, }, Port: rschema.Int64Attribute{ MarkdownDescription: "The port number of the target SSH server", Optional: true, }, User: rschema.StringAttribute{ MarkdownDescription: "The username for SSH authentication", Optional: true, }, Password: rschema.StringAttribute{ MarkdownDescription: "The password for SSH authentication", Optional: true, Sensitive: true, }, PrivateKey: rschema.StringAttribute{ MarkdownDescription: "The private key for SSH authentication", Optional: true, Sensitive: true, }, Bastion: SSHBastionAttr, }
View Source
var SSHProviderSchema = pschema.Schema{ Attributes: map[string]pschema.Attribute{ "host": SSHProviderAttrs.Host, "port": SSHProviderAttrs.Port, "user": SSHProviderAttrs.User, "password": SSHProviderAttrs.Password, "private_key": SSHProviderAttrs.PrivateKey, "bastion": SSHProviderAttrs.Bastion, }, }
Functions ¶
func NewSSHExecDataSource ¶
func NewSSHExecDataSource() datasource.DataSource
func NewSSHExecResource ¶
func NewSSHFileDataSource ¶
func NewSSHFileDataSource() datasource.DataSource
func NewSSHFileResource ¶
Types ¶
type SSHConnectionConfig ¶
type SSHConnectionModel ¶
type SSHConnectionModel struct {
Host types.String `tfsdk:"host"`
User types.String `tfsdk:"user"`
Password types.String `tfsdk:"password"`
PrivateKey types.String `tfsdk:"private_key"`
Port types.Int64 `tfsdk:"port"`
}
Common model for SSH connection configuration
type SSHExecDataSource ¶
type SSHExecDataSource struct {
// contains filtered or unexported fields
}
func (*SSHExecDataSource) Configure ¶
func (d *SSHExecDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse)
func (*SSHExecDataSource) Metadata ¶
func (d *SSHExecDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse)
func (*SSHExecDataSource) Read ¶
func (d *SSHExecDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
func (*SSHExecDataSource) Schema ¶
func (d *SSHExecDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse)
type SSHExecDataSourceModel ¶
type SSHExecDataSourceModel struct {
Command types.String `tfsdk:"command"`
Output types.String `tfsdk:"output"`
ExitCode types.Int64 `tfsdk:"exit_code"`
FailIfNonzero types.Bool `tfsdk:"fail_if_nonzero"`
Id types.String `tfsdk:"id"`
// Connection details
SSHConnectionModel
UseProviderAsBastion types.Bool `tfsdk:"use_provider_as_bastion"`
Bastion *SSHConnectionModel `tfsdk:"bastion"`
}
type SSHExecResource ¶
type SSHExecResource struct {
// contains filtered or unexported fields
}
func (*SSHExecResource) Configure ¶
func (r *SSHExecResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (*SSHExecResource) Create ¶
func (r *SSHExecResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (*SSHExecResource) Delete ¶
func (r *SSHExecResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (*SSHExecResource) Metadata ¶
func (r *SSHExecResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (*SSHExecResource) Read ¶
func (r *SSHExecResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (*SSHExecResource) Schema ¶
func (r *SSHExecResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
func (*SSHExecResource) Update ¶
func (r *SSHExecResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
type SSHExecResourceModel ¶
type SSHExecResourceModel struct {
Command types.String `tfsdk:"command"`
Output types.String `tfsdk:"output"`
ExitCode types.Int64 `tfsdk:"exit_code"`
FailIfNonzero types.Bool `tfsdk:"fail_if_nonzero"`
OnDestroy types.String `tfsdk:"on_destroy"`
Id types.String `tfsdk:"id"`
// Connection details
SSHConnectionModel
UseProviderAsBastion types.Bool `tfsdk:"use_provider_as_bastion"`
Bastion *SSHConnectionModel `tfsdk:"bastion"`
}
type SSHFileDataSource ¶
type SSHFileDataSource struct {
// contains filtered or unexported fields
}
func (*SSHFileDataSource) Configure ¶
func (d *SSHFileDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse)
func (*SSHFileDataSource) Metadata ¶
func (d *SSHFileDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse)
func (*SSHFileDataSource) Read ¶
func (d *SSHFileDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
func (*SSHFileDataSource) Schema ¶
func (d *SSHFileDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse)
type SSHFileDataSourceModel ¶
type SSHFileDataSourceModel struct {
Path types.String `tfsdk:"path"`
Content types.String `tfsdk:"content"`
Permissions types.String `tfsdk:"permissions"`
FailIfAbsent types.Bool `tfsdk:"fail_if_absent"`
Id types.String `tfsdk:"id"`
// Connection details
SSHConnectionModel
UseProviderAsBastion types.Bool `tfsdk:"use_provider_as_bastion"`
Bastion *SSHConnectionModel `tfsdk:"bastion"`
}
type SSHFileResource ¶
type SSHFileResource struct {
// contains filtered or unexported fields
}
func (*SSHFileResource) Configure ¶
func (r *SSHFileResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (*SSHFileResource) Create ¶
func (r *SSHFileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (*SSHFileResource) Delete ¶
func (r *SSHFileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (*SSHFileResource) Metadata ¶
func (r *SSHFileResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (*SSHFileResource) Read ¶
func (r *SSHFileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (*SSHFileResource) Schema ¶
func (r *SSHFileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse)
func (*SSHFileResource) Update ¶
func (r *SSHFileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
type SSHFileResourceModel ¶
type SSHFileResourceModel struct {
Path types.String `tfsdk:"path"`
Content types.String `tfsdk:"content"`
Permissions types.String `tfsdk:"permissions"`
FailIfAbsent types.Bool `tfsdk:"fail_if_absent"`
DeleteOnDestroy types.Bool `tfsdk:"delete_on_destroy"`
Id types.String `tfsdk:"id"`
// Connection details
SSHConnectionModel
UseProviderAsBastion types.Bool `tfsdk:"use_provider_as_bastion"`
Bastion *SSHConnectionModel `tfsdk:"bastion"`
}
type SSHManager ¶
type SSHManager struct {
// contains filtered or unexported fields
}
SSHManager handles SSH connections for the provider
func NewSSHManager ¶
func NewSSHManager(config *SSHConnectionConfig, bastion *SSHConnectionConfig) (*SSHManager, error)
NewSSHManager creates a new SSH connection manager
func (*SSHManager) GetClient ¶
func (m *SSHManager) GetClient(config SSHConnectionConfig, useProviderAsBastion bool, bastion *SSHConnectionConfig, fromClient *ssh.Client) (*ssh.Client, error)
GetClient returns a cached SSH client or creates a new one if not found
type SSHProvider ¶
type SSHProvider struct {
// contains filtered or unexported fields
}
func (*SSHProvider) Configure ¶
func (p *SSHProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse)
func (*SSHProvider) DataSources ¶
func (p *SSHProvider) DataSources(ctx context.Context) []func() datasource.DataSource
func (*SSHProvider) Functions ¶
func (p *SSHProvider) Functions(ctx context.Context) []func() function.Function
func (*SSHProvider) Metadata ¶
func (p *SSHProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
func (*SSHProvider) Resources ¶
func (p *SSHProvider) Resources(ctx context.Context) []func() resource.Resource
func (*SSHProvider) Schema ¶
func (p *SSHProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
type SSHProviderModel ¶
type SSHProviderModel struct {
SSHConnectionModel
Bastion *SSHConnectionModel `tfsdk:"bastion"`
}
Click to show internal directories.
Click to hide internal directories.