feat: mssql alpha instance (#2)

* fix: remove unused attribute types and functions from backup models

* fix: update API client references to use sqlserverflexalpha package

* fix: update package references to use sqlserverflexalpha and modify user data source model

* fix: add sqlserverflexalpha user data source to provider

* fix: add sqlserverflexalpha user resource and update related functionality

* chore: add stackit_sqlserverflexalpha_user resource and instance_id variable

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
Marcel S. Henselin 2025-12-19 08:56:46 +01:00 committed by GitHub
parent df25ceffd4
commit 5381516661
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
385 changed files with 1431 additions and 14841 deletions

View file

@ -1,11 +0,0 @@
resource "stackit_affinity_group" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-affinity-group-name"
policy = "hard-anti-affinity"
}
# Only use the import statement, if you want to import an existing affinity group
import {
to = stackit_affinity_group.import-example
id = "${var.project_id},${var.region},${var.affinity_group_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_authorization_organization_role_assignment" "example" {
resource_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
role = "owner"
subject = "john.doe@stackit.cloud"
}
# Only use the import statement, if you want to import an existing organization role assignment
import {
to = stackit_authorization_organization_role_assignment.import-example
id = "${var.organization_id},${var.org_role_assignment_role},${var.org_role_assignment_subject}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_authorization_project_role_assignment" "example" {
resource_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
role = "owner"
subject = "john.doe@stackit.cloud"
}
# Only use the import statement, if you want to import an existing project role assignment
import {
to = stackit_authorization_project_role_assignment.import-example
id = "${var.project_id},${var.project_role_assignment_role},${var.project_role_assignment_subject}"
}

View file

@ -1,15 +0,0 @@
resource "stackit_cdn_custom_domain" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
distribution_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "https://xxx.xxx"
certificate = {
certificate = "-----BEGIN CERTIFICATE-----\nY2VydGlmaWNhdGVfZGF0YQ==\n-----END CERTIFICATE---"
private_key = "-----BEGIN RSA PRIVATE KEY-----\nY2VydGlmaWNhdGVfZGF0YQ==\n-----END RSA PRIVATE KEY---"
}
}
# Only use the import statement, if you want to import an existing cdn custom domain
import {
to = stackit_cdn_custom_domain.import-example
id = "${var.project_id},${var.distribution_id},${var.custom_domain_name}"
}

View file

@ -1,24 +0,0 @@
resource "stackit_cdn_distribution" "example_distribution" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
config = {
backend = {
type = "http"
origin_url = "https://mybackend.onstackit.cloud"
geofencing = {
"https://mybackend.onstackit.cloud" = ["DE"]
}
}
regions = ["EU", "US", "ASIA", "AF", "SA"]
blocked_countries = ["DE", "AT", "CH"]
optimizer = {
enabled = true
}
}
}
# Only use the import statement, if you want to import an existing cdn distribution
import {
to = stackit_cdn_distribution.import-example
id = "${var.project_id},${var.distribution_id}"
}

View file

@ -1,14 +0,0 @@
resource "stackit_dns_record_set" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
zone_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-record-set"
type = "A"
comment = "Example comment"
records = ["1.2.3.4"]
}
# Only use the import statement, if you want to import an existing dns record set
import {
to = stackit_dns_record_set.import-example
id = "${var.project_id},${var.zone_id},${var.record_set_id}"
}

View file

@ -1,16 +0,0 @@
resource "stackit_dns_zone" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "Example zone"
dns_name = "example-zone.com"
contact_email = "aa@bb.ccc"
type = "primary"
acl = "192.168.0.0/24"
description = "Example description"
default_ttl = 1230
}
# Only use the import statement, if you want to import an existing dns zone
import {
to = stackit_dns_zone.import-example
id = "${var.project_id},${var.zone_id}"
}

View file

@ -1,19 +0,0 @@
resource "stackit_git" "git" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "git-example-instance"
}
resource "stackit_git" "git" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "git-example-instance"
acl = [
"0.0.0.0/0"
]
flavor = "git-100"
}
# Only use the import statement, if you want to import an existing git resource
import {
to = stackit_git.import-example
id = "${var.project_id},${var.git_instance_id}"
}

View file

@ -1,20 +0,0 @@
resource "stackit_image" "example_image" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-image"
disk_format = "qcow2"
local_file_path = "./path/to/image.qcow2"
min_disk_size = 10
min_ram = 5
}
# Only use the import statement, if you want to import an existing image
# Must set a configuration value for the local_file_path attribute as the provider has marked it as required.
# Since this attribute is not fetched in general from the API call, after adding it this would replace your image resource after an terraform apply.
# In order to prevent this you need to add:
#lifecycle {
# ignore_changes = [ local_file_path ]
# }
import {
to = stackit_image.import-example
id = "${var.project_id},${var.region},${var.image_id}"
}

View file

@ -1,11 +0,0 @@
# Create a key pair
resource "stackit_key_pair" "keypair" {
name = "example-key-pair"
public_key = chomp(file("path/to/id_rsa.pub"))
}
# Only use the import statement, if you want to import an existing key pair
import {
to = stackit_key_pair.import-example
id = var.keypair_name
}

View file

@ -1,8 +0,0 @@
resource "stackit_kms_key" "key" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
keyring_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "key-01"
protection = "software"
algorithm = "aes_256_gcm"
purpose = "symmetric_encrypt_decrypt"
}

View file

@ -1,5 +0,0 @@
resource "stackit_kms_keyring" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "example-name"
description = "example description"
}

View file

@ -1,8 +0,0 @@
resource "stackit_kms_wrapping_key" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
keyring_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "example-name"
protection = "software"
algorithm = "rsa_2048_oaep_sha256"
purpose = "wrap_symmetric_key"
}

View file

