Skip to content

Feat/add datasource to query machine types#968

Merged
Fyusel merged 3 commits into
stackitcloud:mainfrom
h3adex:feat/add-datasource-to-query-machine-types
Aug 28, 2025
Merged

Feat/add datasource to query machine types#968
Fyusel merged 3 commits into
stackitcloud:mainfrom
h3adex:feat/add-datasource-to-query-machine-types

Conversation

@h3adex

@h3adex h3adex commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

Description

This PR adds support for querying machine types using the IaaS API:
https://docs.api.stackit.cloud/documentation/iaas/version/v1#tag/Flavors/operation/v1ListMachineType

You can test it using the following data-sources:

data "stackit_machine_type" "two_vcpus_filter" {
  project_id = var.stackit_project_id
  filter     = "vcpus == 2"
}

data "stackit_machine_type" "filter_sorted_ascending_false" {
  project_id     = var.stackit_project_id
  filter         = "vcpus >= 2 && ram >= 2048"
  sort_ascending = false
}

data "stackit_machine_type" "intel_icelake_generic_filter" {
  project_id = var.stackit_project_id
  filter     = "extraSpecs.cpu == \"intel-icelake-generic\" && vcpus == 2"
}

# Returns a warning, as no matching machine type is found
data "stackit_machine_type" "no_match" {
  project_id = var.stackit_project_id
  filter     = "vcpus == 99"
}

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@h3adex h3adex requested a review from a team as a code owner August 26, 2025 08:13

@Fyusel Fyusel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add datasource to beta

Comment thread stackit/internal/services/iaas/iaas_acc_test.go Outdated
Comment thread stackit/internal/services/iaas/iaas_acc_test.go Outdated
Comment thread stackit/internal/services/iaas/machinetype/datasource.go Outdated
Comment thread stackit/internal/services/iaas/machinetype/datasource.go
Comment thread stackit/internal/services/iaas/machinetype/datasource.go Outdated
Comment thread stackit/internal/services/iaas/machinetype/datasource.go Outdated
Comment thread stackit/internal/services/iaas/machinetype/datasource.go Outdated
h3adex added 2 commits August 28, 2025 11:49
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
@h3adex h3adex force-pushed the feat/add-datasource-to-query-machine-types branch from 69217df to b2546ae Compare August 28, 2025 09:49
@h3adex

h3adex commented Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

E2E Tests
Screenshot 2025-08-28 at 11 51 51

@h3adex h3adex force-pushed the feat/add-datasource-to-query-machine-types branch 2 times, most recently from 836679b to dd8131d Compare August 28, 2025 09:55
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
@h3adex h3adex force-pushed the feat/add-datasource-to-query-machine-types branch from dd8131d to 19fd98a Compare August 28, 2025 09:57
@Fyusel Fyusel merged commit fedaf72 into stackitcloud:main Aug 28, 2025
5 checks passed
@h3adex h3adex deleted the feat/add-datasource-to-query-machine-types branch September 2, 2025 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants