From c9ae4a8713bcc2c3bcd1e0c33c5b2c9d65df3d8c Mon Sep 17 00:00:00 2001 From: Warren Parad Date: Mon, 27 Feb 2023 23:13:21 +0100 Subject: [PATCH] Update reporting errors. --- README.md | 8 +++++--- development-examples/main.tf | 23 ++++++++++++++++++++--- docs/index.md | 2 +- src/provider.go | 10 ++++------ src/provider_test.go | 2 +- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c89df14..312ea8f 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,14 @@ terraform { required_providers { authress = { source = "authress/authress" - - # Specify your Authress custom domain, configured at https://authress.io/app/#/settings?focus=domain - custom_domain = "https://login.example.com" } } } + +provider "authress" { + # Specify your Authress custom domain, configured at https://authress.io/app/#/settings?focus=domain + custom_domain = "https://login.example.com" +} ``` diff --git a/development-examples/main.tf b/development-examples/main.tf index b317019..d7c96c2 100644 --- a/development-examples/main.tf +++ b/development-examples/main.tf @@ -1,10 +1,27 @@ terraform { required_providers { authress = { - version = "0.2" - source = "hashicorp.com/authress/authress" + version = "~> 1.0" + source = "authress/authress" } } } -provider "authress" {} +provider "authress" { + custom_domain = "https://authress-test.authress.com" +} + +# resource "authress_role" "test-100" { +# role_id = "test-1" +# name = "Terraform Test Role" +# permissions = { +# "one" = { +# "allow" = true +# } + +# "two" = { +# "allow" = true +# "grant" = true +# } +# } +# } \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 1785737..89603bf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,7 +18,7 @@ The [Authress Knowledge Base](https://authress.io/knowledge-base/docs/category/i required_providers { authress = { source = "authress/authress" - version = "0.2" + version = "~> 1.0" # Authress custom domain configuration: https://authress.io/app/#/settings?focus=domain custom_domain = "https://login.example.com" diff --git a/src/provider.go b/src/provider.go index e50fe35..1397f2e 100644 --- a/src/provider.go +++ b/src/provider.go @@ -115,9 +115,8 @@ func (p *authressProvider) Configure(ctx context.Context, req provider.Configure resp.Diagnostics.AddAttributeError( path.Root("custom_domain"), "Missing Authress API CustomDomain", - "The provider cannot create the Authress API client as there is a missing or empty value for the Authress API custom_domain. "+ - "Set the custom_domain value in the configuration or use the AUTHRESS_HOST environment variable. "+ - "If either is already set, ensure the value is not empty.", + "Cannot connect to the Authress API: Missing Authress custom_domain. " + + "Set the 'custom_domain' value by adding a terraform provider block for authress", ) } @@ -125,9 +124,8 @@ func (p *authressProvider) Configure(ctx context.Context, req provider.Configure resp.Diagnostics.AddAttributeError( path.Root("access_key"), "Missing Authress API Access Key", - "The provider cannot create the Authress API client as there is a missing or empty value for the Authress API access_key. "+ - "Set the password value in the configuration or use the AUTHRESS_PASSWORD environment variable. "+ - "If either is already set, ensure the value is not empty.", + "Cannot connect to the Authress API: Missing Authress Access Key. "+ + "Set the 'access_key' value by running the CI/CD Automation https://authress.io/knowledge-base/docs/category/cicd, or adding a terraform provider block for authress", ) } diff --git a/src/provider_test.go b/src/provider_test.go index c3c4e44..3ada9cf 100644 --- a/src/provider_test.go +++ b/src/provider_test.go @@ -9,7 +9,7 @@ const ( // providerConfig is a shared configuration to combine with the actual test configuration so the Authress client is properly configured. providerConfig = ` provider "authress" { - custom_domain = "https://test-domain.api-eu-west.authress.io" + custom_domain = "https://authress-test.authress.com" }`) var (