Skip to content

Commit

Permalink
doc: Modify documentation, make 'node_subnet' computed, use 'Validate…
Browse files Browse the repository at this point in the history
…DiagFunc'
  • Loading branch information
adeatcu-ionos committed Dec 19, 2023
1 parent 96f4a26 commit 3e60bb0
Show file tree
Hide file tree
Showing 17 changed files with 441 additions and 93 deletions.
41 changes: 39 additions & 2 deletions docs/resources/k8s_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ Manages a **Managed Kubernetes Cluster** on IonosCloud.

## Example Usage

### Public cluster

```hcl
resource "ionoscloud_k8s_cluster" "example" {
name = "k8sClusterExample"
k8s_version = "1.20.10"
k8s_version = "1.25.5"
maintenance_window {
day_of_the_week = "Sunday"
time = "09:00:00Z"
Expand All @@ -28,6 +30,39 @@ resource "ionoscloud_k8s_cluster" "example" {
}
```

### Private Cluster

```hcl
resource "ionoscloud_datacenter" "testdatacenter" {
name = "example"
location = "de/fra"
description = "Test datacenter"
}
resource "ionoscloud_ipblock" "k8sip" {
location = "de/fra"
size = 1
name = "IP Block Private K8s"
}
resource "ionoscloud_k8s_cluster" "example" {
name = "k8sClusterExample"
k8s_version = "1.25.5"
maintenance_window {
day_of_the_week = "Sunday"
time = "09:00:00Z"
}
api_subnet_allow_list = ["1.2.3.4/32"]
s3_buckets {
name = <your_s3_bucket>
}
location = "de/fra"
nat_gateway_ip = ionoscloud_ipblock.k8sip.ips[0]
node_subnet = "192.168.0.0/16"
public = false
}
```

## Argument Reference

The following arguments are supported:
Expand All @@ -40,12 +75,14 @@ The following arguments are supported:
- `viable_node_pool_versions` - (Computed)[list] List of versions that may be used for node pools under this cluster
- `api_subnet_allow_list` - (Optional)[list] Access to the K8s API server is restricted to these CIDRs. Cluster-internal traffic is not affected by this restriction. If no allowlist is specified, access is not restricted. If an IP without subnet mask is provided, the default value will be used: 32 for IPv4 and 128 for IPv6.
- `s3_buckets` - (Optional)[list] List of S3 bucket configured for K8s usage. For now it contains only an S3 bucket used to store K8s API audit logs.
- `public` - (Optional)[boolean] Indicates if the cluster is public or private.
- `public` - (Optional)[boolean] Indicates if the cluster is public or private. This attribute is immutable.
- `nat_gateway_ip` - (Optional)[string] The NAT gateway IP of the cluster if the cluster is private. This attribute is immutable. Must be a reserved IP in the same location as the cluster's location. This attribute is mandatory if the cluster is private.
- `node_subnet` - (Optional)[string] The node subnet of the cluster, if the cluster is private. This attribute is optional and immutable. Must be a valid CIDR notation for an IPv4 network prefix of 16 bits length.
- `location` - (Optional)[string] This attribute is mandatory if the cluster is private. The location must be enabled for your contract, or you must have a data center at that location. This property is not adjustable.
- `allow_replace` - (Optional)[bool] When set to true, allows the update of immutable fields by first destroying and then re-creating the cluster.

⚠️ **_Warning: `allow_replace` - lets you update immutable fields, but it first destroys and then re-creates the cluster in order to do it. Set the field to true only if you know what you are doing._**

## Import

A Kubernetes Cluster resource can be imported using its `resource id`, e.g.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/k8s_node_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "ionoscloud_ipblock" "example" {
resource "ionoscloud_k8s_cluster" "example" {
name = "k8sClusterExample"
k8s_version = "1.20.10"
k8s_version = "1.25.5"
maintenance_window {
day_of_the_week = "Sunday"
time = "09:00:00Z"
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/ionos-cloud/sdk-go-dns v1.1.1
github.com/ionos-cloud/sdk-go-logging v1.0.1
github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.0
github.com/ionos-cloud/sdk-go/v6 v6.1.10
github.com/ionos-cloud/sdk-go/v6 v6.1.11
golang.org/x/crypto v0.15.0
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -24,7 +24,6 @@ require github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
require (
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/go-test/deep v1.0.6 // indirect
Expand All @@ -50,7 +49,6 @@ require (
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/jhump/protoreflect v1.15.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
Expand Down
Loading

0 comments on commit 3e60bb0

Please sign in to comment.