@ -1,204 +0,0 @@
# Create a network
resource "stackit_network" "example_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network"
ipv4_nameservers = ["8.8.8.8"]
ipv4_prefix = "192.168.0.0/25"
labels = {
"key" = "value"
}
routed = true
}
# Create a network interface
resource "stackit_network_interface" "nic" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.example_network.network_id
}
# Create a public IP for the load balancer
resource "stackit_public_ip" "public-ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
lifecycle {
ignore_changes = [network_interface_id]
}
}
# Create a key pair for accessing the server instance
resource "stackit_key_pair" "keypair" {
name = "example-key-pair"
public_key = chomp(file("path/to/id_rsa.pub"))
}
# Create a server instance
resource "stackit_server" "boot-from-image" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
boot_volume = {
size = 64
source_type = "image"
source_id = "59838a89-51b1-4892-b57f-b3caf598ee2f" // Ubuntu 24.04
}
availability_zone = "xxxx-x"
machine_type = "g2i.1"
keypair_name = stackit_key_pair.keypair.name
network_interfaces = [
stackit_network_interface.nic.network_interface_id
]
}
# Create a load balancer
resource "stackit_loadbalancer" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-load-balancer"
plan_id = "p10"
target_pools = [
{
name = "example-target-pool"
target_port = 80
targets = [
{
display_name = stackit_server.boot-from-image.name
ip = stackit_network_interface.nic.ipv4
}
]
active_health_check = {
healthy_threshold = 10
interval = "3s"
interval_jitter = "3s"
timeout = "3s"
unhealthy_threshold = 10
}
}
]
listeners = [
{
display_name = "example-listener"
port = 80
protocol = "PROTOCOL_TCP"
target_pool = "example-target-pool"
tcp = {
idle_timeout = "90s"
}
}
]
networks = [
{
network_id = stackit_network.example_network.network_id
role = "ROLE_LISTENERS_AND_TARGETS"
}
]
external_address = stackit_public_ip.public-ip.ip
options = {
private_network_only = false
}
}
# This example demonstrates an advanced setup where the Load Balancer is in one
# network and the target server is in another. This requires manual
# security group configuration using the `disable_security_group_assignment`
# and `security_group_id` attributes.
# We create two separate networks: one for the load balancer and one for the target.
resource "stackit_network" "lb_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "lb-network-example"
ipv4_prefix = "192.168.10.0/25"
ipv4_nameservers = ["8.8.8.8"]
}
resource "stackit_network" "target_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "target-network-example"
ipv4_prefix = "192.168.10.0/25"
ipv4_nameservers = ["8.8.8.8"]
}
resource "stackit_public_ip" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
resource "stackit_loadbalancer" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-advanced-lb"
external_address = stackit_public_ip.example.ip
# Key setting for manual mode: disables automatic security group handling.
disable_security_group_assignment = true
networks = [{
network_id = stackit_network.lb_network.network_id
role = "ROLE_LISTENERS_AND_TARGETS"
}]
listeners = [{
port = 80
protocol = "PROTOCOL_TCP"
target_pool = "cross-network-pool"
}]
target_pools = [{
name = "cross-network-pool"
target_port = 80
targets = [{
display_name = stackit_server.example.name
ip = stackit_network_interface.nic.ipv4
}]
}]
}
# Create a new security group to be assigned to the target server.
resource "stackit_security_group" "target_sg" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "target-sg-for-lb-access"
description = "Allows ingress traffic from the example load balancer."
}
# Create a rule to allow traffic FROM the load balancer.
# This rule uses the computed `security_group_id` of the load balancer.
resource "stackit_security_group_rule" "allow_lb_ingress" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
security_group_id = stackit_security_group.target_sg.security_group_id
direction = "ingress"
protocol = {
name = "tcp"
}
# This is the crucial link: it allows traffic from the LB's security group.
remote_security_group_id = stackit_loadbalancer.example.security_group_id
port_range = {
min = 80
max = 80
}
}
resource "stackit_server" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-remote-target"
machine_type = "g2i.2"
availability_zone = "eu01-1"
boot_volume = {
source_type = "image"
source_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
size = 10
}
network_interfaces = [
stackit_network_interface.nic.network_interface_id
]
}
resource "stackit_network_interface" "nic" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = stackit_network.target_network.network_id
security_group_ids = [stackit_security_group.target_sg.security_group_id]
}
# End of advanced example
# Only use the import statement, if you want to import an existing loadbalancer
import {
to = stackit_loadbalancer.import-example
id = "${var.project_id},${var.region},${var.loadbalancer_name}"
}

View file

@ -1,12 +0,0 @@
resource "stackit_loadbalancer_observability_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "example-credentials"
username = "example-user"
password = "example-password"
}
# Only use the import statement, if you want to import an existing loadbalancer observability credential
import {
to = stackit_loadbalancer_observability_credential.import-example
id = "${var.project_id},${var.region},${var.credentials_ref}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_logme_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing logme credential
import {
to = stackit_logme_credential.import-example
id = "${var.project_id},${var.logme_instance_id},${var.logme_credentials_id}"
}

View file

@ -1,15 +0,0 @@
resource "stackit_logme_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
version = "2"
plan_name = "stackit-logme2-1.2.50-replica"
parameters = {
sgw_acl = "193.148.160.0/19,45.129.40.0/21,45.135.244.0/22"
}
}
# Only use the import statement, if you want to import an existing logme instance
import {
to = stackit_logme_instance.import-example
id = "${var.project_id},${var.logme_instance_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_mariadb_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing mariadb credential
import {
to = stackit_mariadb_credential.import-example
id = "${var.project_id},${var.mariadb_instance_id},${var.mariadb_credential_id}"
}

View file

@ -1,15 +0,0 @@
resource "stackit_mariadb_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
version = "10.11"
plan_name = "stackit-mariadb-1.2.10-replica"
parameters = {
sgw_acl = "193.148.160.0/19,45.129.40.0/21,45.135.244.0/22"
}
}
# Only use the import statement, if you want to import an existing mariadb instance
import {
to = stackit_mariadb_instance.import-example
id = "${var.project_id},${var.mariadb_instance_id}"
}

View file

@ -1,27 +0,0 @@
resource "stackit_mongodbflex_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
flavor = {
cpu = 1
ram = 4
}
replicas = 1
storage = {
class = "class"
size = 10
}
version = "7.0"
options = {
type = "Single"
snapshot_retention_days = 3
point_in_time_window_hours = 30
}
backup_schedule = "0 0 * * *"
}
# Only use the import statement, if you want to import an existing mongodbflex instance
import {
to = stackit_mongodbflex_instance.import-example
id = "${var.project_id},${var.region},${var.instance_id}"
}

View file

@ -1,13 +0,0 @@
resource "stackit_mongodbflex_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
username = "username"
roles = ["role"]
database = "database"
}
# Only use the import statement, if you want to import an existing mongodbflex user
import {
to = stackit_mongodbflex_user.import-example
id = "${var.project_id},${var.region},${var.instance_id},${user_id}"
}

View file

@ -1,33 +0,0 @@
resource "stackit_network" "example_with_name" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-with-name"
}
resource "stackit_network" "example_routed_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-routed-network"
labels = {
"key" = "value"
}
routed = true
}
resource "stackit_network" "example_non_routed_network" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-non-routed-network"
ipv4_nameservers = ["1.2.3.4", "5.6.7.8"]
ipv4_gateway = "10.1.2.3"
ipv4_prefix = "10.1.2.0/24"
labels = {
"key" = "value"
}
routed = false
}
# Only use the import statement, if you want to import an existing network
# Note: There will be a conflict which needs to be resolved manually.
# These attributes cannot be configured together: [ipv4_prefix,ipv4_prefix_length,ipv4_gateway]
import {
to = stackit_network.import-example
id = "${var.project_id},${var.region},${var.network_id}"
}

View file

@ -1,13 +0,0 @@
resource "stackit_network_area" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-network-area"
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing network area
import {
to = stackit_network_area.import-example
id = "${var.organization_id},${var.network_area_id}"
}

View file

@ -1,18 +0,0 @@
resource "stackit_network_area_region" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
ipv4 = {
transfer_network = "10.1.2.0/24"
network_ranges = [
{
prefix = "10.0.0.0/16"
}
]
}
}
# Only use the import statement, if you want to import an existing network area region
import {
to = stackit_network_area_region.import-example
id = "${var.organization_id},${var.network_area_id},${var.region}"
}

View file

@ -1,21 +0,0 @@
resource "stackit_network_area_route" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
destination = {
type = "cidrv4"
value = "192.168.0.0/24"
}
next_hop = {
type = "ipv4"
value = "192.168.0.0"
}
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing network area route
import {
to = stackit_network_area_route.import-example
id = "${var.organization_id},${var.network_area_id},${var.region},${var.network_area_route_id}"
}

View file

@ -1,12 +0,0 @@
resource "stackit_network_interface" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
allowed_addresses = ["192.168.0.0/24"]
security_group_ids = ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
}
# Only use the import statement, if you want to import an existing network interface
import {
to = stackit_network_interface.import-example
id = "${var.project_id},${var.region},${var.network_id},${var.network_interface_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_objectstorage_bucket" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-bucket"
}
# Only use the import statement, if you want to import an existing objectstorage bucket
import {
to = stackit_objectstorage_bucket.import-example
id = "${var.project_id},${var.region},${var.bucket_name}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_objectstorage_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_group_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
expiration_timestamp = "2027-01-02T03:04:05Z"
}
# Only use the import statement, if you want to import an existing objectstorage credential
import {
to = stackit_objectstorage_credential.import-example
id = "${var.project_id},${var.region},${var.bucket_credentials_group_id},${var.bucket_credential_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_objectstorage_credentials_group" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-credentials-group"
}
# Only use the import statement, if you want to import an existing objectstorage credential group
import {
to = stackit_objectstorage_credentials_group.import-example
id = "${var.project_id},${var.region},${var.bucket_credentials_group_id}"
}

View file

