provider

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CockroachAPIKey string = "COCKROACH_API_KEY"
	APIServerURLKey string = "COCKROACH_SERVER"
	UserAgent       string = "terraform-provider-cockroach"
)

Variables

View Source
var DownloadClusterCert = func(cluster *client.Cluster, diags *diag.Diagnostics) []byte {
	serverURL := client.DefaultServerURL
	if value, found := os.LookupEnv(APIServerURLKey); found {
		serverURL = value
	}
	downloadURL := fmt.Sprintf("%s/clusters/%s/cert", serverURL, cluster.Id)
	httpResp, err := http.Get(downloadURL)
	if err != nil {
		diags.AddError("Couldn't download certificate", err.Error())
		return nil
	}
	certContents, err := io.ReadAll(httpResp.Body)
	if err != nil {
		diags.AddError("Error reading cert", err.Error())
		return nil
	}
	return certContents
}
View Source
var NewService = client.NewService

NewService overrides the client method for testing.

Functions

func CheckSchemaAttributesMatch added in v0.7.0

func CheckSchemaAttributesMatch(t *testing.T, rAttributes map[string]resource_schema.Attribute, dAttributes map[string]datasource_schema.Attribute)

CheckSchemaAttributesMatch is a test utility that can be used to make sure a resource's schema stays in sync with its datasource counterpart. It compares attribute names and topology, but not properties.

func HookGlobal added in v0.3.0

func HookGlobal[T any](ptr *T, val T) func()

HookGlobal sets `*ptr = val` and returns a closure for restoring `*ptr` to its original value. A runtime panic will occur if `val` is not assignable to `*ptr`.

func IsKnown added in v1.0.0

func IsKnown[T Knowable](t T) bool

IsKnown is a shortcut that checks in a value is neither null nor unknown.

func New

func New(version string) func() tf_provider.Provider

func NewAllowlistResource added in v0.4.0

func NewAllowlistResource() resource.Resource

func NewApiOidcConfigResource added in v1.3.0

func NewApiOidcConfigResource() resource.Resource

func NewCMEKResource added in v0.4.0

func NewCMEKResource() resource.Resource

func NewClientCACertResource added in v0.4.5

func NewClientCACertResource() resource.Resource

func NewClusterCertDataSource added in v0.4.1

func NewClusterCertDataSource() datasource.DataSource

func NewClusterDataSource added in v0.4.0

func NewClusterDataSource() datasource.DataSource

func NewClusterResource added in v0.4.0

func NewClusterResource() resource.Resource

func NewConnectionStringDataSource added in v0.4.1

func NewConnectionStringDataSource() datasource.DataSource

func NewDatabaseResource added in v0.4.3

func NewDatabaseResource() resource.Resource

func NewFinalizeVersionUpgradeResource added in v0.4.3

func NewFinalizeVersionUpgradeResource() resource.Resource

func NewFolderDataSource added in v1.4.0

func NewFolderDataSource() datasource.DataSource

func NewFolderResource added in v1.1.0

func NewFolderResource() resource.Resource

func NewLogExportConfigResource added in v0.4.4

func NewLogExportConfigResource() resource.Resource

func NewMaintenanceWindowResource added in v0.6.0

func NewMaintenanceWindowResource() resource.Resource

func NewMetricExportCloudWatchConfigResource added in v0.4.5

func NewMetricExportCloudWatchConfigResource() resource.Resource

func NewMetricExportDatadogConfigResource added in v0.4.5

func NewMetricExportDatadogConfigResource() resource.Resource

func NewOrganizationDataSource added in v0.4.4

func NewOrganizationDataSource() datasource.DataSource

func NewPersonUserDataSource added in v0.4.6

func NewPersonUserDataSource() datasource.DataSource

func NewPrivateEndpointConnectionResource added in v0.4.0

func NewPrivateEndpointConnectionResource() resource.Resource

func NewPrivateEndpointServicesResource added in v0.4.0

func NewPrivateEndpointServicesResource() resource.Resource

func NewPrivateEndpointTrustedOwnerResource added in v1.2.0

func NewPrivateEndpointTrustedOwnerResource() resource.Resource

func NewSQLUserResource added in v0.4.0

func NewSQLUserResource() resource.Resource

func NewUserRoleGrantResource added in v1.4.0

func NewUserRoleGrantResource() resource.Resource

func NewUserRoleGrantsResource added in v1.4.0

func NewUserRoleGrantsResource() resource.Resource

func NewVersionDeferralResource added in v0.7.0

