Skip to content

Commit eb3047b

Browse files
authored
Merge pull request #166 from alrayyes/feat/target-group-resource
feat: implement target group resource
2 parents d7562dd + 1e00399 commit eb3047b

File tree

11 files changed

+1380
-49
lines changed

11 files changed

+1380
-49
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "leaseweb_public_cloud_target_group Resource - leaseweb"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# leaseweb_public_cloud_target_group (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Manage example Public Cloud non TCP target group
17+
resource "leaseweb_public_cloud_target_group" "example" {
18+
name = "test"
19+
protocol = "HTTP"
20+
port = 80
21+
region = "eu-west-3"
22+
health_check = {
23+
port = 80
24+
protocol = "HTTP"
25+
method = "GET"
26+
host = "example.com"
27+
uri = "/endpoint"
28+
}
29+
}
30+
31+
# Manage example Public Cloud target group with a health check
32+
resource "leaseweb_public_cloud_target_group" "example" {
33+
name = "test"
34+
protocol = "HTTP"
35+
port = 80
36+
region = "eu-west-3"
37+
health_check = {
38+
port = 80
39+
protocol = "TCP"
40+
host = "example.com"
41+
}
42+
}
43+
44+
# Manage example Public Cloud without a health check
45+
resource "leaseweb_public_cloud_target_group" "example" {
46+
name = "test"
47+
protocol = "HTTP"
48+
port = 80
49+
region = "eu-west-3"
50+
}
51+
```
52+
53+
<!-- schema generated by tfplugindocs -->
54+
## Schema
55+
56+
### Required
57+
58+
- `name` (String) The Name of the target group
59+
- `port` (Number) The port of the target group
60+
- `protocol` (String) Valid options are
61+
- *HTTP*
62+
- *HTTPS*
63+
- *TCP*
64+
65+
**WARNING!** Changing this value once running will cause this target group to be destroyed and a new one to be created.
66+
- `region` (String) Valid options are
67+
- *eu-west-3*
68+
- *us-east-1*
69+
- *eu-central-1*
70+
- *ap-southeast-1*
71+
- *us-west-1*
72+
- *eu-west-2*
73+
- *ca-central-1*
74+
75+
**WARNING!** Changing this value once running will cause this target group to be destroyed and a new one to be created.
76+
77+
### Optional
78+
79+
- `health_check` (Attributes) **WARNING!** Removing health_check once running will cause this target group to be destroyed and a new one to be created. (see [below for nested schema](#nestedatt--health_check))
80+
81+
### Read-Only
82+
83+
- `id` (String) The ID of this resource.
84+
85+
<a id="nestedatt--health_check"></a>
86+
### Nested Schema for `health_check`
87+
88+
Required:
89+
90+
- `port` (Number) Port number
91+
- `protocol` (String) Valid options are
92+
- *HTTP*
93+
- *HTTPS*
94+
- *TCP*
95+
- `uri` (String) URI to check in the target instances
96+
97+
Optional:
98+
99+
- `host` (String) Host for the health check if any
100+
- `method` (String) Required if `protocol` is `HTTP` or `HTTPS`. Valid options are
101+
- *GET*
102+
- *HEAD*
103+
- *POST*
104+
- *OPTIONS*
105+
106+
## Import
107+
108+
Import is supported using the following syntax:
109+
110+
```shell
111+
# Public Cloud target group can be imported by specifying the identifier.
112+
terraform import leaseweb_public_cloud_target_group.example ace712e9-a166-47f1-9065-4af0f7e7fce1
113+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Public Cloud target group can be imported by specifying the identifier.
2+
terraform import leaseweb_public_cloud_target_group.example ace712e9-a166-47f1-9065-4af0f7e7fce1
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Manage example Public Cloud non TCP target group
2+
resource "leaseweb_public_cloud_target_group" "example" {
3+
name = "test"
4+
protocol = "HTTP"
5+
port = 80
6+
region = "eu-west-3"
7+
health_check = {
8+
port = 80
9+
protocol = "HTTP"
10+
method = "GET"
11+
host = "example.com"
12+
uri = "/endpoint"
13+
}
14+
}
15+
16+
# Manage example Public Cloud target group with a health check
17+
resource "leaseweb_public_cloud_target_group" "example" {
18+
name = "test"
19+
protocol = "HTTP"
20+
port = 80
21+
region = "eu-west-3"
22+
health_check = {
23+
port = 80
24+
protocol = "TCP"
25+
host = "example.com"
26+
}
27+
}
28+
29+
# Manage example Public Cloud without a health check
30+
resource "leaseweb_public_cloud_target_group" "example" {
31+
name = "test"
32+
protocol = "HTTP"
33+
port = 80
34+
region = "eu-west-3"
35+
}

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ require (
88
github.com/hashicorp/terraform-plugin-go v0.25.0
99
github.com/hashicorp/terraform-plugin-log v0.9.0
1010
github.com/hashicorp/terraform-plugin-testing v1.11.0
11-
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241114082959-9d682d73a40d
12-
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241118100223-cb6c58ec7524
11+
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241120152414-2fcb9e9d047f
12+
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241120152414-2fcb9e9d047f
1313
github.com/stretchr/testify v1.9.0
1414
)
1515