@ -1,38 +0,0 @@
resource "stackit_observability_alertgroup" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-alert-group"
interval = "60s"
rules = [
{
alert = "example-alert-name"
expression = "kube_node_status_condition{condition=\"Ready\", status=\"false\"} > 0"
for = "60s"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
{
alert = "example-alert-name-2"
expression = "kube_node_status_condition{condition=\"Ready\", status=\"false\"} > 0"
for = "1m"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
]
}
# Only use the import statement, if you want to import an existing observability alertgroup
import {
to = stackit_observability_alertgroup.import-example
id = "${var.project_id},${var.observability_instance_id},${var.observability_alertgroup_name}"
}

View file

@ -1,5 +0,0 @@
resource "stackit_observability_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
description = "Description of the credential."
}

View file

@ -1,17 +0,0 @@
resource "stackit_observability_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
plan_name = "Observability-Starter-EU01"
acl = ["1.1.1.1/32", "2.2.2.2/32"]
logs_retention_days = 30
traces_retention_days = 30
metrics_retention_days = 90
metrics_retention_days_5m_downsampling = 90
metrics_retention_days_1h_downsampling = 90
}
# Only use the import statement, if you want to import an existing observability instance
import {
to = stackit_observability_instance.import-example
id = "${var.project_id},${var.observability_instance_id}"
}

View file

@ -1,38 +0,0 @@
resource "stackit_observability_logalertgroup" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-log-alert-group"
interval = "60m"
rules = [
{
alert = "example-log-alert-name"
expression = "sum(rate({namespace=\"example\", pod=\"logger\"} |= \"Simulated error message\" [1m])) > 0"
for = "60s"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
{
alert = "example-log-alert-name-2"
expression = "sum(rate({namespace=\"example\", pod=\"logger\"} |= \"Another error message\" [1m])) > 0"
for = "60s"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
]
}
# Only use the import statement, if you want to import an existing observability logalertgroup
import {
to = stackit_observability_logalertgroup.import-example
id = "${var.project_id},${var.observability_instance_id},${var.observability_logalertgroup_name}"
}

View file

@ -1,23 +0,0 @@
resource "stackit_observability_scrapeconfig" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-job"
metrics_path = "/my-metrics"
saml2 = {
enable_url_parameters = true
}
targets = [
{
urls = ["url1", "urls2"]
labels = {
"url1" = "dev"
}
}
]
}
# Only use the import statement, if you want to import an existing observability scrapeconfig
import {
to = stackit_observability_scrapeconfig.import-example
id = "${var.project_id},${var.observability_instance_id},${var.observability_scrapeconfig_name}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_opensearch_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing opensearch credential
import {
to = stackit_opensearch_credential.import-example
id = "${var.project_id},${var.instance_id},${var.credential_id}"
}

View file

@ -1,15 +0,0 @@
resource "stackit_opensearch_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
version = "2"
plan_name = "stackit-opensearch-1.2.10-replica"
parameters = {
sgw_acl = "193.148.160.0/19,45.129.40.0/21,45.135.244.0/22"
}
}
# Only use the import statement, if you want to import an existing opensearch instance
import {
to = stackit_opensearch_instance.import-example
id = "${var.project_id},${var.instance_id}"
}

View file

