chore(examples): Add import examples for all resources (#939)

* chore(examples): Add import examples for all resources

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>

* Add guide: How to import resources

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>

---------

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
This commit is contained in:
Alexander Dahmen 2025-08-08 14:03:27 +02:00 committed by GitHub
parent e62729679e
commit 721e10a02f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
118 changed files with 837 additions and 5 deletions

View file

@ -0,0 +1,27 @@
---
page_title: "How to import an existing resources"
---
# How to import an existing resources?
## 1. **Create a terraform config file and add an import block for your resource**
In order to import an existing resources in terraform you need to add an import block for the corresponding resource in a terraform config file.
There is an example for every resource under the [examples](../../examples/) folder.
E.g. the import statement for a `stackit_volume` looks like the following:
```terraform
import {
to = stackit_volume.import-example
id = "${var.project_id},${var.volume_id}"
}
```
## 2. **Generate the destination resource automatically**
Run `terraform plan -generate-config-out=generated.tf` to let terraform generate the configuration for you.
In this step the `stackit_volume.import-example` resource is generated and filled with informations of your existing resource.
## 3. **Finish the import**
Run `terraform apply` to add your resource to the terraform state.

View file

@ -87,6 +87,12 @@ resource "stackit_affinity_group" "example" {
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.affinity_group_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,6 +21,12 @@ resource "stackit_authorization_organization_role_assignment" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,6 +21,12 @@ resource "stackit_authorization_project_role_assignment" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,6 +21,12 @@ resource "stackit_cdn_custom_domain" "example" {
distribution_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "https://xxx.xxx"
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,7 +21,7 @@ resource "stackit_cdn_distribution" "example_distribution" {
config = {
backend = {
type = "http"
origin_url = "mybackend.onstackit.cloud"
origin_url = "https://mybackend.onstackit.cloud"
}
regions = ["EU", "US", "ASIA", "AF", "SA"]
blocked_countries = ["DE", "AT", "CH"]
@ -31,6 +31,12 @@ resource "stackit_cdn_distribution" "example_distribution" {
}
}
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,6 +21,12 @@ resource "stackit_dns_record_set" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -23,6 +23,12 @@ resource "stackit_dns_zone" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -29,6 +29,12 @@ resource "stackit_git" "git" {
]
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -21,6 +21,18 @@ resource "stackit_image" "example_image" {
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.image_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -53,7 +53,21 @@ resource "stackit_server" "example-server" {
```
## Example Usage
```terraform
# 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
}
```
<!-- schema generated by tfplugindocs -->
## Schema

View file

@ -109,6 +109,12 @@ resource "stackit_loadbalancer" "example" {
private_network_only = false
}
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_loadbalancer_observability_credential" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_logme_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_mariadb_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -34,6 +34,12 @@ resource "stackit_mongodbflex_instance" "example" {
}
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -20,6 +20,12 @@ resource "stackit_mongodbflex_user" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -39,6 +39,14 @@ resource "stackit_network" "example_non_routed_network" {
}
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.network_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -26,6 +26,12 @@ resource "stackit_network_area" "example" {
"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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_network_area_route" "example" {
"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.network_area_route_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_network_interface" "example" {
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.network_id},${var.network_interface_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -18,6 +18,12 @@ resource "stackit_objectstorage_credential" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -45,6 +45,12 @@ resource "stackit_observability_alertgroup" "example" {
},
]
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_observability_instance" "example" {
metrics_retention_days_5m_downsampling = 10
metrics_retention_days_1h_downsampling = 5
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -45,6 +45,12 @@ resource "stackit_observability_logalertgroup" "example" {
},
]
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -30,6 +30,12 @@ resource "stackit_observability_scrapeconfig" "example" {
}
]
}
# 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_opensearch_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_postgresflex_database" "example" {
name = "mydb"
owner = "myusername"
}
# Only use the import statement, if you want to import an existing postgresflex database
import {
to = stackit_postgresflex_database.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.postgres_database_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -29,6 +29,12 @@ resource "stackit_postgresflex_instance" "example" {
}
version = 14
}
# Only use the import statement, if you want to import an existing postgresflex instance
import {
to = stackit_postgresflex_instance.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_postgresflex_user" "example" {
username = "username"
roles = ["role"]
}
# Only use the import statement, if you want to import an existing postgresflex user
import {
to = stackit_postgresflex_user.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.user_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -20,6 +20,12 @@ resource "stackit_public_ip" "example" {
"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.public_ip_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -23,6 +23,12 @@ resource "stackit_public_ip_associate" "example" {
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.public_ip_id},${var.network_interface_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -25,6 +25,12 @@ resource "stackit_rabbitmq_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -25,6 +25,12 @@ resource "stackit_redis_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -25,6 +25,14 @@ resource "stackit_resourcemanager_project" "example" {
}
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
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -24,6 +24,12 @@ resource "stackit_routing_table" "example" {
"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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -32,6 +32,12 @@ resource "stackit_routing_table_route" "example" {
"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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -18,6 +18,12 @@ resource "stackit_secretsmanager_instance" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_secretsmanager_user" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -20,6 +20,12 @@ resource "stackit_security_group" "example" {
"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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -25,6 +25,14 @@ resource "stackit_security_group_rule" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -360,7 +360,37 @@ resource "stackit_server" "user-data-from-file" {
```
## Example Usage
```terraform
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 = "g1.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.server_id}"
}
```
<!-- schema generated by tfplugindocs -->
## Schema

View file

@ -28,6 +28,12 @@ resource "stackit_server_backup_schedule" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -18,6 +18,12 @@ resource "stackit_server_network_interface_attach" "attached_network_interface"
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.server_id},${var.network_interface_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -18,6 +18,12 @@ resource "stackit_server_service_account_attach" "attached_service_account" {
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.server_id},${var.service_account_email}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -24,6 +24,12 @@ resource "stackit_server_update_schedule" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -18,6 +18,12 @@ resource "stackit_server_volume_attach" "attached_volume" {
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.server_id},${var.volume_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -17,6 +17,12 @@ 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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -37,6 +37,12 @@ resource "stackit_ske_cluster" "example" {
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}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -28,6 +28,12 @@ resource "stackit_sqlserverflex_instance" "example" {
}
version = 2022
}
# Only use the import statement, if you want to import an existing sqlserverflex instance
import {
to = stackit_sqlserverflex_instance.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -19,6 +19,12 @@ resource "stackit_sqlserverflex_user" "example" {
username = "username"
roles = ["role"]
}
# Only use the import statement, if you want to import an existing sqlserverflex user
import {
to = stackit_sqlserverflex_user.import-example
id = "${var.project_id},${var.region},${var.sql_instance_id},${var.sql_user_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -22,6 +22,12 @@ resource "stackit_volume" "example" {
"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.volume_id}"
}
```
<!-- schema generated by tfplugindocs -->

View file

@ -2,4 +2,10 @@ 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.affinity_group_id}"
}

View file

@ -3,3 +3,9 @@ resource "stackit_authorization_organization_role_assignment" "example" {
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

@ -3,3 +3,9 @@ resource "stackit_authorization_project_role_assignment" "example" {
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

@ -3,3 +3,9 @@ resource "stackit_cdn_custom_domain" "example" {
distribution_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "https://xxx.xxx"
}
# 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

@ -3,7 +3,7 @@ resource "stackit_cdn_distribution" "example_distribution" {
config = {
backend = {
type = "http"
origin_url = "mybackend.onstackit.cloud"
origin_url = "https://mybackend.onstackit.cloud"
}
regions = ["EU", "US", "ASIA", "AF", "SA"]
blocked_countries = ["DE", "AT", "CH"]
@ -13,3 +13,9 @@ resource "stackit_cdn_distribution" "example_distribution" {
}
}
}
# 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

@ -6,3 +6,9 @@ resource "stackit_dns_record_set" "example" {
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

@ -8,3 +8,9 @@ resource "stackit_dns_zone" "example" {
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

@ -10,4 +10,10 @@ resource "stackit_git" "git" {
"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

@ -6,3 +6,15 @@ resource "stackit_image" "example_image" {
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.image_id}"
}

View file

@ -0,0 +1,11 @@
# 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

@ -89,4 +89,10 @@ resource "stackit_loadbalancer" "example" {
options = {
private_network_only = false
}
}
}
# 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

@ -4,3 +4,9 @@ resource "stackit_loadbalancer_observability_credential" "example" {
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

@ -2,3 +2,9 @@ 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

@ -7,3 +7,9 @@ resource "stackit_logme_instance" "example" {
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

@ -2,3 +2,9 @@ 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

@ -7,3 +7,9 @@ resource "stackit_mariadb_instance" "example" {
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

@ -19,3 +19,9 @@ resource "stackit_mongodbflex_instance" "example" {
}
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

@ -5,3 +5,9 @@ resource "stackit_mongodbflex_user" "example" {
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

@ -23,4 +23,12 @@ resource "stackit_network" "example_non_routed_network" {
"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.network_id}"
}

View file

@ -11,3 +11,9 @@ resource "stackit_network_area" "example" {
"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

@ -7,3 +7,9 @@ resource "stackit_network_area_route" "example" {
"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.network_area_route_id}"
}

View file

@ -3,4 +3,10 @@ resource "stackit_network_interface" "example" {
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.network_id},${var.network_interface_id}"
}

View file

@ -2,3 +2,9 @@ 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

@ -3,3 +3,9 @@ resource "stackit_objectstorage_credential" "example" {
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

@ -2,3 +2,9 @@ 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

@ -29,4 +29,10 @@ resource "stackit_observability_alertgroup" "example" {
}
},
]
}
}
# 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

@ -7,3 +7,9 @@ resource "stackit_observability_instance" "example" {
metrics_retention_days_5m_downsampling = 10
metrics_retention_days_1h_downsampling = 5
}
# 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

@ -29,4 +29,10 @@ resource "stackit_observability_logalertgroup" "example" {
}
},
]
}
}
# 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

@ -15,3 +15,9 @@ resource "stackit_observability_scrapeconfig" "example" {
}
]
}
# 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

@ -2,3 +2,9 @@ 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

@ -7,3 +7,9 @@ resource "stackit_opensearch_instance" "example" {
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

@ -4,3 +4,9 @@ resource "stackit_postgresflex_database" "example" {
name = "mydb"
owner = "myusername"
}
# Only use the import statement, if you want to import an existing postgresflex database
import {
to = stackit_postgresflex_database.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.postgres_database_id}"
}

View file

@ -14,3 +14,9 @@ resource "stackit_postgresflex_instance" "example" {
}
version = 14
}
# Only use the import statement, if you want to import an existing postgresflex instance
import {
to = stackit_postgresflex_instance.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id}"
}

View file

@ -4,3 +4,9 @@ resource "stackit_postgresflex_user" "example" {
username = "username"
roles = ["role"]
}
# Only use the import statement, if you want to import an existing postgresflex user
import {
to = stackit_postgresflex_user.import-example
id = "${var.project_id},${var.region},${var.postgres_instance_id},${var.user_id}"
}

View file

@ -5,3 +5,9 @@ resource "stackit_public_ip" "example" {
"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.public_ip_id}"
}

View file

@ -3,3 +3,9 @@ resource "stackit_public_ip_associate" "example" {
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.public_ip_id},${var.network_interface_id}"
}

View file

@ -2,3 +2,9 @@ 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

@ -10,3 +10,9 @@ resource "stackit_rabbitmq_instance" "example" {
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

@ -2,3 +2,9 @@ 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

@ -10,3 +10,9 @@ resource "stackit_redis_instance" "example" {
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

@ -7,3 +7,11 @@ resource "stackit_resourcemanager_project" "example" {
}
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
}

Some files were not shown because too many files have changed in this diff Show more