Closed diwangcanada closed 9 months ago
Hi @diwangcanada , you seemed to be successful creating a solace queue. terraform init
must have worked on that config. What is different in your setup when you are trying to create a queue subscription?
Using the setup where you could create a solace queue you could try to add a subscription based on this example, adjusted to your case:
...
resource "solacebroker_msg_vpn" "test" {
msg_vpn_name = "test"
}
resource "solacebroker_msg_vpn_queue" "q" {
msg_vpn_name = solacebroker_msg_vpn.test.msg_vpn_name
queue_name = "testQ"
}
resource "solacebroker_msg_vpn_queue_subscription" "testsub" {
msg_vpn_name = solacebroker_msg_vpn_queue.q.msg_vpn_name
queue_name = solacebroker_msg_vpn_queue.q.queue_name
subscription_topic = "foo/bar"
}
Here is my "queue.tf":
module "first-queue" {
source = "../../modules/solace-queue"
queue_name = "first-queue"
msg_vpn_name = "terraform-test"
ingress_enabled = true
egress_enabled = true
permission = "consume"
access_type = "exclusive"
max_msg_spool_usage = 5000
owner = " "
max_bind_count = 1000
}
Here is my "queue-subscription.tf":
module "first-queue-subscription" {
source = "../../modules/solace-queue-subscription"
queue_name = "first-queue"
msg_vpn_name = "terraform-test"
subscription_topic = "test-topic"
}
And, I have provider.tf in the same folder as "queue.tf" and "queue-subscription.tf"
terraform {
required_providers {
solacebroker = {
source = "registry.terraform.io/solaceproducts/solacebroker"
version = "0.9.0"
}
}
}
# Configure the provider
provider "solacebroker" {
username = var.broker_admin_username
password = var.broker_admin_password
url = var.hostname
}
In the module "solace-queue" and "solace-queue-subscription" folder, I have the same provider.tf setup
terraform {
required_providers {
solacebroker = {
source = "registry.terraform.io/solaceproducts/solacebroker"
version = "0.9.0"
}
}
}
Really wired that the provider works fine for creating queue, but as long as I use solace-queue-subscription module, I got the error.
I did another test, instead of calling module, I directly create queue subscription with resource block, but failed with same error.
# module "first-queue-subscription" {
# source = "../../modules/solace-queue-subscription"
# queue_name = "first-queue"
# msg_vpn_name = "terraform-test"
# subscription_topic = "test-topic"
# }
resource "solace_queue_subscription" "queue-subscription" {
queue_name = "first-queue"
msg_vpn_name = "terraform-test"
subscription_topic = "test-topic"
}
sorry, my mistake. The resource name for queue subscription is wrong. I got this resolved. Thank you!
We could successfully create solace queue by Terraform using this provider. However, we got below error when try to create solace queue subscription.
Setup failed: Failed terraform init (exit 1):
Output: Initializing modules...
Initializing Terraform Cloud...
Initializing provider plugins...
Partner and community providers are signed by their developers. If you'd like to know more about provider signing, you can read about it here: https://www.terraform.io/docs/cli/plugins/signing.html ╷ │ Error: Failed to query available provider packages │ │ Could not retrieve the list of available versions for provider │ hashicorp/solace: provider registry registry.terraform.io does not have a │ provider named registry.terraform.io/hashicorp/solace │ │ All modules should specify their required_providers so that external │ consumers will get the correct providers when using a module. To see which │ modules are currently depending on hashicorp/solace, run the following │ command: │ terraform providers ╵
Below is how I config my provider, and I place it the same in terraform job folder as well as modules folder.
terraform { required_providers { solacebroker = { source = "registry.terraform.io/solaceproducts/solacebroker" version = "0.9.0" } } }
Can you help to take a look why got this error?