@ -1,13 +0,0 @@
resource "stackit_public_ip" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing public ip
import {
to = stackit_public_ip.import-example
id = "${var.project_id},${var.region},${var.public_ip_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_public_ip_associate" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
public_ip_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing public ip associate
import {
to = stackit_public_ip_associate.import-example
id = "${var.project_id},${var.region},${var.public_ip_id},${var.network_interface_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_rabbitmq_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing rabbitmq credential
import {
to = stackit_rabbitmq_credential.import-example
id = "${var.project_id},${var.rabbitmq_instance_id},${var.rabbitmq_credential_id}"
}

View file

@ -1,18 +0,0 @@
resource "stackit_rabbitmq_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
version = "3.13"
plan_name = "stackit-rabbitmq-1.2.10-replica"
parameters = {
sgw_acl = "193.148.160.0/19,45.129.40.0/21,45.135.244.0/22"
consumer_timeout = 18000000
enable_monitoring = false
plugins = ["rabbitmq_consistent_hash_exchange", "rabbitmq_federation", "rabbitmq_tracing"]
}
}
# Only use the import statement, if you want to import an existing rabbitmq instance
import {
to = stackit_rabbitmq_instance.import-example
id = "${var.project_id},${var.rabbitmq_instance_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_redis_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing redis credential
import {
to = stackit_redis_credential.import-example
id = "${var.project_id},${var.redis_instance_id},${var.redis_credential_id}"
}

View file

@ -1,18 +0,0 @@
resource "stackit_redis_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
version = "7"
plan_name = "stackit-redis-1.2.10-replica"
parameters = {
sgw_acl = "193.148.160.0/19,45.129.40.0/21,45.135.244.0/22"
enable_monitoring = false
down_after_milliseconds = 30000
syslog = ["logs4.your-syslog-endpoint.com:54321"]
}
}
# Only use the import statement, if you want to import an existing redis instance
import {
to = stackit_redis_instance.import-example
id = "${var.project_id},${var.redis_instance_id}"
}

View file

@ -1,24 +0,0 @@
resource "stackit_resourcemanager_folder" "example" {
name = "example-folder"
owner_email = "foo.bar@stackit.cloud"
parent_container_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Note:
# You can add projects under folders.
# However, when deleting a project, be aware:
# - Projects may remain "invisible" for up to 7 days after deletion
# - During this time, deleting the parent folder may fail because the project is still technically linked
resource "stackit_resourcemanager_project" "example_project" {
name = "example-project"
owner_email = "foo.bar@stackit.cloud"
parent_container_id = stackit_resourcemanager_folder.example.container_id
}
# Only use the import statement, if you want to import an existing resourcemanager folder
# Note: There will be a conflict which needs to be resolved manually.
# Must set a configuration value for the owner_email attribute as the provider has marked it as required.
import {
to = stackit_resourcemanager_folder.import-example
id = var.container_id
}

View file

@ -1,17 +0,0 @@
resource "stackit_resourcemanager_project" "example" {
parent_container_id = "example-parent-container-abc123"
name = "example-container"
labels = {
"Label 1" = "foo"
// "networkArea" = stackit_network_area.foo.network_area_id
}
owner_email = "john.doe@stackit.cloud"
}
# Only use the import statement, if you want to import an existing resourcemanager project
# Note: There will be a conflict which needs to be resolved manually.
# Must set a configuration value for the owner_email attribute as the provider has marked it as required.
import {
to = stackit_resourcemanager_project.import-example
id = var.container_id
}

View file

@ -1,14 +0,0 @@
resource "stackit_routing_table" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example"
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing routing table
import {
to = stackit_routing_table.import-example
id = "${var.organization_id},${var.region},${var.network_area_id},${var.routing_table_id}"
}

View file

@ -1,22 +0,0 @@
resource "stackit_routing_table_route" "example" {
organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_area_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
routing_table_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
destination = {
type = "cidrv4"
value = "192.168.178.0/24"
}
next_hop = {
type = "ipv4"
value = "192.168.178.1"
}
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing routing table route
import {
to = stackit_routing_table_route.import-example
id = "${var.organization_id},${var.region},${var.network_area_id},${var.routing_table_id},${var.routing_table_route_id}"
}

View file

@ -1,18 +0,0 @@
resource "stackit_scf_organization" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example"
}
resource "stackit_scf_organization" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example"
platform_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
quota_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
suspended = false
}
# Only use the import statement, if you want to import an existing scf organization
import {
to = stackit_scf_organization.import-example
id = "${var.project_id},${var.region},${var.org_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_scf_organization_manager" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
org_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing scf org user
# The password field is still null after import and must be entered manually in the state.
import {
to = stackit_scf_organization_manager.import-example
id = "${var.project_id},${var.region},${var.org_id},${var.user_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_secretsmanager_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acls = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
}
# Only use the import statement, if you want to import an existing secretsmanager instance
import {
to = stackit_secretsmanager_instance.import-example
id = "${var.project_id},${var.secret_instance_id}"
}

View file

@ -1,12 +0,0 @@
resource "stackit_secretsmanager_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
description = "Example user"
write_enabled = false
}
# Only use the import statement, if you want to import an existing secretsmanager user
import {
to = stackit_secretsmanager_user.import-example
id = "${var.project_id},${var.secret_instance_id},${var.secret_user_id}"
}

View file

@ -1,13 +0,0 @@
resource "stackit_security_group" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "my_security_group"
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing security group
import {
to = stackit_security_group.import-example
id = "${var.project_id},${var.security_group_id}"
}

View file

@ -1,20 +0,0 @@
resource "stackit_security_group_rule" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
security_group_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
direction = "ingress"
icmp_parameters = {
code = 0
type = 8
}
protocol = {
name = "icmp"
}
}
# Only use the import statement, if you want to import an existing security group rule
# Note: There will be a conflict which needs to be resolved manually.
# Attribute "protocol.number" cannot be specified when "protocol.name" is specified.
import {
to = stackit_security_group_rule.import-example
id = "${var.project_id},${var.security_group_id},${var.security_group_rule_id}"
}

