From 818591cf9fc9ad3f390ebcd42e9eb64112ff9e73 Mon Sep 17 00:00:00 2001 From: Max Schlotterbeck Date: Thu, 14 Nov 2024 15:00:19 +0100 Subject: [PATCH 1/2] improve resource documentation for STACKIT LoadBalancer Service --- docs/resources/loadbalancer.md | 9 ++++++++- examples/resources/stackit_loadbalancer/resource.tf | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/resources/loadbalancer.md b/docs/resources/loadbalancer.md index a4553d68..5c3e6526 100644 --- a/docs/resources/loadbalancer.md +++ b/docs/resources/loadbalancer.md @@ -64,7 +64,9 @@ provider "openstack" { ### Configuring the supporting infrastructure -The example below uses OpenStack to create the network, router, a public IP address and a compute instance. +The example below uses OpenStack to create the network, router, a public IP address and a compute instance. +The STACKIT Loadbalancer Service automatically adjust necessary Security Groups to its targets, +to avoid unnecessary changes in the terraform plan utilising the lifecycle function of terraform can be used. ## Example Usage @@ -116,6 +118,11 @@ resource "openstack_compute_instance_v2" "example" { network { name = openstack_networking_network_v2.example.name } + + lifecycle { + # Security groups are modified by the STACKIT LoadBalancer Service, so terraform should ignore changes here + ignore_changes = [security_groups] + } } # Create a router and attach it to the public network diff --git a/examples/resources/stackit_loadbalancer/resource.tf b/examples/resources/stackit_loadbalancer/resource.tf index a1167264..2b32188f 100644 --- a/examples/resources/stackit_loadbalancer/resource.tf +++ b/examples/resources/stackit_loadbalancer/resource.tf @@ -45,6 +45,11 @@ resource "openstack_compute_instance_v2" "example" { network { name = openstack_networking_network_v2.example.name } + + lifecycle { + # Security groups are modified by the STACKIT LoadBalancer Service, so terraform should ignore changes here + ignore_changes = [security_groups] + } } # Create a router and attach it to the public network From 5d1dbcf19fb6d097d4d68df7252c4affa95d724d Mon Sep 17 00:00:00 2001 From: Max Schlotterbeck Date: Fri, 15 Nov 2024 12:19:45 +0100 Subject: [PATCH 2/2] terraform fmt --- examples/resources/stackit_loadbalancer/resource.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/resources/stackit_loadbalancer/resource.tf b/examples/resources/stackit_loadbalancer/resource.tf index 2b32188f..cfd99642 100644 --- a/examples/resources/stackit_loadbalancer/resource.tf +++ b/examples/resources/stackit_loadbalancer/resource.tf @@ -48,7 +48,7 @@ resource "openstack_compute_instance_v2" "example" { lifecycle { # Security groups are modified by the STACKIT LoadBalancer Service, so terraform should ignore changes here - ignore_changes = [security_groups] + ignore_changes = [security_groups] } }