postgres_credential

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostgresResourceSchema = resource_schema.Schema{
	Description: "Postgres credential resource.",
	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.",
		},
		"is_active": resource_schema.BoolAttribute{
			Optional:    true,
			Computed:    true,
			Default:     booldefault.StaticBool(true),
			Description: "Whether the Postgres/Redshift/AlloyDB credential is active",
		},
		"project_id": resource_schema.Int64Attribute{
			Required:    true,
			Description: "Project ID to create the Postgres/Redshift/AlloyDB credential in.",
		},
		"credential_id": resource_schema.Int64Attribute{
			Computed:    true,
			Description: "The system Postgres/Redshift/AlloyDB credential ID.",
		},
		"type": resource_schema.StringAttribute{
			Optional:    true,
			Computed:    true,
			Default:     stringdefault.StaticString("postgres"),
			Description: "Type of connection. One of (postgres/redshift). Use postgres for alloydb connections. Optional only when semantic_layer_credential is set to true; otherwise, this field is required.",
			Validators: []validator.String{
				stringvalidator.OneOf(
					warehouseTypes...,
				),
				sl_cred_validator.SemanticLayerCredentialValidator{FieldName: "type"},
			},
		},
		"default_schema": resource_schema.StringAttribute{
			Optional:    true,
			Computed:    true,
			Default:     stringdefault.StaticString("default_schema"),
			Description: "Default schema name. Optional only when semantic_layer_credential is set to true; otherwise, this field is required.",
			Validators: []validator.String{
				sl_cred_validator.SemanticLayerCredentialValidator{FieldName: "default_schema"},
			},
		},
		"target_name": resource_schema.StringAttribute{
			Optional:    true,
			Computed:    true,
			Default:     stringdefault.StaticString("default"),
			Description: "Default schema name",
		},
		"username": resource_schema.StringAttribute{
			Required:    true,
			Description: "Username for Postgres/Redshift/AlloyDB",
		},
		"password": resource_schema.StringAttribute{
			Optional:    true,
			Sensitive:   true,
			Description: "Password for Postgres/Redshift/AlloyDB",
		},
		"num_threads": resource_schema.Int64Attribute{
			Optional:    true,
			Computed:    true,
			Default:     int64default.StaticInt64(0),
			Description: "Number of threads to use (required for Redshift)",
		},
		"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 Postgres credential for the Semantic Layer.",
			Computed:    true,
			Default:     booldefault.StaticBool(false),
			PlanModifiers: []planmodifier.Bool{
				boolplanmodifier.UseStateForUnknown(),
			},
		},
	},
}

Functions

func PostgresCredentialDataSource

func PostgresCredentialDataSource() datasource.DataSource

func PostgresCredentialResource

func PostgresCredentialResource() resource.Resource

Types

type PostgresCredentialDataSourceModel

type PostgresCredentialDataSourceModel struct {
	ID            types.String `tfsdk:"id"`
	ProjectID     types.Int64  `tfsdk:"project_id"`
	CredentialID  types.Int64  `tfsdk:"credential_id"`
	IsActive      types.Bool   `tfsdk:"is_active"`
	DefaultSchema types.String `tfsdk:"default_schema"`
	Username      types.String `tfsdk:"username"`
	NumThreads    types.Int64  `tfsdk:"num_threads"`
}

type PostgresCredentialResourceModel

type PostgresCredentialResourceModel struct {
	ID                      types.String `tfsdk:"id"`
	ProjectID               types.Int64  `tfsdk:"project_id"`
	CredentialID            types.Int64  `tfsdk:"credential_id"`
	IsActive                types.Bool   `tfsdk:"is_active"`
	DefaultSchema           types.String `tfsdk:"default_schema"`
	Username                types.String `tfsdk:"username"`
	NumThreads              types.Int64  `tfsdk:"num_threads"`
	Type                    types.String `tfsdk:"type"`
	TargetName              types.String `tfsdk:"target_name"`
	Password                types.String `tfsdk:"password"`
	SemanticLayerCredential types.Bool   `tfsdk:"semantic_layer_credential"`
}

Jump to

Keyboard shortcuts

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