Skip to content

Commit 2109a3f

Browse files
authored
docs(lb): various fixes (#872)
docs: load_balancer target block is deprecated The `target` block in `hcloud_load_balancer` was deprecated 3 years ago[0] and not even documented on the docs page. For clarity the example should not use it. [0] 14c1000 docs: fix broken load_balancer_network example The example does not specify the dependency on the subnet resource. This can cause a race condition when the Load Balancer is attached to the network before the subnet is created.
1 parent 2122ad7 commit 2109a3f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

website/docs/r/load_balancer.html.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ description: |-
88

99
# hcloud_load_balancer
1010

11-
Provides a Hetzner Cloud Load Balancer to represent a Load Balancer in the Hetzner Cloud.
11+
Provides a Hetzner Cloud Load Balancer to represent a Load Balancer in the Hetzner Cloud.
1212

1313
## Example Usage
1414

1515
```hcl
16-
resource "hcloud_server" "myserver" {
16+
resource "hcloud_server" "my_server" {
1717
name = "server-%d"
1818
server_type = "cx11"
1919
image = "ubuntu-18.04"
@@ -23,10 +23,12 @@ resource "hcloud_load_balancer" "load_balancer" {
2323
name = "my-load-balancer"
2424
load_balancer_type = "lb11"
2525
location = "nbg1"
26-
target {
27-
type = "server"
28-
server_id = hcloud_server.myserver.id
29-
}
26+
}
27+
28+
resource "hcloud_load_balancer_target" "load_balancer_target" {
29+
type = "server"
30+
load_balancer_id = hcloud_load_balancer.load_balancer.id
31+
server_id = hcloud_server.my_server.id
3032
}
3133
```
3234

website/docs/r/load_balancer_network.html.md

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ resource "hcloud_load_balancer_network" "srvnetwork" {
3535
load_balancer_id = hcloud_load_balancer.lb1.id
3636
network_id = hcloud_network.mynet.id
3737
ip = "10.0.1.5"
38+
39+
# **Note**: the depends_on is important when directly attaching the
40+
# server to a network. Otherwise Terraform will attempt to create
41+
# server and sub-network in parallel. This may result in the server
42+
# creation failing randomly.
43+
depends_on = [
44+
hcloud_network_subnet.srvnetwork
45+
]
3846
}
3947
```
4048

0 commit comments

Comments
 (0)