feat(iaas): add stackit_networks data source - #1623
Conversation
Signed-off-by: Thorben Below <56894536+thorbenbelow@users.noreply.github.com>
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
Hi @thorbenbelow , first of all thanks for the contribution and sorry that it took some time to get some eyes on it from a maintainer. In general I appreciate the implementation of a We from the STACKIT Developer Tools team did some research and planning how we want to continue with the filtering options in such list datasources like e.g. your new We decided that solving this problem of missing filter options in the STACKIT Terraform provider on the client side isn't the way to go. Even more, we consider it as technical debt which would be introduced here. The reasons are the following (just a short breakdown, not a complete list):
The solution we want to go with is server-side filtering using the STACKIT APIs. There's some standardized way of implementing filter options in STACKIT APIs written down in an AIP (API improvment proposal). In Terraform it would look like this in the future (in the example we're listing IaaS machine types): data "stackit_machine_types" "single_core" {
project_id = var.project_id
# filters for machine types with 1 vCPU and 1024 MB of RAM
# for first time users who want to use simple filters based on vCPU and RAM
filter = {
vcpu = 1
ram = 1024
}
}
data "stackit_machine_types" "dual_core" {
project_id = var.project_id
# filters for machine types with at least 2 vCPU and at least 1024 MB of RAM
# for power users who want to use more specific filters
filter = {
query = "vcpus == 2 AND ram >= 1024"
}
}As soon as a STACKIT service implements the filter options based on the AIP we will integrate them in our STACKIT Terraform provider. So I would propose you'll remove the filter options for now from the datasource implementation so we can go ahead and merge your new Best regards Ruben from STACKIT Developer Tools team |
|
@thorbenbelow if you have any questions just post them in this PR and I'll comment them. |
|
Hi @rubenhoenle, Not implementing the filters client side definitely makes sense. Regarding the filter options: data "stackit_networks" "example" {
project_id = var.project_id
filter = {
labels = {
foo = "bar"
}
}
} |
Description
This PR adds the
stackit_networksdata source that allows listing Networks in a project, optionally filtered by name and/or labels.The filtering options are modeled after the existing patterns in stackit_service_accounts. The output is returned as a simplified flat list containing only the network name and network ID to avoid code duplication, similar to plural data sources in other providers (e. g. aws_subnets).
solves #1600
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)