Skip to content

Commit

Permalink
The credentials should not be mandatory, for local use for example
Browse files Browse the repository at this point in the history
  • Loading branch information
arkiaconsulting committed Jun 20, 2021
1 parent 6e3c393 commit b885d59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ HOSTNAME=github.com
NAMESPACE=arkiaconsulting
NAME=schemaregistry
BINARY=terraform-provider-${NAME}
VERSION=0.3
VERSION=0.6
OS_ARCH=linux_amd64

default: install
Expand Down
5 changes: 3 additions & 2 deletions examples/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
terraform {
required_providers {
schemaregistry = {
version = "0.3"
version = "0.4"
source = "github.com/arkiaconsulting/schemaregistry"
}
}
}

provider "schemaregistry" {
schema_registry_url = "http://localhost:8081"
}

resource "schemaregistry_schema" "user_added" {
subject = "MyTopic-akc.test.userAdded"
subject = "MyTopic-akc.test.userAdded-value"
schema = file("./userAdded.avsc")
}

Expand Down
3 changes: 2 additions & 1 deletion examples/userAdded.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"fields": [
{
"name": "firstName",
"type": "string"
"type": "string",
"description": "toto"
}
]
}
7 changes: 5 additions & 2 deletions schemaregistry/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
// Warning or errors can be collected in a slice type
var diags diag.Diagnostics

if (url != "") && (username != "") && (password != "") {
if (url != "") {
client := srclient.CreateSchemaRegistryClient(url)
client.SetCredentials(username, password)

if (username != "") && (password != "") {
client.SetCredentials(username, password)
}

return client, diags
}

Expand Down

0 comments on commit b885d59

Please sign in to comment.