diff --git a/vertex_ai/index_endpoint/main.tf b/vertex_ai/index_endpoint/main.tf new file mode 100644 index 000000000..b0b1eec82 --- /dev/null +++ b/vertex_ai/index_endpoint/main.tf @@ -0,0 +1,77 @@ +/** + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +# [START aiplatform_create_index_endpoint_sample] +resource "google_vertex_ai_index_endpoint" "default" { + display_name = "sample-endpoint" + description = "A sample index endpoint with a public endpoint" + region = "us-central1" + public_endpoint_enabled = true +} + +# Cloud Storage bucket name must be unique +resource "random_id" "default" { + byte_length = 8 +} + +# Create a Cloud Storage bucket +resource "google_storage_bucket" "bucket" { + name = "vertex-ai-index-bucket-${random_id.default.hex}" + location = "us-central1" + uniform_bucket_level_access = true +} + +# Create index content +resource "google_storage_bucket_object" "data" { + name = "contents/data.json" + bucket = google_storage_bucket.bucket.name + content = <