Skip to content

Commit

Permalink
change terraform provider version
Browse files Browse the repository at this point in the history
  • Loading branch information
RaynorChavez committed Jul 21, 2024
1 parent 0ef5aa5 commit 29fd7d2
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 59 deletions.
9 changes: 9 additions & 0 deletions docs/data-sources/read_indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Read-Only:
- `docs_count` (String) The number of documents in the index
- `docs_deleted` (String) The number of documents deleted from the index
- `filter_string_max_length` (String) The filter string max length
- `image_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--items--image_preprocessing))
- `index_name` (String) The name of the index
- `index_status` (String) The status of the index
- `inference_type` (String) The type of inference used by the index
Expand Down Expand Up @@ -86,6 +87,14 @@ Read-Only:



<a id="nestedatt--items--image_preprocessing"></a>
### Nested Schema for `items.image_preprocessing`

Read-Only:

- `patch_method` (String) The patch method for image preprocessing


<a id="nestedatt--items--text_preprocessing"></a>
### Nested Schema for `items.text_preprocessing`

Expand Down
23 changes: 13 additions & 10 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,38 @@ description: |-

Required:

- `type` (String)

Optional:

- `all_fields` (Attributes List) (see [below for nested schema](#nestedatt--settings--all_fields))
- `ann_parameters` (Attributes) (see [below for nested schema](#nestedatt--settings--ann_parameters))
- `filter_string_max_length` (Number)
- `image_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--image_preprocessing))
- `inference_type` (String)
- `model` (String)
- `normalize_embeddings` (Boolean)
- `number_of_inferences` (Number)
- `number_of_replicas` (Number)
- `number_of_shards` (Number)
- `storage_class` (String)
- `tensor_fields` (List of String)
- `type` (String)

Optional:

- `ann_parameters` (Attributes) (see [below for nested schema](#nestedatt--settings--ann_parameters))
- `filter_string_max_length` (Number)
- `image_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--image_preprocessing))
- `normalize_embeddings` (Boolean)
- `text_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--text_preprocessing))
- `treat_urls_and_pointers_as_images` (Boolean)
- `vector_numeric_type` (String)

<a id="nestedatt--settings--all_fields"></a>
### Nested Schema for `settings.all_fields`

Required:

- `name` (String)
- `type` (String)

Optional:

- `dependent_fields` (Map of Number)
- `features` (List of String)
- `name` (String)
- `type` (String)


<a id="nestedatt--settings--ann_parameters"></a>
Expand Down
1 change: 0 additions & 1 deletion examples/create_index/create_index.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
terraform {
required_providers {
marqo-terraform = {
#source = "registry.terraform.io/marqo/marqo"
source = "registry.terraform.io/marqo/marqo-terraform"
}
}
Expand Down
6 changes: 5 additions & 1 deletion examples/create_structured_index/create_dependent.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider "marqo-terraform" {
}

resource "marqo-terraform_index" "example" {
index_name = "example_index_dependent"
index_name = "example_index_dependent_1"
settings = {
type = "structured"
vector_numeric_type = "float"
Expand All @@ -28,6 +28,10 @@ resource "marqo-terraform_index" "example" {
},
},
],
number_of_inferences = 1
storage_class = "marqo.basic"
number_of_replicas = 0
number_of_shards = 2
tensor_fields = ["multimodal_field"],
model = "open_clip/ViT-L-14/laion2b_s32b_b82k"
normalize_embeddings = true
Expand Down
65 changes: 38 additions & 27 deletions internal/provider/indices_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"marqo-terraform/go_marqo"
"time"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -32,31 +33,31 @@ type allIndicesResourceModel struct {

// indexModel maps index detail data.
type indexModel struct {
Created types.String `tfsdk:"created"`
IndexName types.String `tfsdk:"index_name"`
NumberOfShards types.String `tfsdk:"number_of_shards"`
NumberOfReplicas types.String `tfsdk:"number_of_replicas"`
IndexStatus types.String `tfsdk:"index_status"`
AllFields []AllFieldInput `tfsdk:"all_fields"`
TensorFields []string `tfsdk:"tensor_fields"`
NumberOfInferences types.String `tfsdk:"number_of_inferences"`
StorageClass types.String `tfsdk:"storage_class"`
InferenceType types.String `tfsdk:"inference_type"`
DocsCount types.String `tfsdk:"docs_count"`
StoreSize types.String `tfsdk:"store_size"`
DocsDeleted types.String `tfsdk:"docs_deleted"`
SearchQueryTotal types.String `tfsdk:"search_query_total"`
TreatUrlsAndPointersAsImages types.Bool `tfsdk:"treat_urls_and_pointers_as_images"`
MarqoEndpoint types.String `tfsdk:"marqo_endpoint"`
Type types.String `tfsdk:"type"`
VectorNumericType types.String `tfsdk:"vector_numeric_type"`
Model types.String `tfsdk:"model"`
NormalizeEmbeddings types.Bool `tfsdk:"normalize_embeddings"`
TextPreprocessing TextPreprocessingModel `tfsdk:"text_preprocessing"` // Assuming no specific structure
//ImagePreprocessing types.Object `tfsdk:"image_preprocessing"` // Assuming no specific structure
AnnParameters AnnParametersModel `tfsdk:"ann_parameters"` // Assuming no specific structure
MarqoVersion types.String `tfsdk:"marqo_version"`
FilterStringMaxLength types.String `tfsdk:"filter_string_max_length"`
Created types.String `tfsdk:"created"`
IndexName types.String `tfsdk:"index_name"`
NumberOfShards types.String `tfsdk:"number_of_shards"`
NumberOfReplicas types.String `tfsdk:"number_of_replicas"`
IndexStatus types.String `tfsdk:"index_status"`
AllFields []AllFieldInput `tfsdk:"all_fields"`
TensorFields []string `tfsdk:"tensor_fields"`
NumberOfInferences types.String `tfsdk:"number_of_inferences"`
StorageClass types.String `tfsdk:"storage_class"`
InferenceType types.String `tfsdk:"inference_type"`
DocsCount types.String `tfsdk:"docs_count"`
StoreSize types.String `tfsdk:"store_size"`
DocsDeleted types.String `tfsdk:"docs_deleted"`
SearchQueryTotal types.String `tfsdk:"search_query_total"`
TreatUrlsAndPointersAsImages types.Bool `tfsdk:"treat_urls_and_pointers_as_images"`
MarqoEndpoint types.String `tfsdk:"marqo_endpoint"`
Type types.String `tfsdk:"type"`
VectorNumericType types.String `tfsdk:"vector_numeric_type"`
Model types.String `tfsdk:"model"`
NormalizeEmbeddings types.Bool `tfsdk:"normalize_embeddings"`
TextPreprocessing TextPreprocessingModel `tfsdk:"text_preprocessing"`
ImagePreprocessing ImagePreprocessingModel `tfsdk:"image_preprocessing"`
AnnParameters AnnParametersModel `tfsdk:"ann_parameters"`
MarqoVersion types.String `tfsdk:"marqo_version"`
FilterStringMaxLength types.String `tfsdk:"filter_string_max_length"`
}

type TextPreprocessingModel struct {
Expand Down Expand Up @@ -112,8 +113,7 @@ func (d *indicesDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Required: true,
//Computed: true,
Required: true,
Description: "The unique identifier for the resource.",
},
"last_updated": schema.StringAttribute{
Expand Down Expand Up @@ -243,6 +243,15 @@ func (d *indicesDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
},
},
},
"image_preprocessing": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"patch_method": schema.StringAttribute{
Computed: true,
Description: "The patch method for image preprocessing",
},
},
},
"ann_parameters": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
Expand Down Expand Up @@ -387,6 +396,8 @@ func (d *indicesDataSource) Read(ctx context.Context, req datasource.ReadRequest
}
}

