SchwarzIT / terraform-provider-stackit

Community-maintained STACKIT Terraform provider
Apache License 2.0
18 stars 6 forks source link

stackit_rabbitmq_credential (Data Source) - How to get data without creating the ressource #146

Closed fellnase closed 1 year ago

fellnase commented 1 year ago

I always need the id for the created ressource, but if I do not create the rabbitmq_credential, I couldn't get the data. Is there a workaround to get this data because I want to create rabbitmq with the portal gui (otherwise it will not be shown in the portal), but I need the data, to save it in vault.

data "stackit_rabbitmq_instance" "rabbitmq_instance" { name = "rabbitmq_instance" project_id = "1234-5678" }

data "stackit_rabbitmq_credential" "rabbitmq_instance_credetials" { project_id = project_id = "1234-5678" instance_id = data.stackit_rabbitmq_instance.rabbitmq_instance.id id = ????? }

locals { rabbitmq_host = data.stackit_rabbitmq_credential.rabbitmq_instance_credetials.host rabbitmq_port = data.stackit_rabbitmq_credential.rabbitmq_instance_credetials.port rabbitmq_username = data.stackit_rabbitmq_credential.rabbitmq_instance_credetials.username rabbitmq_password = data.stackit_rabbitmq_credential.rabbitmq_instance_credetials.password }

do87 commented 1 year ago

there's no way of getting the credentials if they are not created as a resource by terraform so either use stackit_rabbitmq_credential resource to create a new credential, or update your existing credentials in vault directly