Skip to content

Commit 308d1da

Browse files
docs: add docs for PCG IPAM pool and the data resource (#514)
* docs: add docs for PCG IPAM pool and the data resource * chore: minor example touch up. * chore: issued go fmt
1 parent f67d5c0 commit 308d1da

File tree

6 files changed

+161
-37
lines changed

6 files changed

+161
-37
lines changed
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
---
2-
# generated by https://github.com/hashicorp/terraform-plugin-docs
32
page_title: "spectrocloud_private_cloud_gateway Data Source - terraform-provider-spectrocloud"
43
subcategory: ""
54
description: |-
6-
5+
A data resource to get the ID or name of Private Cloud Gateway.
76
---
87

98
# spectrocloud_private_cloud_gateway (Data Source)
109

10+
A data resource to get the ID or name of Private Cloud Gateway.
1111

12+
To learn more about Private Cloud Gateways, review the [Private Cloud Gateway](https://docs.spectrocloud.com/clusters/pcg/) documentation.
1213

14+
## Example Usage
1315

1416

17+
```hcl
18+
data "spectrocloud_private_cloud_gateway" "pcg" {
19+
name = "wst-1-pcg"
20+
}
21+
22+
```
23+
1524
<!-- schema generated by tfplugindocs -->
1625
## Schema
1726

1827
### Optional
1928

2029
- `id` (String) The ID of Private Cloud Gateway.
21-
- `name` (String) The Name of Private Cloud Gateway.
30+
- `name` (String) The name of Private Cloud Gateway.

docs/resources/privatecloudgateway_ippool.md

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,76 @@
22
page_title: "spectrocloud_privatecloudgateway_ippool Resource - terraform-provider-spectrocloud"
33
subcategory: ""
44
description: |-
5-
5+
A Resource to manage IP pools for Private Cloud Gateway.
66
---
77

88
# spectrocloud_privatecloudgateway_ippool (Resource)
99

10-
10+
A Resource to manage IP pools for Private Cloud Gateway.
1111

12-
## Example Usage
12+
You can learn more about Private Cloud Gateways IP Pools by revewing the [Create and Manage IPAM Node Pools](https://docs.spectrocloud.com/clusters/pcg/manage-pcg/create-manage-node-pool/) guide.
1313

14+
## Example Usage
1415

16+
An example of creating an IP Pool for a Private Cloud Gateway using a range of IP addresses and restricting the IP Pool to a single cluster.
17+
18+
```hcl
19+
data "spectrocloud_private_cloud_gateway" "pcg" {
20+
name = "wst-1-pcg"
21+
}
22+
23+
resource "spectrocloud_privatecloudgateway_ippool" "ippool" {
24+
gateway = "192.168.1.1"
25+
name = "primary-compute-pool-1"
26+
network_type = "range"
27+
prefix = "24"
28+
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
29+
ip_start_range = "192.168.1.10"
30+
ip_end_range = "192.168.1.100"
31+
nameserver_addresses = "192.168.1.8"
32+
restrict_to_single_cluster = true
33+
}
34+
```
35+
36+
37+
An example of creating an IP Pool for a Private Cloud Gateway using a subnet of IP addresses.
38+
39+
```hcl
40+
data "spectrocloud_private_cloud_gateway" "pcg" {
41+
name = "east-3-pcg"
42+
}
43+
44+
resource "spectrocloud_privatecloudgateway_ippool" "ippool" {
45+
gateway = "10.10.192.1"
46+
name = "backup-compute-pool"
47+
network_type = "subnet"
48+
prefix = "24"
49+
subnet_cidr = "10.10.100.0/24"
50+
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
51+
nameserver_addresses = "192.168.1.8"
52+
}
53+
```
1554

1655

1756
<!-- schema generated by tfplugindocs -->
1857
## Schema
1958

2059
### Required
2160

22-
- `gateway` (String)
23-
- `name` (String)
24-
- `network_type` (String)
25-
- `prefix` (Number)
26-
- `private_cloud_gateway_id` (String)
61+
- `gateway` (String) The network gateway IP address for the IP pool. Typically, this is the default network gateway for the subnet.
62+
- `name` (String) The name of the IP pool.
63+
- `network_type` (String) The type of network for the IP pool. Allowed values are: `range` and `subnet`.
64+
- `prefix` (Number) The prefix of the IP pool provided network range or subnet. For example `24` for a `/24` subnet or a range that falls inside a `24` subnet.
65+
- `private_cloud_gateway_id` (String) The ID of the Private Cloud Gateway.
2766

2867
### Optional
2968

30-
- `ip_end_range` (String)
31-
- `ip_start_range` (String)
32-
- `nameserver_addresses` (Set of String)
33-
- `nameserver_search_suffix` (Set of String)
34-
- `restrict_to_single_cluster` (Boolean)
35-
- `subnet_cidr` (String)
69+
- `ip_end_range` (String) The end IP address of the IP pool. Required if `network_type` is `range`.
70+
- `ip_start_range` (String) The start IP address of the IP pool. Required if `network_type` is `range`.
71+
- `nameserver_addresses` (Set of String) The list of nameserver IP addresses for the IP pool.
72+
- `nameserver_search_suffix` (Set of String) The list of nameserver search suffixes for the IP pool. For example, `example.org`.
73+
- `restrict_to_single_cluster` (Boolean) Restrict the IP pool to a single cluster. If set to `true`, the IP pool is restricted to a single cluster. We recommend setting this to `true` for production environments and creating separate IP pools for each cluster.
74+
- `subnet_cidr` (String) The subnet CIDR of the IP pool. Required if `network_type` is `subnet`.
3675
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
3776

3877
### Read-Only

spectrocloud/data_source_private_cloud_gateway.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
func dataSourcePCG() *schema.Resource {
1111
return &schema.Resource{
1212
ReadContext: dataSourcePCGRead,
13+
Description: "A data resource to get the ID or name of Private Cloud Gateway.",
1314

1415
Schema: map[string]*schema.Schema{
1516
"id": {
@@ -23,7 +24,7 @@ func dataSourcePCG() *schema.Resource {
2324
Type: schema.TypeString,
2425
Computed: true,
2526
Optional: true,
26-
Description: "The Name of Private Cloud Gateway.",
27+
Description: "The name of Private Cloud Gateway.",
2728
},
2829
},
2930
}

spectrocloud/resource_pcg_ippool.go

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource {
1818
ReadContext: resourceIpPoolRead,
1919
UpdateContext: resourceIpPoolUpdate,
2020
DeleteContext: resourceIpPoolDelete,
21+
Description: "A Resource to manage IP pools for Private Cloud Gateway.",
2122

2223
Timeouts: &schema.ResourceTimeout{
2324
Create: schema.DefaultTimeout(10 * time.Minute),
@@ -28,39 +29,47 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource {
2829
SchemaVersion: 2,
2930
Schema: map[string]*schema.Schema{
3031
"name": {
31-
Type: schema.TypeString,
32-
Required: true,
33-
ForceNew: true,
32+
Type: schema.TypeString,
33+
Required: true,
34+
ForceNew: true,
35+
Description: "The name of the IP pool.",
3436
},
3537
"private_cloud_gateway_id": {
36-
Type: schema.TypeString,
37-
ForceNew: true,
38-
Required: true,
38+
Type: schema.TypeString,
39+
ForceNew: true,
40+
Required: true,
41+
Description: "The ID of the Private Cloud Gateway.",
3942
},
4043
"network_type": {
4144
Type: schema.TypeString,
4245
Required: true,
4346
ValidateDiagFunc: validateNetworkType,
47+
Description: "The type of network for the IP pool. Allowed values are: `range` and `subnet`.",
4448
},
4549
"ip_start_range": {
46-
Type: schema.TypeString,
47-
Optional: true,
50+
Type: schema.TypeString,
51+
Optional: true,
52+
Description: "The start IP address of the IP pool. Required if `network_type` is `range`.",
4853
},
4954
"ip_end_range": {
50-
Type: schema.TypeString,
51-
Optional: true,
55+
Type: schema.TypeString,
56+
Optional: true,
57+
Description: "The end IP address of the IP pool. Required if `network_type` is `range`.",
5258
},
5359
"subnet_cidr": {
54-
Type: schema.TypeString,
55-
Optional: true,
60+
Type: schema.TypeString,
61+
Optional: true,
62+
Description: "The subnet CIDR of the IP pool. Required if `network_type` is `subnet`.",
5663
},
5764
"prefix": {
58-
Type: schema.TypeInt,
59-
Required: true,
65+
Type: schema.TypeInt,
66+
Required: true,
67+
Description: "The prefix of the IP pool provided network range or subnet. For example `24` for a `/24` subnet or a range that falls inside a `24` subnet.",
6068
},
6169
"gateway": {
62-
Type: schema.TypeString,
63-
Required: true,
70+
Type: schema.TypeString,
71+
Required: true,
72+
Description: "The network gateway IP address for the IP pool. Typically, this is the default network gateway for the subnet.",
6473
},
6574
"nameserver_addresses": {
6675
Type: schema.TypeSet,
@@ -69,6 +78,7 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource {
6978
Elem: &schema.Schema{
7079
Type: schema.TypeString,
7180
},
81+
Description: "The list of nameserver IP addresses for the IP pool.",
7282
},
7383
"nameserver_search_suffix": {
7484
Type: schema.TypeSet,
@@ -77,11 +87,13 @@ func resourcePrivateCloudGatewayIpPool() *schema.Resource {
7787
Elem: &schema.Schema{
7888
Type: schema.TypeString,
7989
},
90+
Description: "The list of nameserver search suffixes for the IP pool. For example, `example.org`.",
8091
},
8192
"restrict_to_single_cluster": {
82-
Type: schema.TypeBool,
83-
Optional: true,
84-
Default: false,
93+
Type: schema.TypeBool,
94+
Optional: true,
95+
Default: false,
96+
Description: "Restrict the IP pool to a single cluster. If set to `true`, the IP pool is restricted to a single cluster. We recommend setting this to `true` for production environments and creating separate IP pools for each cluster.",
8597
},
8698
},
8799
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
3+
subcategory: ""
4+
description: |-
5+
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
6+
---
7+
8+
# {{.Name}} ({{.Type}})
9+
10+
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
11+
12+
To learn more about Private Cloud Gateways, review the [Private Cloud Gateway](https://docs.spectrocloud.com/clusters/pcg/) documentation.
13+
14+
## Example Usage
15+
16+
17+
```hcl
18+
data "spectrocloud_private_cloud_gateway" "pcg" {
19+
name = "wst-1-pcg"
20+
}
21+
22+
```
23+
24+
{{ .SchemaMarkdown | trimspace }}

templates/resources/privatecloudgateway_ippool.md.tmpl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,48 @@ description: |-
99

1010
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
1111

12+
You can learn more about Private Cloud Gateways IP Pools by revewing the [Create and Manage IPAM Node Pools](https://docs.spectrocloud.com/clusters/pcg/manage-pcg/create-manage-node-pool/) guide.
13+
1214
## Example Usage
1315

16+
An example of creating an IP Pool for a Private Cloud Gateway using a range of IP addresses and restricting the IP Pool to a single cluster.
17+
18+
```hcl
19+
data "spectrocloud_private_cloud_gateway" "pcg" {
20+
name = "wst-1-pcg"
21+
}
22+
23+
resource "spectrocloud_privatecloudgateway_ippool" "ippool" {
24+
gateway = "192.168.1.1"
25+
name = "primary-compute-pool-1"
26+
network_type = "range"
27+
prefix = "24"
28+
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
29+
ip_start_range = "192.168.1.10"
30+
ip_end_range = "192.168.1.100"
31+
nameserver_addresses = "192.168.1.8"
32+
restrict_to_single_cluster = true
33+
}
34+
```
35+
36+
37+
An example of creating an IP Pool for a Private Cloud Gateway using a subnet of IP addresses.
38+
39+
```hcl
40+
data "spectrocloud_private_cloud_gateway" "pcg" {
41+
name = "east-3-pcg"
42+
}
1443
44+
resource "spectrocloud_privatecloudgateway_ippool" "ippool" {
45+
gateway = "10.10.192.1"
46+
name = "backup-compute-pool"
47+
network_type = "subnet"
48+
prefix = "24"
49+
subnet_cidr = "10.10.100.0/24"
50+
private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id
51+
nameserver_addresses = "192.168.1.8"
52+
}
53+
```
1554

1655

1756
{{ .SchemaMarkdown | trimspace }}

0 commit comments

Comments
 (0)