snowflake_credential

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthTypes = []string{
	"password",
	"keypair",
}
View Source
var SnowflakeCredentialResourceSchema = resource_schema.Schema{
	Description: "Snowflake credential resource. This resource is used both as a stand-alone credential, but also as part of the Semantic Layer credential definition for Snowflake.",
	Attributes: map[string]resource_schema.Attribute{
		"id": resource_schema.StringAttribute{
			Computed:    true,
			Description: "The ID of this resource. Contains the project ID and the credential ID.",
			PlanModifiers: []planmodifier.String{
				stringplanmodifier.UseStateForUnknown(),
			},
		},
		"is_active": resource_schema.BoolAttribute{
			Optional:    true,
			Computed:    true,
			Default:     booldefault.StaticBool(true),
			Description: "Whether the Snowflake credential is active",
		},
		"project_id": resource_schema.Int64Attribute{
			Required:    true,
			Description: "Project ID to create the Snowflake credential in",
			PlanModifiers: []planmodifier.Int64{
				int64planmodifier.RequiresReplace(),
			},
		},
		"credential_id": resource_schema.Int64Attribute{
			Computed:    true,
			Description: "The internal credential ID",
			PlanModifiers: []planmodifier.Int64{
				int64planmodifier.UseStateForUnknown(),
			},
		},
		"auth_type": resource_schema.StringAttribute{
			Required:    true,
			Description: "The type of Snowflake credential ('password' or 'keypair')",
			Validators: []validator.String{
				stringvalidator.OneOf(AuthTypes...),
			},
		},
		"database": resource_schema.StringAttribute{
			Optional:    true,
			Description: "The catalog to connect use",
		},
		"role": resource_schema.StringAttribute{
			Optional:    true,
			Description: "The role to assume",
		},
		"warehouse": resource_schema.StringAttribute{
			Optional:    true,
			Description: "The warehouse to use",
		},
		"schema": resource_schema.StringAttribute{
			Optional:    true,
			Computed:    true,
			Default:     stringdefault.StaticString("default_schema"),
			Description: "The schema where to create models. This is an optional field ONLY if the credential is used for Semantic Layer configuration, otherwise it is required.",
		},
		"user": resource_schema.StringAttribute{
			Optional:    true,
			Computed:    true,
			Default:     stringdefault.StaticString("default_user"),
			Description: "The username for the Snowflake account. This is an optional field ONLY if the credential is used for Semantic Layer configuration, otherwise it is required. ",
		},
		"password": resource_schema.StringAttribute{
			Optional:    true,
			Sensitive:   true,
			Description: "The password for the Snowflake account",
			Computed:    true,
			Default:     stringdefault.StaticString(""),
			Validators: []validator.String{
				snowflake_credential.ConflictValidator{ConflictingFields: []string{"private_key", "private_key_passphrase"}},
			},
		},
		"private_key": resource_schema.StringAttribute{
			Optional:    true,
			Sensitive:   true,
			Computed:    true,
			Default:     stringdefault.StaticString(""),
			Description: "The private key for the Snowflake account",
			Validators: []validator.String{
				snowflake_credential.ConflictValidator{ConflictingFields: []string{"password"}},
			},
		},
		"private_key_passphrase": resource_schema.StringAttribute{
			Optional:    true,
			Sensitive:   true,
			Computed:    true,
			Default:     stringdefault.StaticString(""),
			Description: "The passphrase for the private key",
			Validators: []validator.String{
				snowflake_credential.ConflictValidator{ConflictingFields: []string{"password"}},
			},
		},
		"num_threads": resource_schema.Int64Attribute{
			Required:    true,
			Description: "Number of threads to use",
		},
		"semantic_layer_credential": resource_schema.BoolAttribute{
			Optional:    true,
			Description: "This field indicates that the credential is used as part of the Semantic Layer configuration. It is used to create a Snowflake credential for the Semantic Layer.",
			Computed:    true,
			Default:     booldefault.StaticBool(false),
			Validators: []validator.Bool{
				snowflake_credential.SemanticLayerCredentialValidator{},
			},
		},
	},
}

Functions

func SnowflakeCredentialDataSource

func SnowflakeCredentialDataSource() datasource.DataSource

SnowflakeCredentialDataSource is a helper function to simplify the provider implementation.

func SnowflakeCredentialResource

func SnowflakeCredentialResource() resource.Resource

SnowflakeCredentialResource is a helper function to simplify the provider implementation.

Types

type SnowflakeCredentialDataSourceModel

type SnowflakeCredentialDataSourceModel struct {
	ID           types.String `tfsdk:"id"`
	CredentialID types.Int64  `tfsdk:"credential_id"`
	IsActive     types.Bool   `tfsdk:"is_active"`
	AuthType     types.String `tfsdk:"auth_type"`
	ProjectID    types.Int64  `tfsdk:"project_id"`
	Schema       types.String `tfsdk:"schema"`
	User         types.String `tfsdk:"user"`
	NumThreads   types.Int64  `tfsdk:"num_threads"`
}

SnowflakeCredentialDataSourceModel is the model for the data source

type SnowflakeCredentialResourceModel

type SnowflakeCredentialResourceModel struct {
	ID                      types.String `tfsdk:"id"`
	CredentialID            types.Int64  `tfsdk:"credential_id"`
	ProjectID               types.Int64  `tfsdk:"project_id"`
	User                    types.String `tfsdk:"user"`
	Password                types.String `tfsdk:"password"`
	AuthType                types.String `tfsdk:"auth_type"`
	Database                types.String `tfsdk:"database"`
	Role                    types.String `tfsdk:"role"`
	Warehouse               types.String `tfsdk:"warehouse"`
	Schema                  types.String `tfsdk:"schema"`
	PrivateKey              types.String `tfsdk:"private_key"`
	PrivateKeyPassphrase    types.String `tfsdk:"private_key_passphrase"`
	IsActive                types.Bool   `tfsdk:"is_active"`
	NumThreads              types.Int64  `tfsdk:"num_threads"`
	SemanticLayerCredential types.Bool   `tfsdk:"semantic_layer_credential"`
}

SnowflakeCredentialResourceModel is the model for the resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL