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

[Feature]: Add data resource for obtaining subnet deatils based on its ID #725

Open
vladimirtiukhtin opened this issue Aug 1, 2023 · 3 comments

Comments

@vladimirtiukhtin
Copy link

What whould you like to see?

A data resource similar to hcloud_network for obtaining subnet details based on its ID. Thank you

@apricote
Copy link
Member

apricote commented Dec 4, 2023

Small issue is, that subnets do not have any IDs in the API. They are only identified through their IP Range.

I think it would be best to return this inside the data.hcloud_network resource.

Copy link

github-actions bot commented Mar 3, 2024

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Mar 3, 2024
@apricote apricote added pinned and removed stale labels Mar 8, 2024
@Johannestegner
Copy link

I would love to see this implemented in some form, and will gladly offer to help where possible.

From looking at the API docs, I can see that it's quite easy to get the subnets from the network endpoint, so the subnets could basically be included in the network datasource quite easily.
But, a problem is, as @apricote says above, that there is no actual ID (or any type of identifier at all) on the subnets.
This makes any practical use of the subnets hard in my eyes.

Is there any possibility to add either labels or a name to the subnets in the API (and database I would guess)? A unique id might be somewhat useful (especially if you provision the subnet and resources in the same project), but I would personally want to be able to identify the subnet with something not automatically generated (so I can select a specific subnet from the bunch).

If the API had that, the labels or name could be included in the value in the network resource and/or a new datasource could be created (which would fetch the subnet from the network through the API):

data "hcloud_network_subnet" "my-subnet" {
  network_id = data.hcloud_network.my-network.id
  name = "my-core-network"
  # or
  with_selector = "some-label=my-network-label"
}

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

No branches or pull requests

3 participants