|
88 | 88 |
|
89 | 89 | //go:embed testdata/resource-server-max-server-attachments.tf
|
90 | 90 | resourceServerMaxAttachmentConfig string
|
| 91 | + |
| 92 | + //go:embed testdata/datasource-machinetype.tf |
| 93 | + dataSourceMachineTypeConfig string |
91 | 94 | )
|
92 | 95 |
|
93 | 96 | const (
|
@@ -487,6 +490,10 @@ var testConfigKeyPairMaxUpdated = func() config.Variables {
|
487 | 490 | return updatedConfig
|
488 | 491 | }()
|
489 | 492 |
|
| 493 | +var testConfigMachineTypeVars = config.Variables{ |
| 494 | + "project_id": config.StringVariable(testutil.ProjectId), |
| 495 | +} |
| 496 | + |
490 | 497 | // if no local file is provided the test should create a default file and work with this instead of failing
|
491 | 498 | var localFileForIaasImage os.File
|
492 | 499 |
|
@@ -4022,6 +4029,47 @@ func TestAccImageMax(t *testing.T) {
|
4022 | 4029 | })
|
4023 | 4030 | }
|
4024 | 4031 |
|
| 4032 | +func TestAccMachineTyp(t *testing.T) { |
| 4033 | + t.Logf("TestAccMachineTyp projectid: %s", testutil.ConvertConfigVariable(testConfigMachineTypeVars["project_id"])) |
| 4034 | + resource.ParallelTest(t, resource.TestCase{ |
| 4035 | + ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories, |
| 4036 | + Steps: []resource.TestStep{ |
| 4037 | + { |
| 4038 | + ConfigVariables: testConfigMachineTypeVars, |
| 4039 | + Config: fmt.Sprintf("%s\n%s", dataSourceMachineTypeConfig, testutil.IaaSProviderConfig()), |
| 4040 | + Check: resource.ComposeTestCheckFunc( |
| 4041 | + resource.TestCheckResourceAttr("data.stackit_machine_type.two_vcpus_filter", "project_id", testutil.ConvertConfigVariable(testConfigMachineTypeVars["project_id"])), |
| 4042 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "id"), |
| 4043 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "name"), |
| 4044 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "vcpus"), |
| 4045 | + resource.TestCheckResourceAttr("data.stackit_machine_type.two_vcpus_filter", "vcpus", "2"), |
| 4046 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "ram"), |
| 4047 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "disk"), |
| 4048 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "description"), |
| 4049 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.two_vcpus_filter", "extra_specs.cpu"), |
| 4050 | + |
| 4051 | + resource.TestCheckResourceAttr("data.stackit_machine_type.filter_sorted_ascending_false", "project_id", testutil.ConvertConfigVariable(testConfigMachineTypeVars["project_id"])), |
| 4052 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "id"), |
| 4053 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "name"), |
| 4054 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "vcpus"), |
| 4055 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "ram"), |
| 4056 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "disk"), |
| 4057 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "description"), |
| 4058 | + resource.TestCheckResourceAttrSet("data.stackit_machine_type.filter_sorted_ascending_false", "extra_specs.cpu"), |
| 4059 | + |
| 4060 | + resource.TestCheckResourceAttr("data.stackit_machine_type.no_match", "project_id", testutil.ConvertConfigVariable(testConfigMachineTypeVars["project_id"])), |
| 4061 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "description"), |
| 4062 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "disk"), |
| 4063 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "extra_specs"), |
| 4064 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "id"), |
| 4065 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "name"), |
| 4066 | + resource.TestCheckNoResourceAttr("data.stackit_machine_type.no_match", "ram"), |
| 4067 | + ), |
| 4068 | + }, |
| 4069 | + }, |
| 4070 | + }) |
| 4071 | +} |
| 4072 | + |
4025 | 4073 | func testAccCheckDestroy(s *terraform.State) error {
|
4026 | 4074 | checkFunctions := []func(s *terraform.State) error{
|
4027 | 4075 | testAccCheckNetworkV1Destroy,
|
|
0 commit comments