func NewVersionDeferralResource() resource.Resource

Types

type APIErrorMessage

type APIErrorMessage struct {
	Code     int
	Message  string
	HttpCode int
}

func (*APIErrorMessage) String

func (e *APIErrorMessage) String() string

type AllowlistEntry

type AllowlistEntry struct {
	ClusterId types.String `tfsdk:"cluster_id"`
	CidrIp    types.String `tfsdk:"cidr_ip"`
	CidrMask  types.Int64  `tfsdk:"cidr_mask"`
	Ui        types.Bool   `tfsdk:"ui"`
	Sql       types.Bool   `tfsdk:"sql"`
	Name      types.String `tfsdk:"name"`
	ID        types.String `tfsdk:"id"`
}

type ApiOidcConfig added in v1.3.0

type ApiOidcConfig struct {
	ID          types.String        `tfsdk:"id"`
	Issuer      types.String        `tfsdk:"issuer"`
	Audience    types.String        `tfsdk:"audience"`
	Jwks        types.String        `tfsdk:"jwks"`
	Claim       types.String        `tfsdk:"claim"`
	IdentityMap *[]IdentityMapEntry `tfsdk:"identity_map"`
}

type CMEKKey added in v0.4.0

type CMEKKey struct {
	Status        types.String `tfsdk:"status"`
	UserMessage   types.String `tfsdk:"user_message"`
	Type          types.String `tfsdk:"type"`
	URI           types.String `tfsdk:"uri"`
	AuthPrincipal types.String `tfsdk:"auth_principal"`
	CreatedAt     types.String `tfsdk:"created_at"`
	UpdatedAt     types.String `tfsdk:"updated_at"`
}

type CMEKRegion added in v0.4.0

type CMEKRegion struct {
	Region types.String `tfsdk:"region"`
	Status types.String `tfsdk:"status"`
	Key    CMEKKey      `tfsdk:"key"`
}

type ClientCACertResourceModel added in v0.4.5

type ClientCACertResourceModel struct {
	ID          types.String `tfsdk:"id"`
	X509PemCert types.String `tfsdk:"x509_pem_cert"`
	Status      types.String `tfsdk:"status"`
}

type ClusterCMEK added in v0.4.0

type ClusterCMEK struct {
	ID                types.String `tfsdk:"id"`
	Status            types.String `tfsdk:"status"`
	Regions           []CMEKRegion `tfsdk:"regions"`
	AdditionalRegions []Region     `tfsdk:"additional_regions"`
}

type ClusterCert added in v0.4.1

type ClusterCert struct {
	ID   types.String `tfsdk:"id"`
	Cert types.String `tfsdk:"cert"`
}

type ClusterCloudWatchMetricExportConfig added in v0.4.5

type ClusterCloudWatchMetricExportConfig struct {
	ID           types.String `tfsdk:"id"`
	TargetRegion types.String `tfsdk:"target_region"`
	LogGroupName types.String `tfsdk:"log_group_name"`
	RoleArn      types.String `tfsdk:"role_arn"`
	UserMessage  types.String `tfsdk:"user_message"`
	Status       types.String `tfsdk:"status"`
}

type ClusterDatadogMetricExportConfig added in v0.4.5

type ClusterDatadogMetricExportConfig struct {
	ID          types.String `tfsdk:"id"`
	Site        types.String `tfsdk:"site"`
	ApiKey      types.String `tfsdk:"api_key"`
	UserMessage types.String `tfsdk:"user_message"`
	Status      types.String `tfsdk:"status"`
}

type ClusterLogExport added in v0.4.4

type ClusterLogExport struct {
	ID              types.String      `tfsdk:"id"`
	AuthPrincipal   types.String      `tfsdk:"auth_principal"`
	LogName         types.String      `tfsdk:"log_name"`
	Type            types.String      `tfsdk:"type"`
	Redact          types.Bool        `tfsdk:"redact"`
	Region          types.String      `tfsdk:"region"`
	Groups          *[]LogExportGroup `tfsdk:"groups"`
	Status          types.String      `tfsdk:"status"`
	UserMessage     types.String      `tfsdk:"user_message"`
	CreatedAt       types.String      `tfsdk:"created_at"`
	UpdatedAt       types.String      `tfsdk:"updated_at"`
	OmittedChannels *[]types.String   `tfsdk:"omitted_channels"`
}

type ClusterMaintenanceWindow added in v0.6.0

