feat: region adjustment for load balancer (#721)

* remove deprecated "credential" resource of loadbalancer

* region adjustment load balancer
- adapted load balancer example
This commit is contained in:
Marcel Jacek 2025-03-25 11:36:26 +01:00 committed by GitHub
parent 1444376f35
commit 176fb8408f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 250 additions and 624 deletions

View file

@ -27,10 +27,14 @@ data "stackit_loadbalancer" "example" {
- `name` (String) Load balancer name.
- `project_id` (String) STACKIT project ID to which the Load Balancer is associated.
### Optional
- `region` (String) The resource region. If not defined, the provider region is used.
### Read-Only
- `external_address` (String) External Load Balancer IP address where this Load Balancer is exposed.
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","`name`".
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","region","`name`".
- `listeners` (Attributes List) List of all listeners which will accept traffic. Limited to 20. (see [below for nested schema](#nestedatt--listeners))
- `networks` (Attributes List) List of networks that listeners and targets reside in. (see [below for nested schema](#nestedatt--networks))
- `options` (Attributes) Defines any optional functionality you want to have enabled on your load balancer. (see [below for nested schema](#nestedatt--options))

View file

@ -35,10 +35,12 @@ resource "stackit_network_interface" "nic" {
network_id = stackit_network.example_network.network_id
}
# Create a public IP and assign it to the network interface
# Create a public IP for the load balancer
resource "stackit_public_ip" "public-ip" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
network_interface_id = stackit_network_interface.nic.network_interface_id
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
lifecycle {
ignore_changes = [network_interface_id]
}
}
# Create a key pair for accessing the server instance
@ -48,7 +50,7 @@ resource "stackit_key_pair" "keypair" {
}
# Create a server instance
resource "stackit_server" "boot-from-volume" {
resource "stackit_server" "boot-from-image" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
boot_volume = {
@ -64,7 +66,7 @@ resource "stackit_server" "boot-from-volume" {
# Attach the network interface to the server
resource "stackit_server_network_interface_attach" "nic-attachment" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
server_id = stackit_server.boot-from-volume.server_id
server_id = stackit_server.boot-from-image.server_id
network_interface_id = stackit_network_interface.nic.network_interface_id
}
@ -78,7 +80,7 @@ resource "stackit_loadbalancer" "example" {
target_port = 80
targets = [
{
display_name = "example-target"
display_name = stackit_server.boot-from-image.name
ip = stackit_network_interface.nic.ipv4
}
]
@ -127,10 +129,11 @@ resource "stackit_loadbalancer" "example" {
- `external_address` (String) External Load Balancer IP address where this Load Balancer is exposed.
- `options` (Attributes) Defines any optional functionality you want to have enabled on your load balancer. (see [below for nested schema](#nestedatt--options))
- `region` (String) The resource region. If not defined, the provider region is used.
### Read-Only
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","`name`".
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","region","`name`".
- `private_address` (String) Transient private Load Balancer IP address. It can change any time.
<a id="nestedatt--listeners"></a>

View file

@ -1,40 +0,0 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_loadbalancer_credential Resource - stackit"
subcategory: ""
description: |-
Load balancer credential resource schema. Must have a region specified in the provider configuration.
!> The stackit_loadbalancer_credential resource has been deprecated and will be removed after November 13th 2024. Please use stackit_loadbalancer_observability_credential instead, which offers the exact same functionality.
---
# stackit_loadbalancer_credential (Resource)
Load balancer credential resource schema. Must have a `region` specified in the provider configuration.
!> The `stackit_loadbalancer_credential` resource has been deprecated and will be removed after November 13th 2024. Please use `stackit_loadbalancer_observability_credential` instead, which offers the exact same functionality.
## Example Usage
```terraform
resource "stackit_loadbalancer_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
display_name = "example-credentials"
username = "example-user"
password = "example-password"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `display_name` (String) Credential name.
- `password` (String) The password used for the ARGUS instance.
- `project_id` (String) STACKIT project ID to which the load balancer credential is associated.
- `username` (String) The username used for the ARGUS instance.
### Read-Only
- `credentials_ref` (String) The credentials reference can be used for observability of the Load Balancer.
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","`credentials_ref`".

View file

@ -31,7 +31,11 @@ resource "stackit_loadbalancer_observability_credential" "example" {
- `project_id` (String) STACKIT project ID to which the load balancer observability credential is associated.
- `username` (String) The password for the observability service (e.g. Argus) where the logs/metrics will be pushed into.
### Optional
- `region` (String) The resource region. If not defined, the provider region is used.
### Read-Only
- `credentials_ref` (String) The credentials reference is used by the Load Balancer to define which credentials it will use.
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","`credentials_ref`".
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`","region","`credentials_ref`".