@@ -62,7 +62,7 @@ require (
6262
golang.org/x/text v0.20.0 // indirect
6363
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
6464
google.golang.org/appengine v1.6.8 // indirect
65-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect
65+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect
6666
google.golang.org/grpc v1.68.0 // indirect
6767
google.golang.org/protobuf v1.35.2 // indirect
6868
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
103103
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
104104
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
105105
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
106-
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241114082959-9d682d73a40d h1:p+eFICnmxAUq8eK32xcMHQtP98SO3bnpemZYDi1NSJ4=
107-
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241114082959-9d682d73a40d/go.mod h1:MSrebSkGmRy0OzTJd+lDXsILYms/13QO7GfNNK/5Mds=
108-
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241118100223-cb6c58ec7524 h1:vkv7RmPoXvg2AcW9mTpJ82IWYw5H5KXwP+icMnvXl/U=
109-
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241118100223-cb6c58ec7524/go.mod h1:nh4tvDxdD+xNL9qjFqtL1ZL49w+HJq5kMeTKkPs2XHI=
106+
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241120152414-2fcb9e9d047f h1:y94yFJythFFHUo3ZyxjbG50OOARYuXi3gJGwz3r8lMU=
107+
github.com/leaseweb/leaseweb-go-sdk/dedicatedServer v0.0.0-20241120152414-2fcb9e9d047f/go.mod h1:MSrebSkGmRy0OzTJd+lDXsILYms/13QO7GfNNK/5Mds=
108+
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241120152414-2fcb9e9d047f h1:QF/QPuYotlj3YOpjgocXH93jffrKVu7ii7J/UM/epGU=
109+
github.com/leaseweb/leaseweb-go-sdk/publicCloud v0.0.0-20241120152414-2fcb9e9d047f/go.mod h1:nh4tvDxdD+xNL9qjFqtL1ZL49w+HJq5kMeTKkPs2XHI=
110110
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
111111
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
112112
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
@@ -205,8 +205,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
205205
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
206206
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
207207
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
208-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f h1:C1QccEa9kUwvMgEUORqQD9S17QesQijxjZ84sO82mfo=
209-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
208+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA=
209+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
210210
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
211211
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
212212
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=

internal/provider/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,6 @@ func (p *leasewebProvider) Resources(_ context.Context) []func() resource.Resour
179179
publiccloud.NewImageResource,
180180
publiccloud.NewLoadBalancerResource,
181181
publiccloud.NewLoadBalancerListenerResource,
182+
publiccloud.NewTargetGroupResource,
182183
}
183184
}

0 commit comments

Comments
 (0)