View file

@ -1,27 +0,0 @@
resource "stackit_server" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
boot_volume = {
size = 64
source_type = "image"
source_id = "59838a89-51b1-4892-b57f-b3caf598ee2f" // Ubuntu 24.04
}
availability_zone = "xxxx-x"
machine_type = "g2i.1"
network_interfaces = [
stackit_network_interface.example.network_interface_id
]
}
# Only use the import statement, if you want to import an existing server
# Note: There will be a conflict which needs to be resolved manually.
# Must set a configuration value for the boot_volume.source_type and boot_volume.source_id attribute as the provider has marked it as required.
# Since those attributes are not fetched in general from the API call, after adding them this would replace your server resource after an terraform apply.
# In order to prevent this you need to add:
# lifecycle {
# ignore_changes = [ boot_volume ]
# }
import {
to = stackit_server.import-example
id = "${var.project_id},${var.region},${var.server_id}"
}

View file

@ -1,18 +0,0 @@
resource "stackit_server_backup_schedule" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example_backup_schedule_name"
rrule = "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1"
enabled = true
backup_properties = {
name = "example_backup_name"
retention_period = 14
volume_ids = null
}
}
# Only use the import statement, if you want to import an existing server backup schedule
import {
to = stackit_server_backup_schedule.import-example
id = "${var.project_id},${var.region},${var.server_id},${var.server_backup_schedule_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_server_network_interface_attach" "attached_network_interface" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing server network interface attachment
import {
to = stackit_server_network_interface_attach.import-example
id = "${var.project_id},${var.region},${var.server_id},${var.network_interface_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_server_service_account_attach" "attached_service_account" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
service_account_email = "service-account@stackit.cloud"
}
# Only use the import statement, if you want to import an existing server service account attachment
import {
to = stackit_server_service_account_attach.import-example
id = "${var.project_id},${var.region},${var.server_id},${var.service_account_email}"
}

View file

@ -1,14 +0,0 @@
resource "stackit_server_update_schedule" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example_update_schedule_name"
rrule = "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1"
enabled = true
maintenance_window = 1
}
# Only use the import statement, if you want to import an existing server update schedule
import {
to = stackit_server_update_schedule.import-example
id = "${var.project_id},${var.region},${var.server_id},${var.server_update_schedule_id}"
}

View file

@ -1,11 +0,0 @@
resource "stackit_server_volume_attach" "attached_volume" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
volume_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Only use the import statement, if you want to import an existing server volume attachment
import {
to = stackit_server_volume_attach.import-example
id = "${var.project_id},${var.region},${var.server_id},${var.volume_id}"
}

View file

