database

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DataSourceURIDescription = `` /* 160-byte string literal not displayed */

Variables

View Source
var ResourceGrafanaSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*grafana* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "A list of CIDR blocks to allow incoming connections from.",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"grafana_settings": schema.StringAttribute{
			MarkdownDescription: "Grafana configuration settings in JSON format (`exo dbaas type show grafana --settings=grafana` for reference).",
			Optional:            true,
			Computed:            true,
		},
	},
}
View Source
var ResourceKafkaSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*kafka* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"enable_cert_auth": schema.BoolAttribute{
			MarkdownDescription: "Enable certificate-based authentication method.",
			Optional:            true,
			Computed:            true,
		},
		"enable_kafka_connect": schema.BoolAttribute{
			MarkdownDescription: "Enable Kafka Connect.",
			Optional:            true,
			Computed:            true,
		},
		"enable_kafka_rest": schema.BoolAttribute{
			MarkdownDescription: "Enable Kafka REST.",
			Optional:            true,
			Computed:            true,
		},
		"enable_sasl_auth": schema.BoolAttribute{
			MarkdownDescription: "Enable SASL-based authentication method.",
			Optional:            true,
			Computed:            true,
		},
		"enable_schema_registry": schema.BoolAttribute{
			MarkdownDescription: "Enable Schema Registry.",
			Optional:            true,
			Computed:            true,
		},
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "A list of CIDR blocks to allow incoming connections from.",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"kafka_settings": schema.StringAttribute{
			MarkdownDescription: "Kafka configuration settings in JSON format (`exo dbaas type show kafka --settings=kafka` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"kafka_connect_settings": schema.StringAttribute{
			MarkdownDescription: "Kafka Connect configuration settings in JSON format (`exo dbaas type show kafka --settings=kafka-connect` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"kafka_rest_settings": schema.StringAttribute{
			MarkdownDescription: "Kafka REST configuration settings in JSON format (`exo dbaas type show kafka --settings=kafka-rest` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"schema_registry_settings": schema.StringAttribute{
			MarkdownDescription: "Schema Registry configuration settings in JSON format (`exo dbaas type show kafka --settings=schema-registry` for reference)",
			Optional:            true,
			Computed:            true,
		},
		"version": schema.StringAttribute{
			MarkdownDescription: "Kafka major version (`exo dbaas type show kafka` for reference; may only be set at creation time).",
			Optional:            true,
			Computed:            true,
		},
	},
}
View Source
var ResourceMysqlSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*mysql* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"admin_password": schema.StringAttribute{
			MarkdownDescription: "A custom administrator account password (may only be set at creation time).",
			Optional:            true,
			Sensitive:           true,
		},
		"admin_username": schema.StringAttribute{
			MarkdownDescription: "A custom administrator account username (may only be set at creation time).",
			Optional:            true,
		},
		"backup_schedule": schema.StringAttribute{
			MarkdownDescription: "The automated backup schedule (`HH:MM`).",
			Optional:            true,
			Computed:            true,
		},
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "A list of CIDR blocks to allow incoming connections from.",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"mysql_settings": schema.StringAttribute{
			MarkdownDescription: "MySQL configuration settings in JSON format (`exo dbaas type show mysql --settings=mysql` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"version": schema.StringAttribute{
			MarkdownDescription: "MySQL major version (`exo dbaas type show mysql` for reference; may only be set at creation time).",
			Optional:            true,
			Computed:            true,
		},
	},
}
View Source
var ResourceOpensearchSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*opensearch* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"fork_from_service": schema.StringAttribute{
			MarkdownDescription: "❗ Service name",
			Optional:            true,
			PlanModifiers: []planmodifier.String{
				stringplanmodifier.RequiresReplace(),
			},
		},
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "Allow incoming connections from this list of CIDR address block, e.g. `[\"10.20.0.0/16\"]",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"keep_index_refresh_interval": schema.BoolAttribute{
			MarkdownDescription: "Aiven automation resets index.refresh_interval to default value for every index to be sure that indices are always visible to search. If it doesn't fit your case, you can disable this by setting up this flag to true.",
			Optional:            true,
		},
		"max_index_count": schema.Int64Attribute{
			MarkdownDescription: "Maximum number of indexes to keep (Minimum value is `0`)",
			Optional:            true,
		},
		"settings": schema.StringAttribute{
			MarkdownDescription: "OpenSearch-specific settings, in json. e.g.`jsonencode({thread_pool_search_size: 64})`. Use `exo x get-dbaas-settings-opensearch` to get a list of available settings.",
			Optional:            true,
			Computed:            true,
		},
		"recovery_backup_name": schema.StringAttribute{
			MarkdownDescription: "❗ Name of a backup to recover from",
			Optional:            true,
			PlanModifiers: []planmodifier.String{
				stringplanmodifier.RequiresReplace(),
			},
		},
		"version": schema.StringAttribute{
			MarkdownDescription: "❗ OpenSearch major version (`exo dbaas type show opensearch` for reference)",
			Optional:            true,
			Computed:            true,
			PlanModifiers: []planmodifier.String{
				stringplanmodifier.RequiresReplaceIfConfigured(),
			},
		},
	},
	Blocks: map[string]schema.Block{
		"index_pattern": schema.ListNestedBlock{
			MarkdownDescription: "(can be used multiple times) Allows you to create glob style patterns and set a max number of indexes matching this pattern you want to keep. Creating indexes exceeding this value will cause the oldest one to get deleted. You could for example create a pattern looking like 'logs.?' and then create index logs.1, logs.2 etc, it will delete logs.1 once you create logs.6. Do note 'logs.?' does not apply to logs.10. Note: Setting max_index_count to 0 will do nothing and the pattern gets ignored.",
			NestedObject: schema.NestedBlockObject{
				Attributes: map[string]schema.Attribute{
					"max_index_count": schema.Int64Attribute{
						MarkdownDescription: "Maximum number of indexes to keep before deleting the oldest one (Minimum value is `0`)",
						Optional:            true,
					},
					"pattern": schema.StringAttribute{
						MarkdownDescription: "fnmatch pattern",
						Optional:            true,
					},
					"sorting_algorithm": schema.StringAttribute{
						MarkdownDescription: "`alphabetical` or `creation_date`.",
						Optional:            true,
					},
				},
			},
		},
		"index_template": schema.SingleNestedBlock{
			MarkdownDescription: "Template settings for all new indexes",
			Attributes: map[string]schema.Attribute{
				"mapping_nested_objects_limit": schema.Int64Attribute{
					MarkdownDescription: "The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. (Default is 10000. Minimum value is `0`, maximum value is `100000`.)",
					Optional:            true,
				},
				"number_of_replicas": schema.Int64Attribute{
					MarkdownDescription: "The number of replicas each primary shard has. (Minimum value is `0`, maximum value is `29`)",
					Optional:            true,
				},
				"number_of_shards": schema.Int64Attribute{
					MarkdownDescription: "The number of primary shards that an index should have. (Minimum value is `1`, maximum value is `1024`.)",
					Optional:            true,
				},
			},
		},
		"dashboards": schema.SingleNestedBlock{
			MarkdownDescription: "OpenSearch Dashboards settings",
			Attributes: map[string]schema.Attribute{
				"enabled": schema.BoolAttribute{
					MarkdownDescription: "Enable or disable OpenSearch Dashboards (default: true).",
					Optional:            true,
				},
				"max_old_space_size": schema.Int64Attribute{
					MarkdownDescription: "Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. (default: 128).",
					Optional:            true,
				},
				"request_timeout": schema.Int64Attribute{
					MarkdownDescription: "Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch (default: 30000)",
					Optional:            true,
				},
			},
		},
	},
}
View Source
var ResourcePgSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*pg* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"admin_password": schema.StringAttribute{
			MarkdownDescription: "A custom administrator account password (may only be set at creation time).",
			Optional:            true,
			Sensitive:           true,
		},
		"admin_username": schema.StringAttribute{
			MarkdownDescription: "A custom administrator account username (may only be set at creation time).",
			Optional:            true,
		},
		"backup_schedule": schema.StringAttribute{
			MarkdownDescription: "The automated backup schedule (`HH:MM`).",
			Optional:            true,
			Computed:            true,
		},
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "A list of CIDR blocks to allow incoming connections from.",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"pg_settings": schema.StringAttribute{
			MarkdownDescription: "PostgreSQL configuration settings in JSON format (`exo dbaas type show pg --settings=pg` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"version": schema.StringAttribute{
			MarkdownDescription: "PostgreSQL major version (`exo dbaas type show pg` for reference; may only be set at creation time).",
			Optional:            true,
			Computed:            true,
		},
		"pgbouncer_settings": schema.StringAttribute{
			MarkdownDescription: "PgBouncer configuration settings in JSON format (`exo dbaas type show pg --settings=pgbouncer` for reference).",
			Optional:            true,
			Computed:            true,
		},
		"pglookout_settings": schema.StringAttribute{
			MarkdownDescription: "pglookout configuration settings in JSON format (`exo dbaas type show pg --settings=pglookout` for reference).",
			Optional:            true,
			Computed:            true,
		},
	},
}
View Source
var ResourceRedisSchema = schema.SingleNestedBlock{
	MarkdownDescription: "*redis* database service type specific arguments. Structure is documented below.",
	Attributes: map[string]schema.Attribute{
		"ip_filter": schema.SetAttribute{
			ElementType:         types.StringType,
			MarkdownDescription: "A list of CIDR blocks to allow incoming connections from.",
			Optional:            true,
			Computed:            true,
			Validators: []validator.Set{
				setvalidator.ValueStringsAre(validators.IsCIDRNetworkValidator{Min: 0, Max: 128}),
			},
		},
		"redis_settings": schema.StringAttribute{
			MarkdownDescription: "Redis configuration settings in JSON format (`exo dbaas type show redis --settings=redis` for reference).",
			Optional:            true,
			Computed:            true,
		},
	},
}
View Source
var (
	ServicesList = []string{
		"kafka",
		"mysql",
		"pg",
		"redis",
		"opensearch",
		"grafana",
	}
)

