terraform-provider-ovh
terraform-provider-ovh copied to clipboard
New data source: ovh_vrack_cloud_project
Hello,
I would like to be able to retrieve vRacks available on a cloud project.
For now the only data source related to vRack is ovh_vracks, which give every vRacks of your account. But you can't know which vRack is related to which cloud project.
The goal would be to add an ovh_vrack_cloud_project data source to call the OVH API /vrack/{serviceName}/cloudProject
The Terraform call could be:
data "ovh_vracks" "vracks" {}
data "ovh_vrack_cloud_project" "vrack" {
for_each = toset(data.ovh_vracks.vracks.result)
service_name = "${each.value}"
}
The purpose of this will be to retrieve the correct vrack id from the project id (OS_TENANT_ID), in order to create further ovh_cloud_project_network_private
When testing it with the implementation I've done, it gives me:
vrack = {
pn-xxxxxxx = {
id = "0"
result = []
service_name = "pn-xxxxxxx"
}
pn-yyyyyyy = {
id = "{{ Hash of the result }}"
result = [
"{{ my project id / OS_TENANT_ID }}",
]
service_name = "pn-yyyyyyy"
}
}
In a previous test, it appear that the vrack id was needed in the ovh_cloud_project_network_private as the service_name. But in more recent test, it seems to be the project id (OS_TENANT_ID) My first tests should have been wrong.
So it’s not relevant anymore. Sorry for the inconvenience. I’ll let the pull request open since it’s working and can be use for further needs. I let you chose what to do with it.
Hi @reneca, I'm closing this issue and the related PR as it is resolved by the following merged PR: https://github.com/ovh/terraform-provider-ovh/pull/504 Don't hesitate to reopen this issue if it is not solved by the PR I linked.