Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding some documentation changes to clarify additional features #339

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ provider "civo" {
region = "LON1"
}
```
~> **Note** currently only full path is supported on the `credentials_file` input, but in the future using tilde (~) will work as well.



## Argument Reference

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ resource "civo_instance" "example" {
- `region` (String) The region for the instance, if not declare we use the region in declared in the provider
- `reserved_ipv4` (String) Can be either the UUID, name, or the IP address of the reserved IP
- `reverse_dns` (String) A fully qualified domain name that should be used as the instance's IP's reverse DNS (optional, uses the hostname if unspecified)
- `script` (String) The contents of a script that will be uploaded to /usr/local/bin/civo-user-init-script on your instance, read/write/executable only by root and then will be executed at the end of the cloud initialization (this is an immutable field)
- `script` (String) The contents of a script that will be uploaded to /usr/local/bin/civo-user-init-script on your instance, read/write/executable only by root and then will be executed at the end of the cloud initialization. To fetch from file: `file("${path.module}/script")` (this is an immutable field, meaning you can't change it after creation)
- `size` (String) The name of the size, from the current list, e.g. g3.xsmall
- `sshkey_id` (String) The ID of an already uploaded SSH public key to use for login to the default user (optional; if one isn't provided a random password will be set and returned in the initial_password field)
- `tags` (Set of String) An optional list of tags, represented as a key, value pair
Expand Down
29 changes: 20 additions & 9 deletions docs/resources/kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ resource "civo_kubernetes_cluster" "example" {

### 3 medium nodes and writing the kubeconfig to a file for kubectl

This example shows how to output the configuration of the cluster to a kubeconfig file.
This example shows how to output the configuration of the cluster to a kubeconfig file and then use that with the kubernetes provider to create a namespace.

We will also enter a `kubernetes_version`. To see the list of kubernetes version use the [Civo CLI](https://www.civo.com/docs/overview/civo-cli) command:
```
Expand All @@ -123,17 +123,15 @@ resource "civo_firewall" "example" {
name = "example-firewall"
create_default_rules = true
network_id = civo_network.example.id

}

resource "civo_network" "example" {
label = "example-network"

}


resource "civo_kubernetes_cluster" "example" {
name = "example-cluster"
write_kubeconfig = true
network_id = civo_network.example.id
firewall_id = civo_firewall.example.id
kubernetes_version = "1.28.7-k3s1"
Expand All @@ -145,23 +143,36 @@ resource "civo_kubernetes_cluster" "example" {
}

resource "local_file" "kubeconfig" {
filename = "/tmp/${civo_kubernetes_cluster.example.name}-kubeconfig" # Define the path and file name
content = civo_kubernetes_cluster.example.kubeconfig
filename = "${path.module}/kubeconfig"
}


provider "kubernetes" {
config_path = local_file.kubeconfig.filename
}

resource "kubernetes_namespace" "example" {
depends_on = [local_file.kubeconfig]
metadata {
name = "example-namespace"
}
}
```

The user can then run the following `kubectl` command to access the server, for example:
The user can then run the following `kubectl` command to see the namespace created:

```
kubectl --kubeconfig kubeconfig get nodes
kubectl --kubeconfig=/tmp/example-cluster-kubeconfig get ns
```

Another, perhaps more convenient and secure way of doing this is by using the [Civo CLI](https://www.civo.com/docs/overview/civo-cli) and running the following, to automatically configure kubectl:
Unless you need to use terraform to configure your cluster, you can also access [Civo CLI](https://www.civo.com/docs/overview/civo-cli) and running the following, to automatically configure kubectl:

```
civo kubernetes config example-cluster --save --switch
```

This will prevent saving kubeconfig to state.

## Argument Reference

Expand Down Expand Up @@ -211,7 +222,7 @@ Required:
- `tags` (String) Space separated list of tags, to be used freely as required
- `target_nodes_size` (String, Deprecated) The size of each node (optional, the default is currently g4s.kube.medium)
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) defines timeouts for cluster creation, read and update, default is 30 minutes for all
- write_kubeconfig (Boolean) (false by default) when set to true, `kubeconfig` is saved to the terraform state file
- `write_kubeconfig` (Boolean) (false by default) when set to true, `kubeconfig` is saved to the terraform state file

<a id="nestedblock--timeouts"></a>
#### Nested Schema for `timeouts`
Expand Down
Loading