Functions

func NewDataSourceURI

func NewDataSourceURI() datasource.DataSource

func NewResource

func NewResource() resource.Resource

func PartialSettingsPatch added in v0.58.0

func PartialSettingsPatch(data, patch map[string]interface{})

PartialSettingsPatch updates all keys in `data` that exist in `patch`. If key from `data` is not present in `patch` then removes the key from `data`.

Types

type DataSourceURI

type DataSourceURI struct {
	// contains filtered or unexported fields
}

func (*DataSourceURI) Configure

func (*DataSourceURI) Metadata

func (*DataSourceURI) Read

func (*DataSourceURI) Schema

type DataSourceURIModel

type DataSourceURIModel struct {
	Id   types.String `tfsdk:"id"`
	Name types.String `tfsdk:"name"`
	Type types.String `tfsdk:"type"`
	URI  types.String `tfsdk:"uri"`
	Zone types.String `tfsdk:"zone"`

	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

Resource defines the DBaaS Service resource implementation.

func (*Resource) Configure

func (*Resource) Create

func (*Resource) Delete

func (*Resource) ImportState

func (*Resource) Metadata

func (*Resource) Read

func (*Resource) Schema

func (*Resource) Update

func (*Resource) UpgradeState

func (r *Resource) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader

func (*Resource) ValidateConfig

type ResourceGrafanaModel

type ResourceGrafanaModel struct {
	IpFilter types.Set    `tfsdk:"ip_filter"`
	Settings types.String `tfsdk:"grafana_settings"`
}

type ResourceKafkaModel

type ResourceKafkaModel struct {
	EnableCertAuth         types.Bool   `tfsdk:"enable_cert_auth"`
	EnableKafkaConnect     types.Bool   `tfsdk:"enable_kafka_connect"`
	EnableKafkaREST        types.Bool   `tfsdk:"enable_kafka_rest"`
	EnableSASLAuth         types.Bool   `tfsdk:"enable_sasl_auth"`
	EnableSchemaRegistry   types.Bool   `tfsdk:"enable_schema_registry"`
	IpFilter               types.Set    `tfsdk:"ip_filter"`
	Settings               types.String `tfsdk:"kafka_settings"`
	ConnectSettings        types.String `tfsdk:"kafka_connect_settings"`
	RestSettings           types.String `tfsdk:"kafka_rest_settings"`
	SchemaRegistrySettings types.String `tfsdk:"schema_registry_settings"`
	Version                types.String `tfsdk:"version"`
}

type ResourceModel

type ResourceModel struct {
	Id                    types.String `tfsdk:"id"`
	CreatedAt             types.String `tfsdk:"created_at"`
	DiskSize              types.Int64  `tfsdk:"disk_size"`
	MaintenanceDOW        types.String `tfsdk:"maintenance_dow"`
	MaintenanceTime       types.String `tfsdk:"maintenance_time"`
	Name                  types.String `tfsdk:"name"`
	NodeCPUs              types.Int64  `tfsdk:"node_cpus"`
	NodeMemory            types.Int64  `tfsdk:"node_memory"`
	Nodes                 types.Int64  `tfsdk:"nodes"`
	Plan                  types.String `tfsdk:"plan"`
	State                 types.String `tfsdk:"state"`
	CA                    types.String `tfsdk:"ca_certificate"`
	TerminationProtection types.Bool   `tfsdk:"termination_protection"`
	Type                  types.String `tfsdk:"type"`
	UpdatedAt             types.String `tfsdk:"updated_at"`
	Zone                  types.String `tfsdk:"zone"`

	Pg         *ResourcePgModel         `tfsdk:"pg"`
	Mysql      *ResourceMysqlModel      `tfsdk:"mysql"`
	Redis      *ResourceRedisModel      `tfsdk:"redis"`
	Kafka      *ResourceKafkaModel      `tfsdk:"kafka"`
	Opensearch *ResourceOpensearchModel `tfsdk:"opensearch"`
	Grafana    *ResourceGrafanaModel    `tfsdk:"grafana"`

	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

ResourceModel describes the generic DBaaS Service resource data model.

type ResourceMysqlModel

type ResourceMysqlModel struct {
	AdminPassword  types.String `tfsdk:"admin_password"`
	AdminUsername  types.String `tfsdk:"admin_username"`
	BackupSchedule types.String `tfsdk:"backup_schedule"`
	IpFilter       types.Set    `tfsdk:"ip_filter"`
	Settings       types.String `tfsdk:"mysql_settings"`
	Version        types.String `tfsdk:"version"`
}

type ResourceOpensearchDashboardsModel

type ResourceOpensearchDashboardsModel struct {
	Enabled         types.Bool  `tfsdk:"enabled"`
	MaxOldSpaceSize types.Int64 `tfsdk:"max_old_space_size"`
	RequestTimeout  types.Int64 `tfsdk:"request_timeout"`
}

type ResourceOpensearchIndexPatternsModel

type ResourceOpensearchIndexPatternsModel struct {
	MaxIndexCount    types.Int64  `tfsdk:"max_index_count"`
	Pattern          types.String `tfsdk:"pattern"`
	SortingAlgorithm types.String `tfsdk:"sorting_algorithm"`
}

type ResourceOpensearchIndexTemplateModel

type ResourceOpensearchIndexTemplateModel struct {
	MappingNestedObjectsLimit types.Int64 `tfsdk:"mapping_nested_objects_limit"`
	NumberOfReplicas          types.Int64 `tfsdk:"number_of_replicas"`
	NumberOfShards            types.Int64 `tfsdk:"number_of_shards"`
}

type ResourceOpensearchModel

type ResourceOpensearchModel struct {
	ForkFromService          types.String `tfsdk:"fork_from_service"`
	RecoveryBackupName       types.String `tfsdk:"recovery_backup_name"`
	IpFilter                 types.Set    `tfsdk:"ip_filter"`
	KeepIndexRefreshInterval types.Bool   `tfsdk:"keep_index_refresh_interval"`
	MaxIndexCount            types.Int64  `tfsdk:"max_index_count"`
	Settings                 types.String `tfsdk:"settings"`
	Version                  types.String `tfsdk:"version"`

	IndexPatterns []ResourceOpensearchIndexPatternsModel `tfsdk:"index_pattern"`
	IndexTemplate *ResourceOpensearchIndexTemplateModel  `tfsdk:"index_template"`
	Dashboards    *ResourceOpensearchDashboardsModel     `tfsdk:"dashboards"`
}

type ResourcePgModel

type ResourcePgModel struct {
	AdminPassword     types.String `tfsdk:"admin_password"`
	AdminUsername     types.String `tfsdk:"admin_username"`
	BackupSchedule    types.String `tfsdk:"backup_schedule"`
	IpFilter          types.Set    `tfsdk:"ip_filter"`
	Settings          types.String `tfsdk:"pg_settings"`
	Version           types.String `tfsdk:"version"`
	PgbouncerSettings types.String `tfsdk:"pgbouncer_settings"`
	PglookoutSettings types.String `tfsdk:"pglookout_settings"`
}

type ResourceRedisModel

type ResourceRedisModel struct {
	IpFilter types.Set    `tfsdk:"ip_filter"`
	Settings types.String `tfsdk:"redis_settings"`
}

Jump to

Keyboard shortcuts

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