@ -1,10 +0,0 @@
resource "stackit_service_account" "sa" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "sa01"
}
# Only use the import statement, if you want to import an existing service account
import {
to = stackit_service_account.import-example
id = "${var.project_id},${var.service_account_email}"
}

View file

@ -1,27 +0,0 @@
resource "stackit_ske_cluster" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example"
kubernetes_version_min = "x.x"
node_pools = [
{
name = "np-example"
machine_type = "x.x"
os_version = "x.x.x"
minimum = "2"
maximum = "3"
availability_zones = ["eu01-3"]
}
]
maintenance = {
enable_kubernetes_version_updates = true
enable_machine_image_version_updates = true
start = "01:00:00Z"
end = "02:00:00Z"
}
}
# Only use the import statement, if you want to import an existing ske cluster
import {
to = stackit_ske_cluster.import-example
id = "${var.project_id},${var.region},${var.ske_name}"
}

View file

@ -1,8 +0,0 @@
resource "stackit_ske_kubeconfig" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
cluster_name = "example-cluster"
refresh = true
expiration = 7200 # 2 hours
refresh_before = 3600 # 1 hour
}

View file

@ -1,15 +0,0 @@
resource "stackit_volume" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "my_volume"
availability_zone = "eu01-1"
size = 64
labels = {
"key" = "value"
}
}
# Only use the import statement, if you want to import an existing volume
import {
to = stackit_volume.import-example
id = "${var.project_id},${var.region},${var.volume_id}"
}

View file

@ -1,4 +1,6 @@
resource "stackit_postgresflex_database" "example" {
# Copyright (c) STACKIT
resource "stackitprivatepreview_postgresflexalpha_database" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "mydb"
@ -7,6 +9,6 @@ resource "stackit_postgresflex_database" "example" {
# Only use the import statement, if you want to import an existing postgresflex database
import {
to = stackit_postgresflex_database.import-example
to = stackitprivatepreview_postgresflexalpha_database.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.postgres_database_id}"
}

View file

@ -1,4 +1,6 @@
resource "stackit_postgresflex_instance" "example" {
# Copyright (c) STACKIT
resource "stackitprivatepreview_postgresflexalpha_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
@ -17,6 +19,6 @@ resource "stackit_postgresflex_instance" "example" {
# Only use the import statement, if you want to import an existing postgresflex instance
import {
to = stackit_postgresflex_instance.import-example
to = stackitprivatepreview_postgresflexalpha_instance.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id}"
}

View file

@ -1,4 +1,6 @@
resource "stackit_postgresflex_user" "example" {
# Copyright (c) STACKIT
resource "stackitprivatepreview_postgresflexalpha_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
username = "username"
@ -7,6 +9,6 @@ resource "stackit_postgresflex_user" "example" {
# Only use the import statement, if you want to import an existing postgresflex user
import {
to = stackit_postgresflex_user.import-example
to = stackitprivatepreview_postgresflexalpha_user.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.user_id}"
}

View file

@ -1,4 +1,6 @@
resource "stackit_sqlserverflex_instance" "example" {
# Copyright (c) STACKIT
resource "stackitprivatepreview_sqlserverflexalpha_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acl = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
@ -16,6 +18,6 @@ resource "stackit_sqlserverflex_instance" "example" {
# Only use the import statement, if you want to import an existing sqlserverflex instance
import {
to = stackit_sqlserverflex_instance.import-example
to = stackitprivatepreview_sqlserverflexalpha_instance.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id}"
}

View file

@ -1,4 +1,6 @@
resource "stackit_sqlserverflex_user" "example" {
# Copyright (c) STACKIT
resource "stackitprivatepreview_sqlserverflexalpha_user" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
username = "username"
@ -7,6 +9,6 @@ resource "stackit_sqlserverflex_user" "example" {
# Only use the import statement, if you want to import an existing sqlserverflex user
import {
to = stackit_sqlserverflex_user.import-example
to = stackitprivatepreview_sqlserverflexalpha_user.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}"
}