type ClusterMaintenanceWindow struct {
	ID             types.String `tfsdk:"id"`
	OffsetDuration types.Int64  `tfsdk:"offset_duration"`
	WindowDuration types.Int64  `tfsdk:"window_duration"`
}

type ClusterVersionDeferral added in v0.7.0

type ClusterVersionDeferral struct {
	ID             types.String `tfsdk:"id"`
	DeferralPolicy types.String `tfsdk:"deferral_policy"`
}

type CockroachCluster

type CockroachCluster struct {
	ID               types.String             `tfsdk:"id"`
	Name             types.String             `tfsdk:"name"`
	CloudProvider    types.String             `tfsdk:"cloud_provider"`
	AccountId        types.String             `tfsdk:"account_id"`
	DedicatedConfig  *DedicatedClusterConfig  `tfsdk:"dedicated"`
	ServerlessConfig *ServerlessClusterConfig `tfsdk:"serverless"`
	Regions          []Region                 `tfsdk:"regions"`
	CockroachVersion types.String             `tfsdk:"cockroach_version"`
	Plan             types.String             `tfsdk:"plan"`
	State            types.String             `tfsdk:"state"`
	CreatorId        types.String             `tfsdk:"creator_id"`
	OperationStatus  types.String             `tfsdk:"operation_status"`
	UpgradeStatus    types.String             `tfsdk:"upgrade_status"`
	ParentId         types.String             `tfsdk:"parent_id"`
}

CockroachCluster is used by the cluster resource and the cluster data source. Changes to this model should be supported by both.

type ConnectionParams added in v1.0.0

type ConnectionParams struct {
	Host     types.String `tfsdk:"host"`
	Port     types.String `tfsdk:"port"`
	Database types.String `tfsdk:"database"`
	Username types.String `tfsdk:"username"`
	Password types.String `tfsdk:"password"`
}

type ConnectionString added in v0.4.1

type ConnectionString struct {
	ID               types.String      `tfsdk:"id"`
	OS               types.String      `tfsdk:"os"`
	Database         types.String      `tfsdk:"database"`
	SqlUser          types.String      `tfsdk:"sql_user"`
	Password         types.String      `tfsdk:"password"`
	ConnectionString types.String      `tfsdk:"connection_string"`
	ConnectionParams *ConnectionParams `tfsdk:"connection_params"`
}

type Database added in v0.4.3

type Database struct {
	ClusterId  types.String `tfsdk:"cluster_id"`
	Name       types.String `tfsdk:"name"`
	ID         types.String `tfsdk:"id"`
	TableCount types.Int64  `tfsdk:"table_count"`
}

type DedicatedClusterConfig added in v0.2.0

type DedicatedClusterConfig struct {
	MachineType              types.String  `tfsdk:"machine_type"`
	NumVirtualCpus           types.Int64   `tfsdk:"num_virtual_cpus"`
	StorageGib               types.Int64   `tfsdk:"storage_gib"`
	MemoryGib                types.Float64 `tfsdk:"memory_gib"`
	DiskIops                 types.Int64   `tfsdk:"disk_iops"`
	PrivateNetworkVisibility types.Bool    `tfsdk:"private_network_visibility"`
}

type FinalizeVersionUpgrade added in v0.4.3

type FinalizeVersionUpgrade struct {
	CockroachVersion types.String `tfsdk:"cockroach_version"`
	ID               types.String `tfsdk:"id"`
}

type Folder added in v1.1.0

type Folder struct {
	ID       types.String `tfsdk:"id"`
	Name     types.String `tfsdk:"name"`
	ParentId types.String `tfsdk:"parent_id"`
}

type FolderDataSourceModel added in v1.4.0

type FolderDataSourceModel struct {
	ID       types.String `tfsdk:"id"`
	Path     types.String `tfsdk:"path"`
	Name     types.String `tfsdk:"name"`
	ParentId types.String `tfsdk:"parent_id"`
}

type IdentityMapEntry added in v1.3.0

type IdentityMapEntry struct {
	TokenIdentity types.String `tfsdk:"token_identity"`
	CcIdentity    types.String `tfsdk:"cc_identity"`
	IsRegex       types.Bool   `tfsdk:"is_regex"`
}

type Knowable added in v1.0.0

type Knowable interface {
	IsUnknown() bool
	IsNull() bool
}

type LogExportGroup added in v0.4.4

type LogExportGroup struct {
	LogName  types.String   `tfsdk:"log_name"`
	Channels []types.String `tfsdk:"channels"`
	MinLevel types.String   `tfsdk:"min_level"`
	Redact   types.Bool     `tfsdk:"redact"`
}

