Feat/add datasource to query machine types (#968)
* feat(iaas): add datasource to query machine types Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud> * review Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud> * review Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud> --------- Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
This commit is contained in:
parent
64787fff67
commit
fedaf72b62
8 changed files with 662 additions and 0 deletions
70
docs/data-sources/machine_type.md
Normal file
70
docs/data-sources/machine_type.md
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "stackit_machine_type Data Source - stackit"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
Machine type data source.
|
||||
~> This datasource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
|
||||
---
|
||||
|
||||
# stackit_machine_type (Data Source)
|
||||
|
||||
Machine type data source.
|
||||
|
||||
~> This datasource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```terraform
|
||||
data "stackit_machine_type" "two_vcpus_filter" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
filter = "vcpus==2"
|
||||
}
|
||||
|
||||
data "stackit_machine_type" "filter_sorted_ascending_false" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
filter = "vcpus >= 2 && ram >= 2048"
|
||||
sort_ascending = false
|
||||
}
|
||||
|
||||
data "stackit_machine_type" "intel_icelake_generic_filter" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
filter = "extraSpecs.cpu==\"intel-icelake-generic\" && vcpus == 2"
|
||||
}
|
||||
|
||||
# returns warning
|
||||
data "stackit_machine_type" "no_match" {
|
||||
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
filter = "vcpus == 99"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `filter` (String) Expr-lang filter for filtering machine types.
|
||||
|
||||
Examples:
|
||||
- vcpus == 2
|
||||
- ram >= 2048
|
||||
- extraSpecs.cpu == "intel-icelake-generic"
|
||||
- extraSpecs.cpu == "intel-icelake-generic" && vcpus == 2
|
||||
|
||||
See https://expr-lang.org/docs/language-definition for syntax.
|
||||
- `project_id` (String) STACKIT Project ID.
|
||||
|
||||
### Optional
|
||||
|
||||
- `sort_ascending` (Boolean) Sort machine types by name ascending (`true`) or descending (`false`). Defaults to `false`
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `description` (String) Machine type description.
|
||||
- `disk` (Number) Disk size in GB.
|
||||
- `extra_specs` (Map of String) Extra specs (e.g., CPU type, overcommit ratio).
|
||||
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`image_id`".
|
||||
- `name` (String) Name of the machine type (e.g. 's1.2').
|
||||
- `ram` (Number) RAM size in MB.
|
||||
- `vcpus` (Number) Number of vCPUs.
|
||||
Loading…
Add table
Add a link
Reference in a new issue