Feat/stackittpr 189 min max tests (#806)
* feat(serverupdate): added min/max tests * feat(serverbackup): added min/max tests * chore(dns): added min/max tests * fix(dns): correct attribute setting of zone type * chore(secretsmanager): added min/max tests * chore(acceptance tests): fixed linter issues * chore(acceptance tests): cleanup code * updated documentation * chore(acceptance test): fixed review findings
This commit is contained in:
parent
6a0ccb87ee
commit
b2af6ac0e4
14 changed files with 1136 additions and 674 deletions
|
|
@ -2,126 +2,129 @@ package serverupdate_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"log"
|
||||
"maps"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/config"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-testing/terraform"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
core_config "github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/serverupdate"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/testutil"
|
||||
)
|
||||
|
||||
// Server update schedule resource data
|
||||
var serverUpdateScheduleResource = map[string]string{
|
||||
"project_id": testutil.ProjectId,
|
||||
"server_id": testutil.ServerId,
|
||||
"name": testutil.ResourceNameWithDateTime("server-update-schedule"),
|
||||
"rrule": "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1",
|
||||
"maintenance_window": "1",
|
||||
var (
|
||||
//go:embed testdata/resource-min.tf
|
||||
resourceMinConfig string
|
||||
|
||||
//go:embed testdata/resource-max.tf
|
||||
resourceMaxConfig string
|
||||
)
|
||||
|
||||
var testConfigVarsMin = config.Variables{
|
||||
"project_id": config.StringVariable(testutil.ProjectId),
|
||||
"server_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
|
||||
"schedule_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
|
||||
"rrule": config.StringVariable("DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1"),
|
||||
"enabled": config.BoolVariable(true),
|
||||
"maintenance_window": config.IntegerVariable(1),
|
||||
"server_id": config.StringVariable(testutil.ServerId),
|
||||
}
|
||||
|
||||
func resourceConfig(maintenanceWindow int64, region *string) string {
|
||||
var regionConfig string
|
||||
if region != nil {
|
||||
regionConfig = fmt.Sprintf(`region = %q`, *region)
|
||||
}
|
||||
return fmt.Sprintf(`
|
||||
%s
|
||||
|
||||
resource "stackit_server_update_schedule" "test_schedule" {
|
||||
project_id = "%s"
|
||||
server_id = "%s"
|
||||
name = "%s"
|
||||
rrule = "%s"
|
||||
enabled = true
|
||||
maintenance_window = %d
|
||||
%s
|
||||
}
|
||||
`,
|
||||
testutil.ServerUpdateProviderConfig(),
|
||||
serverUpdateScheduleResource["project_id"],
|
||||
serverUpdateScheduleResource["server_id"],
|
||||
serverUpdateScheduleResource["name"],
|
||||
serverUpdateScheduleResource["rrule"],
|
||||
maintenanceWindow,
|
||||
regionConfig,
|
||||
)
|
||||
var testConfigVarsMax = config.Variables{
|
||||
"project_id": config.StringVariable(testutil.ProjectId),
|
||||
"server_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
|
||||
"schedule_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
|
||||
"rrule": config.StringVariable("DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1"),
|
||||
"enabled": config.BoolVariable(true),
|
||||
"maintenance_window": config.IntegerVariable(1),
|
||||
"region": config.StringVariable("eu01"),
|
||||
"server_id": config.StringVariable(testutil.ServerId),
|
||||
}
|
||||
|
||||
func TestAccServerUpdateScheduleResource(t *testing.T) {
|
||||
func configVarsInvalid(vars config.Variables) config.Variables {
|
||||
tempConfig := maps.Clone(vars)
|
||||
tempConfig["maintenance_window"] = config.IntegerVariable(0)
|
||||
return tempConfig
|
||||
}
|
||||
|
||||
func configVarsMinUpdated() config.Variables {
|
||||
tempConfig := maps.Clone(testConfigVarsMin)
|
||||
tempConfig["maintenance_window"] = config.IntegerVariable(12)
|
||||
tempConfig["rrule"] = config.StringVariable("DTSTART;TZID=Europe/Berlin:20250430T010000 RRULE:FREQ=DAILY;INTERVAL=3")
|
||||
|
||||
return tempConfig
|
||||
}
|
||||
|
||||
func configVarsMaxUpdated() config.Variables {
|
||||
tempConfig := maps.Clone(testConfigVarsMax)
|
||||
tempConfig["maintenance_window"] = config.IntegerVariable(12)
|
||||
tempConfig["rrule"] = config.StringVariable("DTSTART;TZID=Europe/Berlin:20250430T010000 RRULE:FREQ=DAILY;INTERVAL=3")
|
||||
return tempConfig
|
||||
}
|
||||
|
||||
func TestAccServerUpdateScheduleMinResource(t *testing.T) {
|
||||
if testutil.ServerId == "" {
|
||||
fmt.Println("TF_ACC_SERVER_ID not set, skipping test")
|
||||
return
|
||||
}
|
||||
var invalidMaintenanceWindow int64 = 0
|
||||
var validMaintenanceWindow int64 = 15
|
||||
var updatedMaintenanceWindow int64 = 8
|
||||
resource.Test(t, resource.TestCase{
|
||||
ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories,
|
||||
CheckDestroy: testAccCheckServerUpdateScheduleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
// Creation fail
|
||||
{
|
||||
Config: resourceConfig(invalidMaintenanceWindow, &testutil.Region),
|
||||
ExpectError: regexp.MustCompile(`.*maintenance_window value must be at least 1*`),
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMinConfig,
|
||||
ConfigVariables: configVarsInvalid(configVarsMinUpdated()),
|
||||
ExpectError: regexp.MustCompile(`.*maintenance_window value must be at least 1*`),
|
||||
},
|
||||
// Creation
|
||||
{
|
||||
Config: resourceConfig(validMaintenanceWindow, &testutil.Region),
|
||||
ConfigVariables: testConfigVarsMin,
|
||||
Config: resourceMinConfig,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Update schedule data
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", serverUpdateScheduleResource["project_id"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "server_id", serverUpdateScheduleResource["server_id"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(testConfigVarsMin["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "server_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "name", serverUpdateScheduleResource["name"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", serverUpdateScheduleResource["rrule"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", strconv.FormatBool(true)),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "region", testutil.Region),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "name", testutil.ConvertConfigVariable(testConfigVarsMin["schedule_name"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(testConfigVarsMin["rrule"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(testConfigVarsMin["enabled"])),
|
||||
),
|
||||
},
|
||||
// data source
|
||||
{
|
||||
Config: fmt.Sprintf(`
|
||||
%s
|
||||
|
||||
data "stackit_server_update_schedules" "schedules_data_test" {
|
||||
project_id = stackit_server_update_schedule.test_schedule.project_id
|
||||
server_id = stackit_server_update_schedule.test_schedule.server_id
|
||||
}
|
||||
|
||||
data "stackit_server_update_schedule" "schedule_data_test" {
|
||||
project_id = stackit_server_update_schedule.test_schedule.project_id
|
||||
server_id = stackit_server_update_schedule.test_schedule.server_id
|
||||
update_schedule_id = stackit_server_update_schedule.test_schedule.update_schedule_id
|
||||
}`,
|
||||
resourceConfig(validMaintenanceWindow, &testutil.Region),
|
||||
),
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMinConfig,
|
||||
ConfigVariables: testConfigVarsMin,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Server update schedule data
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.schedule_data_test", "project_id", serverUpdateScheduleResource["project_id"]),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.schedule_data_test", "server_id", serverUpdateScheduleResource["server_id"]),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.schedule_data_test", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.schedule_data_test", "id"),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.schedule_data_test", "name", serverUpdateScheduleResource["name"]),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.schedule_data_test", "rrule", serverUpdateScheduleResource["rrule"]),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.schedule_data_test", "enabled", strconv.FormatBool(true)),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(testConfigVarsMin["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "name", testutil.ConvertConfigVariable(testConfigVarsMin["schedule_name"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(testConfigVarsMin["rrule"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(testConfigVarsMin["enabled"])),
|
||||
|
||||
// Server update schedules data
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "project_id", serverUpdateScheduleResource["project_id"]),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "server_id", serverUpdateScheduleResource["server_id"]),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "project_id", testutil.ConvertConfigVariable(testConfigVarsMin["project_id"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "server_id", testutil.ConvertConfigVariable(testConfigVarsMin["server_id"])),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedules.schedules_data_test", "id"),
|
||||
),
|
||||
},
|
||||
// Import
|
||||
// // Import
|
||||
{
|
||||
ResourceName: "stackit_server_update_schedule.test_schedule",
|
||||
ConfigVariables: testConfigVarsMin,
|
||||
ResourceName: "stackit_server_update_schedule.test_schedule",
|
||||
ImportStateIdFunc: func(s *terraform.State) (string, error) {
|
||||
r, ok := s.RootModule().Resources["stackit_server_update_schedule.test_schedule"]
|
||||
if !ok {
|
||||
|
|
@ -136,19 +139,107 @@ func TestAccServerUpdateScheduleResource(t *testing.T) {
|
|||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
// Update
|
||||
// // Update
|
||||
{
|
||||
Config: resourceConfig(updatedMaintenanceWindow, nil),
|
||||
ConfigVariables: configVarsMinUpdated(),
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMinConfig,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Update schedule data
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", serverUpdateScheduleResource["project_id"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "server_id", serverUpdateScheduleResource["server_id"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(configVarsMinUpdated()["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "name", serverUpdateScheduleResource["name"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", serverUpdateScheduleResource["rrule"]),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", strconv.FormatBool(true)),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "maintenance_window", strconv.FormatInt(8, 10)),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "name", testutil.ConvertConfigVariable(configVarsMinUpdated()["schedule_name"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(configVarsMinUpdated()["rrule"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(configVarsMinUpdated()["enabled"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "maintenance_window", testutil.ConvertConfigVariable(configVarsMinUpdated()["maintenance_window"])),
|
||||
),
|
||||
},
|
||||
// Deletion is done by the framework implicitly
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccServerUpdateScheduleMaxResource(t *testing.T) {
|
||||
if testutil.ServerId == "" {
|
||||
fmt.Println("TF_ACC_SERVER_ID not set, skipping test")
|
||||
return
|
||||
}
|
||||
resource.Test(t, resource.TestCase{
|
||||
ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories,
|
||||
CheckDestroy: testAccCheckServerUpdateScheduleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
// Creation fail
|
||||
{
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMaxConfig,
|
||||
ConfigVariables: configVarsInvalid(testConfigVarsMax),
|
||||
ExpectError: regexp.MustCompile(`.*maintenance_window value must be at least 1*`),
|
||||
},
|
||||
// Creation
|
||||
{
|
||||
ConfigVariables: testConfigVarsMax,
|
||||
Config: resourceMaxConfig,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Update schedule data
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(testConfigVarsMax["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "server_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "name", testutil.ConvertConfigVariable(testConfigVarsMax["schedule_name"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(testConfigVarsMax["rrule"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(testConfigVarsMax["enabled"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "region", testutil.Region),
|
||||
),
|
||||
},
|
||||
// data source
|
||||
{
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMaxConfig,
|
||||
ConfigVariables: testConfigVarsMax,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Server update schedule data
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(testConfigVarsMax["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "name", testutil.ConvertConfigVariable(testConfigVarsMax["schedule_name"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(testConfigVarsMax["rrule"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(testConfigVarsMax["enabled"])),
|
||||
|
||||
// Server update schedules data
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "project_id", testutil.ConvertConfigVariable(testConfigVarsMax["project_id"])),
|
||||
resource.TestCheckResourceAttr("data.stackit_server_update_schedules.schedules_data_test", "server_id", testutil.ConvertConfigVariable(testConfigVarsMax["server_id"])),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_server_update_schedules.schedules_data_test", "id"),
|
||||
),
|
||||
},
|
||||
// // Import
|
||||
{
|
||||
ConfigVariables: testConfigVarsMax,
|
||||
ResourceName: "stackit_server_update_schedule.test_schedule",
|
||||
ImportStateIdFunc: func(s *terraform.State) (string, error) {
|
||||
r, ok := s.RootModule().Resources["stackit_server_update_schedule.test_schedule"]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("couldn't find resource stackit_server_update_schedule.test_schedule")
|
||||
}
|
||||
scheduleId, ok := r.Primary.Attributes["update_schedule_id"]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("couldn't find attribute update_schedule_id")
|
||||
}
|
||||
return fmt.Sprintf("%s,%s,%s,%s", testutil.ProjectId, testutil.Region, testutil.ServerId, scheduleId), nil
|
||||
},
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
// // Update
|
||||
{
|
||||
ConfigVariables: configVarsMaxUpdated(),
|
||||
Config: testutil.ServerUpdateProviderConfig() + "\n" + resourceMaxConfig,
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
// Update schedule data
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "project_id", testutil.ConvertConfigVariable(configVarsMinUpdated()["project_id"])),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "update_schedule_id"),
|
||||
resource.TestCheckResourceAttrSet("stackit_server_update_schedule.test_schedule", "id"),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "rrule", testutil.ConvertConfigVariable(configVarsMinUpdated()["rrule"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "enabled", testutil.ConvertConfigVariable(configVarsMinUpdated()["enabled"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "maintenance_window", testutil.ConvertConfigVariable(configVarsMinUpdated()["maintenance_window"])),
|
||||
resource.TestCheckResourceAttr("stackit_server_update_schedule.test_schedule", "region", testutil.Region),
|
||||
),
|
||||
},
|
||||
// Deletion is done by the framework implicitly
|
||||
|
|
@ -158,13 +249,21 @@ func TestAccServerUpdateScheduleResource(t *testing.T) {
|
|||
|
||||
func testAccCheckServerUpdateScheduleDestroy(s *terraform.State) error {
|
||||
ctx := context.Background()
|
||||
if err := deleteSchedule(ctx, s); err != nil {
|
||||
log.Printf("cannot delete schedule: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteSchedule(ctx context.Context, s *terraform.State) error {
|
||||
var client *serverupdate.APIClient
|
||||
var err error
|
||||
if testutil.ServerUpdateCustomEndpoint == "" {
|
||||
client, err = serverupdate.NewAPIClient()
|
||||
} else {
|
||||
client, err = serverupdate.NewAPIClient(
|
||||
config.WithEndpoint(testutil.ServerUpdateCustomEndpoint),
|
||||
core_config.WithEndpoint(testutil.ServerUpdateCustomEndpoint),
|
||||
)
|
||||
}
|
||||
if err != nil {
|
||||
|
|
|
|||
29
stackit/internal/services/serverupdate/testdata/resource-max.tf
vendored
Normal file
29
stackit/internal/services/serverupdate/testdata/resource-max.tf
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
variable "project_id" {}
|
||||
variable "server_name" {}
|
||||
variable "schedule_name" {}
|
||||
variable "rrule" {}
|
||||
variable "enabled" {}
|
||||
variable "maintenance_window" {}
|
||||
variable "server_id" {}
|
||||
variable "region" {}
|
||||
|
||||
resource "stackit_server_update_schedule" "test_schedule" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
name = var.schedule_name
|
||||
rrule = var.rrule
|
||||
enabled = var.enabled
|
||||
maintenance_window = var.maintenance_window
|
||||
region = var.region
|
||||
}
|
||||
|
||||
data "stackit_server_update_schedule" "test_schedule" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
update_schedule_id = stackit_server_update_schedule.test_schedule.update_schedule_id
|
||||
}
|
||||
|
||||
data "stackit_server_update_schedules" "schedules_data_test" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
}
|
||||
27
stackit/internal/services/serverupdate/testdata/resource-min.tf
vendored
Normal file
27
stackit/internal/services/serverupdate/testdata/resource-min.tf
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
variable "project_id" {}
|
||||
variable "server_name" {}
|
||||
variable "schedule_name" {}
|
||||
variable "rrule" {}
|
||||
variable "enabled" {}
|
||||
variable "maintenance_window" {}
|
||||
variable "server_id" {}
|
||||
|
||||
resource "stackit_server_update_schedule" "test_schedule" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
name = var.schedule_name
|
||||
rrule = var.rrule
|
||||
enabled = var.enabled
|
||||
maintenance_window = var.maintenance_window
|
||||
}
|
||||
|
||||
data "stackit_server_update_schedule" "test_schedule" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
update_schedule_id = stackit_server_update_schedule.test_schedule.update_schedule_id
|
||||
}
|
||||
|
||||
data "stackit_server_update_schedules" "schedules_data_test" {
|
||||
project_id = var.project_id
|
||||
server_id = var.server_id
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue