SolaceProducts / terraform-provider-solacebroker

Terraform provider for the Solace PubSub+ Event Broker (software)
Apache License 2.0
3 stars 1 forks source link

[Bug]: username and password are required to be added to the solacebroker provider {} block #74

Open nhakim-407etr opened 3 days ago

nhakim-407etr commented 3 days ago

Bug Description

Previous version eg 0.9.2 did not require broker username and password in the provider block when they are set in in the environment variable, but version 1.0.0 enforces it.

Expected Behavior

Terraform should not expect username and password in the provider block when broker username and password set in in the environment variable

Steps to Reproduce

terraform plan and apply on the below code:

terraform { required_providers { solacebroker = { source = "registry.terraform.io/solaceproducts/solacebroker" } } backend "s3" { // pipeline } }

provider "solacebroker" { url = "host" }

Solace Broker version

10.7.1.56-4

Solace API

No response

Solace API version

No response

bczoma commented 3 days ago

Hi @nhakim-407etr , trying to reproduce the failure you experienced.

Can you share how you set the env variables?

Following worked for me:

$export SOLACEBROKER_USERNAME=admin
$export SOLACEBROKER_PASSWORD=admin
$terraform init
$terraform plan

with this config:

$ cat test.tf 
terraform {
  required_providers {
    solacebroker = {
      source = "registry.terraform.io/solaceproducts/solacebroker"
    }
  }
}

provider "solacebroker" {
  url = "http://localhost:8080"
}
nhakim-407etr commented 3 days ago

Hello,

I'm currently running this on a Windows system. I've set the SOLACEBROKER_USERNAME to the actula value and SOLACEBROKER_PASSWORD to actual pwd.

set SOLACEBROKER_USERNAME=semp_user_name set SOLACEBROKER_PASSWORD=semp_pwd

The Terraform plan executes without any issues, but I encounter a problem when I try to apply the Terraform configuration. Here's the error message I receive:

Error: Verification of broker failed
│
│   with solacebroker_msg_vpn_queue.test_queuename,
│   on main.tf line 37, in resource "solacebroker_msg_vpn_queue" "test_queuename":
│   37: resource "solacebroker_msg_vpn_queue" "test_queuename" {
│
│ A username or bearer token must be supplied to access the broker

It seems like the broker requires either a username or a bearer token for access.

bczoma commented 2 hours ago

@nhakim-407etr thanks for the additional info, a fix will be released soon.