Skip to content

Commit

Permalink
Revert to unprefixed names in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyiliev committed Oct 25, 2023
1 parent f77f31d commit 04a556c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
```

Expand Down
20 changes: 10 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -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
}
14 changes: 7 additions & 7 deletions integration/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
28 changes: 14 additions & 14 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`.",
Expand All @@ -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),
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions templates/index.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 04a556c

Please sign in to comment.