Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SOLACEBROKER_URL environment variable being ignored #79

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sreallymatt
Copy link

@sreallymatt sreallymatt commented Nov 7, 2024

Description

Based on the provider documentation, the url attribute should be picked up from an environment variable named SOLACEBROKER_URL if exists and url is not set in a provider block.

Because url was set as required in the schema, Terraform prompted for the url attribute before it ever reached the stringWithDefaultFromEnv function called in utilities.go on line 178.

Changes

  • Made url optional in schema
  • Added condition in utilities.go throwing an error if url is an empty string (which is the default return if env var not found)
  • Fixed typo
  • Updated schema in docs

Please advise on the comment in provider.go line 122, not sure if logging solacebroker_url=<null> makes sense

Example Error

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: `url` attribute must be defined in a provider block or set as an environment variable (`SOLACEBROKER_URL`)
│ 
│   with provider["registry.terraform.io/solaceproducts/solacebroker"],
│   on sampleconfig.tf line 10, in provider "solacebroker":
│   10: provider "solacebroker" {
│ 
│ provider parameters error

@bczoma
Copy link
Collaborator

bczoma commented Nov 8, 2024

Hi @sreallymatt , thanks for raising this. I have created issue #80 to track. This will be fixed in a next update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants