diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index fadf68ae..e3186f73 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -19,9 +19,8 @@ jobs: run: make testacc env: MZ_HOST: localhost - MZ_USERNAME: mz_system + MZ_USER: mz_system MZ_SSLMODE: "false" - MZ_PREVIEW_FEATURES: "true" MZ_PORT: 6877 - name: Docker Compose Down diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64c29c23..91f7e915 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,9 +41,8 @@ To run the acceptance tests which will simulate running Terraform commands you w ```bash export MZ_HOST=localhost -export MZ_USERNAME=mz_system +export MZ_USER=mz_system export MZ_SSLMODE="false" -export MZ_PREVIEW_FEATURES="true" export MZ_PORT=6877 # Start all containers diff --git a/docs/index.md b/docs/index.md index ca14323b..77197d31 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,7 +15,7 @@ Configure the provider by adding the following block to your Terraform project: # Configuration-based authentication provider "materialize" { host = var.materialize_hostname # optionally use MZ_HOST env var - username = var.materialize_username # optionally use MZ_USERNAME env var + user = var.materialize_user # optionally use MZ_USER 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 @@ -25,7 +25,7 @@ provider "materialize" { ## Schema * `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. +* `user` (String) Materialize user. Can also come from the `MZ_USER` 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`. diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 9c010fa6..e2d0e95b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,7 +1,7 @@ # Configuration-based authentication provider "materialize" { - host = var.materialize_hostname # optionally use MZ_HOST env var - username = var.materialize_username # optionally use MZ_USERNAME env var + host = var.materialize_host # optionally use MZ_HOST env var + user = var.materialize_user # optionally use MZ_USER 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 45c3b72c..09c2e505 100644 --- a/integration/main.tf +++ b/integration/main.tf @@ -8,7 +8,7 @@ terraform { provider "materialize" { host = "materialized" - username = "mz_system" + user = "mz_system" password = "password" port = 6877 database = "materialize" diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index c2f94a04..d6c87ca2 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -23,11 +23,11 @@ func Provider() *schema.Provider { Description: "Materialize host. Can also come from the `MZ_HOST` environment variable.", DefaultFunc: schema.EnvDefaultFunc("MZ_HOST", nil), }, - "username": { + "user": { Type: schema.TypeString, Optional: true, - Description: "Materialize username. Can also come from the `MZ_USERNAME` environment variable.", - DefaultFunc: schema.EnvDefaultFunc("MZ_USERNAME", nil), + Description: "Materialize user. Can also come from the `MZ_USER` environment variable.", + DefaultFunc: schema.EnvDefaultFunc("MZ_USER", nil), }, "password": { Type: schema.TypeString, @@ -126,9 +126,9 @@ func Provider() *schema.Provider { } } -func connectionString(host, username, password string, port int, database string, sslmode bool, application string) string { +func connectionString(host, user, password string, port int, database string, sslmode bool, application string) string { c := strings.Builder{} - c.WriteString(fmt.Sprintf("postgres://%s:%s@%s:%d/%s", username, password, host, port, database)) + c.WriteString(fmt.Sprintf("postgres://%s:%s@%s:%d/%s", user, password, host, port, database)) params := []string{} @@ -147,14 +147,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("host").(string) - username := d.Get("username").(string) + user := d.Get("user").(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("sslmode").(bool) - connStr := connectionString(host, username, password, port, database, sslmode, application) + connStr := connectionString(host, user, password, port, database, sslmode, application) var diags diag.Diagnostics db, err := sqlx.Open("pgx", connStr) diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 70a43bca..a84bbbc6 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -16,7 +16,7 @@ Configure the provider by adding the following block to your Terraform project: ## Schema * `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. +* `user` (String) Materialize user. Can also come from the `MZ_USER` 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`.