type Organization added in v0.4.4

type Organization struct {
	ID        types.String `tfsdk:"id"`
	Label     types.String `tfsdk:"label"`
	Name      types.String `tfsdk:"name"`
	CreatedAt types.String `tfsdk:"created_at"`
}

type PersonUser added in v0.4.6

type PersonUser struct {
	ID    types.String `tfsdk:"id"`
	Email types.String `tfsdk:"email"`
}

type PrivateEndpointConnection added in v0.3.0

type PrivateEndpointConnection struct {
	ID            types.String `tfsdk:"id"`
	RegionName    types.String `tfsdk:"region_name"`
	CloudProvider types.String `tfsdk:"cloud_provider"`
	EndpointID    types.String `tfsdk:"endpoint_id"`
	ServiceID     types.String `tfsdk:"service_id"`
	ClusterID     types.String `tfsdk:"cluster_id"`
}

type PrivateEndpointService added in v0.3.0

type PrivateEndpointService struct {
	RegionName          types.String                `tfsdk:"region_name"`
	CloudProvider       types.String                `tfsdk:"cloud_provider"`
	Status              types.String                `tfsdk:"status"`
	Name                types.String                `tfsdk:"name"`
	EndpointServiceId   types.String                `tfsdk:"endpoint_service_id"`
	AvailabilityZoneIds []types.String              `tfsdk:"availability_zone_ids"`
	Aws                 PrivateLinkServiceAWSDetail `tfsdk:"aws"`
}

type PrivateEndpointServices added in v0.3.0

type PrivateEndpointServices struct {
	ClusterID types.String `tfsdk:"cluster_id"`
	Services  types.List   `tfsdk:"services"`
	ID        types.String `tfsdk:"id"`
}

type PrivateEndpointTrustedOwner added in v1.2.0

type PrivateEndpointTrustedOwner struct {
	ID              types.String `tfsdk:"id"`
	ClusterID       types.String `tfsdk:"cluster_id"`
	OwnerID         types.String `tfsdk:"owner_id"`
	Type            types.String `tfsdk:"type"`
	ExternalOwnerID types.String `tfsdk:"external_owner_id"`
}

type PrivateLinkServiceAWSDetail added in v0.3.0

type PrivateLinkServiceAWSDetail struct {
	ServiceName         types.String   `tfsdk:"service_name"`
	ServiceId           types.String   `tfsdk:"service_id"`
	AvailabilityZoneIds []types.String `tfsdk:"availability_zone_ids"`
}

type Region

type Region struct {
	Name        types.String `tfsdk:"name"`
	SqlDns      types.String `tfsdk:"sql_dns"`
	UiDns       types.String `tfsdk:"ui_dns"`
	InternalDns types.String `tfsdk:"internal_dns"`
	NodeCount   types.Int64  `tfsdk:"node_count"`
	Primary     types.Bool   `tfsdk:"primary"`
}

type Role added in v0.4.6

type Role struct {
	RoleName     types.String `tfsdk:"role_name"`
	ResourceType types.String `tfsdk:"resource_type"`
	ResourceId   types.String `tfsdk:"resource_id"`
}

type SQLUser

type SQLUser struct {
	ClusterId types.String `tfsdk:"cluster_id"`
	Name      types.String `tfsdk:"name"`
	Password  types.String `tfsdk:"password"`
	ID        types.String `tfsdk:"id"`
}

type ServerlessClusterConfig

type ServerlessClusterConfig struct {
	SpendLimit  types.Int64  `tfsdk:"spend_limit"`
	RoutingId   types.String `tfsdk:"routing_id"`
	UsageLimits *UsageLimits `tfsdk:"usage_limits"`
}

type UsageLimits added in v0.5.0

type UsageLimits struct {
	RequestUnitLimit types.Int64 `tfsdk:"request_unit_limit"`
	StorageMibLimit  types.Int64 `tfsdk:"storage_mib_limit"`
}

type UserRoleGrant added in v1.4.0

type UserRoleGrant struct {
	UserID types.String `tfsdk:"user_id"`
	Role   Role         `tfsdk:"role"`
}

type UserRoleGrants added in v1.4.0

type UserRoleGrants struct {
	ID     types.String `tfsdk:"id"`
	UserId types.String `tfsdk:"user_id"`
	Roles  []Role       `tfsdk:"roles"`
}

Jump to

Keyboard shortcuts

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