$ terraform init --upgrade
Initializing the backend...
Initializing provider plugins...
- Finding latest version of tensorchord/pgvecto-rs-cloud...
- Installing tensorchord/pgvecto-rs-cloud v0.0.6...
- Installed tensorchord/pgvecto-rs-cloud v0.0.6 (self-signed, key ID ABEFCD2BB128AAB1)Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
resource "pgvecto-rs-cloud_cluster""enterprise_plan_cluster"{account_id="58aa09d9-854c-4223-9920-b85b9d878e72"cluster_name="enterprise-plan-cluster"plan="Starter"server_resource="aws-t3-xlarge-4c-16g" // The only server resource supported by the Starter plan, shared environment
region="us-east-1"cluster_provider="aws"database_name="test"pg_data_disk_size="10"enable_pooler=true}output "psql_endpoint_enterprise"{description="Endpoint for the PGVecto.rs Cloud Starter PostgreSQL database"value= pgvecto-rs-cloud_cluster.enterprise_plan_cluster.connect_endpoint
}
你可以按以下步骤验证 Terraform 代码:
$ terraform validate && terraform plan && terraform output
Success! The configuration is valid.
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# pgvecto-rs-cloud_cluster.enterprise_plan_cluster will be created + resource "pgvecto-rs-cloud_cluster""enterprise_plan_cluster"{ + account_id="58aa09d9-854c-4223-9920-b85b9d878e72" + cluster_name="enterprise-plan-cluster" + cluster_provider="aws" + connect_endpoint=(known after apply) + database_name="test" + enable_pooler=true + id=(known after apply) + last_updated=(known after apply) + pg_data_disk_size="10" + plan="Starter" + region="us-east-1" + server_resource="aws-t3-xlarge-4c-16g" + status=(known after apply)}Plan: 1 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ psql_endpoint_enterprise=(known after apply)─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
╷
│ Warning: No outputs found
│
│ The state file either has no outputs defined, or all the defined outputs are empty. Please define an output in your configuration with the `output` keyword and run `terraform refresh`for it to become available. If you are using
│ interpolation, please verify the interpolated value is not empty. You can use the `terraform console`command to assist.
$ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# pgvecto-rs-cloud_cluster.enterprise_plan_cluster will be created + resource "pgvecto-rs-cloud_cluster""enterprise_plan_cluster"{ + account_id="58aa09d9-854c-4223-9920-b85b9d878e72" + cluster_name="enterprise-plan-cluster" + cluster_provider="aws" + connect_endpoint=(known after apply) + database_name="test" + enable_pooler=true + id=(known after apply) + last_updated=(known after apply) + pg_data_disk_size="10" + plan="Starter" + region="us-east-1" + server_resource="aws-t3-xlarge-4c-16g" + status=(known after apply)}Plan: 1 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ psql_endpoint_enterprise=(known after apply)Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Creating...
pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [10s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [20s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [30s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [40s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [50s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m0s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m10s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m20s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m30s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m40s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [1m50s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [2m0s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Still creating... [2m10s elapsed]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Creation complete after 2m18s [id=ee6d7049-78c4-4776-8e2a-25dd5970007d]Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Outputs:
psql_endpoint_enterprise="postgres://test_user:fC5PHTFaflwK@enterprise-plan-cluster-jeyahasdf1r957q4.pooler.us-east-1.aws.pgvecto.rs:5432/test?sslmode=require"
$ psql 'postgres://test_user:fC5PHTFaflwK@enterprise-plan-cluster-unn3o7zyzdkrrxpe.us-east-1.aws.pgvecto.rs:5432/test?sslmode=require'psql (15.3, server 16.3 (Debian 16.3-1.pgdg110+1))WARNING: psql major version 15, server major version 16.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)Type "help"for help.
test=> \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+----------------------------------------------------------------------------------------------
pgaudit | 16.0 | public | provides auditing functionality
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
vectors | 0.3.0 | vectors | vectors: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
(3 rows)test=> CREATE TABLE test(id integer PRIMARY KEY, embedding vector(3) NOT NULL);CREATE TABLE
test=> INSERT INTO test SELECT i, ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 100) i;INSERT 0100test=> CREATE INDEX ON test USING vectors (embedding vector_l2_ops) WITH (options="[indexing.hnsw]");CREATE INDEX
test=> SELECT * FROM test ORDER BY embedding <-> '[0.40671515, 0.24202824, 0.37059402]' LIMIT 10; id | embedding
----+--------------------------------------
58|[0.37351534, 0.13275076, 0.43973163]66|[0.22059213, 0.27068633, 0.22881117]10|[0.26735276, 0.39847502, 0.20896937]72|[0.23406255, 0.4242782, 0.27623454]65|[0.4541286, 0.48433396, 0.48011246]80|[0.6192282, 0.14963196, 0.5095764]47|[0.48413, 0.46047017, 0.21654463]97|[0.445769, 0.27853656, 0.6808209]25|[0.1864713, 0.015588521, 0.3540618]63|[0.26299608, 0.0640332, 0.5937908](10 rows)
$ terraform destroy
pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Refreshing state... [id=ee6d7049-78c4-4776-8e2a-25dd5970007d]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# pgvecto-rs-cloud_cluster.enterprise_plan_cluster will be destroyed - resource "pgvecto-rs-cloud_cluster""enterprise_plan_cluster"{ - account_id="58aa09d9-854c-4223-9920-b85b9d878e72" -> null
- cluster_name="enterprise-plan-cluster" -> null
- cluster_provider="aws" -> null
- connect_endpoint="postgres://test_user:fC5PHTFaflwK@enterprise-plan-cluster-jeyahasdf1r957q4.pooler.us-east-1.aws.pgvecto.rs:5432/test?sslmode=require" -> null
- database_name="test" -> null
- enable_pooler=true -> null
- id="ee6d7049-78c4-4776-8e2a-25dd5970007d" -> null
- last_updated="Tuesday, 23-Jul-24 00:52:55 UTC" -> null
- pg_data_disk_size="10" -> null
- plan="Starter" -> null
- region="us-east-1" -> null
- server_resource="aws-t3-xlarge-4c-16g" -> null
- status="Ready" -> null
}Plan: 0 to add, 0 to change, 1 to destroy.
Changes to Outputs:
- psql_endpoint_enterprise="postgres://test_user:fC5PHTFaflwK@enterprise-plan-cluster-jeyahasdf1r957q4.pooler.us-east-1.aws.pgvecto.rs:5432/test?sslmode=require" -> null
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Destroying... [id=ee6d7049-78c4-4776-8e2a-25dd5970007d]pgvecto-rs-cloud_cluster.enterprise_plan_cluster: Destruction complete after 1s
Destroy complete! Resources: 1 destroyed.