chore: add sqlserveralpha tests
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / CI (pull_request) Failing after 7m28s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 15m10s

This commit is contained in:
Marcel S. Henselin 2026-02-11 15:59:49 +01:00
parent ed7ff0f58e
commit 94ac9c6ec5
7 changed files with 814 additions and 587 deletions

View file

@ -0,0 +1,53 @@
provider "stackitprivatepreview" {
default_region = "{{ .Region }}"
service_account_key_path = "{{ .ServiceAccountFilePath }}"
}
resource "stackitprivatepreview_sqlserverflexalpha_instance" "{{ .TfName }}" {
project_id = "{{ .ProjectId }}"
name = "{{ .Name }}"
backup_schedule = "{{ .BackupSchedule }}"
retention_days = {{ .RetentionDays }}
flavor_id = "{{ .FlavorId }}"
storage = {
class = "{{ .PerformanceClass }}"
size = {{ .Size }}
}
{{ if .UseEncryption }}
encryption = {
kek_key_id = {{ .KekKeyId }}
kek_key_ring_id = {{ .KekKeyRingId }}
kek_key_version = {{ .KekKeyVersion }}
service_account = "{{ .KekServiceAccount }}"
}
{{ end }}
network = {
acl = ["{{ .AclString }}"]
access_scope = "{{ .AccessScope }}"
}
version = "{{ .Version }}"
}
{{ if .Users }}
{{ $tfName := .TfName }}
{{ range $user := .Users }}
resource "stackitprivatepreview_sqlserverflexalpha_user" "{{ $user.Name }}" {
project_id = "{{ $user.ProjectId }}"
instance_id = stackitprivatepreview_sqlserverflexalpha_instance.{{ $tfName }}.instance_id
username = "{{ $user.Name }}"
roles = [{{ range $i, $v := $user.Roles }}{{if $i}},{{end}}"{{$v}}"{{end}}]
}
{{ end }}
{{ end }}
{{ if .Databases }}
{{ $tfName := .TfName }}
{{ range $db := .Databases }}
resource "stackitprivatepreview_sqlserverflexalpha_database" "{{ $db.Name }}" {
project_id = "{{ $db.ProjectId }}"
instance_id = stackitprivatepreview_sqlserverflexalpha_instance.{{ $tfName }}.instance_id
name = "{{ $db.Name }}"
owner = "{{ $db.Owner }}"
}
{{ end }}
{{ end }}

View file

@ -1,52 +0,0 @@
variable "project_id" {}
variable "name" {}
variable "acl1" {}
variable "flavor_cpu" {}
variable "flavor_ram" {}
variable "storage_class" {}
variable "storage_size" {}
variable "options_retention_days" {}
variable "backup_schedule" {}
variable "username" {}
variable "role" {}
variable "server_version" {}
variable "region" {}
resource "stackit_sqlserverflex_instance" "instance" {
project_id = var.project_id
name = var.name
acl = [var.acl1]
flavor = {
cpu = var.flavor_cpu
ram = var.flavor_ram
}
storage = {
class = var.storage_class
size = var.storage_size
}
version = var.server_version
options = {
retention_days = var.options_retention_days
}
backup_schedule = var.backup_schedule
region = var.region
}
resource "stackit_sqlserverflex_user" "user" {
project_id = stackit_sqlserverflex_instance.instance.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
username = var.username
roles = [var.role]
}
data "stackit_sqlserverflex_instance" "instance" {
project_id = var.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
}
data "stackit_sqlserverflex_user" "user" {
project_id = var.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
user_id = stackit_sqlserverflex_user.user.user_id
}

View file

@ -1,34 +0,0 @@
variable "project_id" {}
variable "name" {}
variable "flavor_cpu" {}
variable "flavor_ram" {}
variable "username" {}
variable "role" {}
resource "stackit_sqlserverflex_instance" "instance" {
project_id = var.project_id
name = var.name
flavor = {
cpu = var.flavor_cpu
ram = var.flavor_ram
}
}
resource "stackit_sqlserverflex_user" "user" {
project_id = stackit_sqlserverflex_instance.instance.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
username = var.username
roles = [var.role]
}
data "stackit_sqlserverflex_instance" "instance" {
project_id = var.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
}
data "stackit_sqlserverflex_user" "user" {
project_id = var.project_id
instance_id = stackit_sqlserverflex_instance.instance.instance_id
user_id = stackit_sqlserverflex_user.user.user_id
}