// Set the last_updated field
model.LastUpdated = types.StringValue(time.Now().Format(time.RFC3339))
model.Items = items
resp.Diagnostics.Append(resp.State.Set(ctx, &model)...)
}
20 changes: 10 additions & 10 deletions internal/provider/indices_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ func (r *indicesResource) Schema(_ context.Context, _ resource.SchemaRequest, re
Optional: true,
},
"number_of_inferences": schema.Int64Attribute{
Optional: true,
Required: true,
},
"all_fields": schema.ListNestedAttribute{
Optional: true,
Required: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{Optional: true},
"type": schema.StringAttribute{Optional: true},
"name": schema.StringAttribute{Required: true},
"type": schema.StringAttribute{Required: true},
"features": schema.ListAttribute{
Optional: true,
ElementType: types.StringType,
Expand All @@ -152,27 +152,27 @@ func (r *indicesResource) Schema(_ context.Context, _ resource.SchemaRequest, re
},
},
"tensor_fields": schema.ListAttribute{
Optional: true,
Required: true,
ElementType: types.StringType,
},

"inference_type": schema.StringAttribute{
Optional: true,
Required: true,
},
"storage_class": schema.StringAttribute{
Optional: true,
Required: true,
},
"number_of_shards": schema.Int64Attribute{
Optional: true,
Required: true,
},
"number_of_replicas": schema.Int64Attribute{
Optional: true,
Required: true,
},
"treat_urls_and_pointers_as_images": schema.BoolAttribute{
Optional: true,
},
"model": schema.StringAttribute{
Optional: true,
Required: true,
},
"normalize_embeddings": schema.BoolAttribute{
Optional: true,
Expand Down
12 changes: 2 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package main

import (
Expand All @@ -26,7 +23,7 @@ import (
var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary.
version string = "dev"
version string = "1.0.0"

// goreleaser can pass other information to the main package, such as the specific commit
// https://goreleaser.com/cookbooks/using-main.version/
Expand All @@ -39,12 +36,7 @@ func main() {
flag.Parse()

opts := providerserver.ServeOpts{
// NOTE: This is not a typical Terraform Registry provider address,
// such as registry.terraform.io/hashicorp/hashicups. This specific
// provider address is used in these tutorials in conjunction with a
// specific Terraform CLI configuration for manual development testing
// of this provider.
Address: "registry.terraform.io/marqo/marqo",
Address: "registry.terraform.io/marqo/marqo-terraform",
Debug: debug,
}

Expand Down
Binary file removed terraform-provider-marqo-terraform
Binary file not shown.

0 comments on commit 29fd7d2

Please sign in to comment.