From 04a556c34411f3be0ae8b7d9cba3f4f16d9953db Mon Sep 17 00:00:00 2001 From: Bobby Iliev Date: Wed, 25 Oct 2023 15:04:03 +0300 Subject: [PATCH] Revert to unprefixed names in the schema --- README.md | 10 +++++----- docs/index.md | 20 ++++++++++---------- examples/provider/provider.tf | 10 +++++----- integration/main.tf | 14 +++++++------- pkg/provider/provider.go | 28 ++++++++++++++-------------- templates/index.md.tmpl | 10 +++++----- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 2d256dbc..094f43da 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,11 @@ Configure the provider by adding the following block to your Terraform project: ```hcl provider "materialize" { - mz_host = "materialized_hostname" - mz_username = "materialize_username" - mz_password = "materialize_password" - mz_port = 6875 - mz_database = "materialize" + host = "materialized_hostname" + username = "materialize_username" + password = "materialize_password" + port = 6875 + database = "materialize" } ``` diff --git a/docs/index.md b/docs/index.md index 5ae90ad7..ca14323b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -14,21 +14,21 @@ Configure the provider by adding the following block to your Terraform project: ```terraform # Configuration-based authentication provider "materialize" { - mz_host = var.materialize_hostname # optionally use MZ_HOST env var - mz_username = var.materialize_username # optionally use MZ_USERNAME env var - mz_password = var.materialize_password # optionally use MZ_PASSWORD env var - mz_port = var.materialize_port # optionally use MZ_PORT env var - mz_database = var.materialize_database # optionally use MZ_DATABASE env var + host = var.materialize_hostname # optionally use MZ_HOST env var + username = var.materialize_username # optionally use MZ_USERNAME env var + password = var.materialize_password # optionally use MZ_PASSWORD env var + port = var.materialize_port # optionally use MZ_PORT env var + database = var.materialize_database # optionally use MZ_DATABASE env var } ``` ## Schema -* `mz_host` (String) Materialize host. Can also come from the `MZ_HOST` environment variable. -* `mz_username` (String) Materialize username. Can also come from the `MZ_USERNAME` environment variable. -* `mz_password` (String, Sensitive) Materialize host. Can also come from the `MZ_PASSWORD` environment variable. -* `mz_port` (Number) The Materialize port number to connect to at the server host. Can also come from the `MZ_PORT` environment variable. Defaults to 6875. -* `mz_database` (String) The Materialize database. Can also come from the `MZ_DATABASE` environment variable. Defaults to `materialize`. +* `host` (String) Materialize host. Can also come from the `MZ_HOST` environment variable. +* `username` (String) Materialize username. Can also come from the `MZ_USERNAME` environment variable. +* `password` (String, Sensitive) Materialize host. Can also come from the `MZ_PASSWORD` environment variable. +* `port` (Number) The Materialize port number to connect to at the server host. Can also come from the `MZ_PORT` environment variable. Defaults to 6875. +* `database` (String) The Materialize database. Can also come from the `MZ_DATABASE` environment variable. Defaults to `materialize`. ## Order precedence diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 7f416260..9c010fa6 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,8 +1,8 @@ # Configuration-based authentication provider "materialize" { - mz_host = var.materialize_hostname # optionally use MZ_HOST env var - mz_username = var.materialize_username # optionally use MZ_USERNAME env var - mz_password = var.materialize_password # optionally use MZ_PASSWORD env var - mz_port = var.materialize_port # optionally use MZ_PORT env var - mz_database = var.materialize_database # optionally use MZ_DATABASE env var + host = var.materialize_hostname # optionally use MZ_HOST env var + username = var.materialize_username # optionally use MZ_USERNAME env var + password = var.materialize_password # optionally use MZ_PASSWORD env var + port = var.materialize_port # optionally use MZ_PORT env var + database = var.materialize_database # optionally use MZ_DATABASE env var } diff --git a/integration/main.tf b/integration/main.tf index d5533eda..9c9ff0b1 100644 --- a/integration/main.tf +++ b/integration/main.tf @@ -7,11 +7,11 @@ terraform { } provider "materialize" { - mz_host = "materialized" - mz_username = "mz_system" - mz_password = "password" - mz_port = 6877 - mz_database = "materialize" - mz_sslmode = false - mz_preview_features = true + host = "materialized" + username = "mz_system" + password = "password" + port = 6877 + database = "materialize" + sslmode = false + preview_features = true } diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index b07cb668..40b1c4a0 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -17,32 +17,32 @@ import ( func Provider() *schema.Provider { return &schema.Provider{ Schema: map[string]*schema.Schema{ - "mz_host": { + "host": { Type: schema.TypeString, Optional: true, Description: "Materialize host. Can also come from the `MZ_HOST` environment variable.", DefaultFunc: schema.EnvDefaultFunc("MZ_HOST", nil), }, - "mz_username": { + "username": { Type: schema.TypeString, Optional: true, Description: "Materialize username. Can also come from the `MZ_USERNAME` environment variable.", DefaultFunc: schema.EnvDefaultFunc("MZ_USERNAME", nil), }, - "mz_password": { + "password": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "Materialize host. Can also come from the `MZ_PASSWORD` environment variable.", DefaultFunc: schema.EnvDefaultFunc("MZ_PASSWORD", nil), }, - "mz_port": { + "port": { Type: schema.TypeInt, Optional: true, Description: "The Materialize port number to connect to at the server host. Can also come from the `MZ_PORT` environment variable. Defaults to 6875.", DefaultFunc: schema.EnvDefaultFunc("MZ_PORT", 6875), }, - "mz_database": { + "database": { Type: schema.TypeString, Optional: true, Description: "The Materialize database. Can also come from the `MZ_DATABASE` environment variable. Defaults to `materialize`.", @@ -54,13 +54,13 @@ func Provider() *schema.Provider { Default: "terraform-provider-materialize", Description: "The application name to include in the connection string", }, - "mz_sslmode": { + "sslmode": { Type: schema.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("MZ_SSLMODE", true), Description: "For testing purposes, disable SSL.", }, - "mz_preview_features": { + "preview_features": { Type: schema.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("MZ_PREVIEW_FEATURES", false), @@ -152,14 +152,14 @@ func connectionString(host, username, password string, port int, database string } func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - host := d.Get("mz_host").(string) - username := d.Get("mz_username").(string) - password := d.Get("mz_password").(string) - port := d.Get("mz_port").(int) - database := d.Get("mz_database").(string) + host := d.Get("host").(string) + username := d.Get("username").(string) + password := d.Get("password").(string) + port := d.Get("port").(int) + database := d.Get("database").(string) application := d.Get("application_name").(string) - sslmode := d.Get("mz_sslmode").(bool) - preview_features := d.Get("mz_preview_features").(bool) + sslmode := d.Get("sslmode").(bool) + preview_features := d.Get("preview_features").(bool) connStr := connectionString(host, username, password, port, database, sslmode, preview_features, application) diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 614e740f..70a43bca 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -15,11 +15,11 @@ Configure the provider by adding the following block to your Terraform project: ## Schema -* `mz_host` (String) Materialize host. Can also come from the `MZ_HOST` environment variable. -* `mz_username` (String) Materialize username. Can also come from the `MZ_USERNAME` environment variable. -* `mz_password` (String, Sensitive) Materialize host. Can also come from the `MZ_PASSWORD` environment variable. -* `mz_port` (Number) The Materialize port number to connect to at the server host. Can also come from the `MZ_PORT` environment variable. Defaults to 6875. -* `mz_database` (String) The Materialize database. Can also come from the `MZ_DATABASE` environment variable. Defaults to `materialize`. +* `host` (String) Materialize host. Can also come from the `MZ_HOST` environment variable. +* `username` (String) Materialize username. Can also come from the `MZ_USERNAME` environment variable. +* `password` (String, Sensitive) Materialize host. Can also come from the `MZ_PASSWORD` environment variable. +* `port` (Number) The Materialize port number to connect to at the server host. Can also come from the `MZ_PORT` environment variable. Defaults to 6875. +* `database` (String) The Materialize database. Can also come from the `MZ_DATABASE` environment variable. Defaults to `materialize`. ## Order precedence