diff --git a/docs/resources/instance.md b/docs/resources/instance.md
index 8776252f..119f21f9 100644
--- a/docs/resources/instance.md
+++ b/docs/resources/instance.md
@@ -12,19 +12,81 @@ Provides a Civo instance resource. This can be used to create, modify, and delet
## Example Usage
+* View instances after creation on the [CLI](https://www.civo.com/docs/overview/civo-cli):
+```
+civo instances ls
+```
+* View instances after creation on the [Dashboard](https://dashboard.civo.com/instances)
+* View node sizes on [CLI](https://www.civo.com/docs/overview/civo-cli):
+
+```
+civo instances size
+```
+
+### Simple and smallest instance with its own network
+
```terraform
-# Query small instance size
-data "civo_instances_size" "small" {
- filter {
+provider "civo" {
+ region = "LON1"
+}
+
+resource "civo_firewall" "example" {
+ name = "example-firewall"
+ create_default_rules = true
+ network_id = civo_network.example.id
+
+}
+
+resource "civo_network" "example" {
+ label = "example-network"
+
+}
+
+# Query instance disk image
+data "civo_disk_image" "debian" {
+ filter {
key = "name"
- values = ["g3.small"]
- match_by = "re"
- }
+ values = ["debian-10"]
+ }
+}
+
+# Create a new instance
+resource "civo_instance" "example" {
+ hostname = "example"
+ tags = ["example", "documentation"]
+ notes = "This is an example instance"
+ firewall_id = civo_firewall.example.id
+ network_id = civo_network.example.id
+ size = "g3.xsmall"
+ disk_image = data.civo_disk_image.debian.diskimages[0].id
+}
+```
+
+With this configuration, an initial password for the instance gets written to the state on output `initial_password` which you can use to access the instance.
+
+Alternative you can get the password with the [CLI](https://www.civo.com/docs/overview/civo-cli):
- filter {
- key = "type"
- values = ["instance"]
- }
+```
+civo instances show example
+```
+
+### Instance with ssh login
+
+```terraform
+
+provider "civo" {
+ region = "LON1"
+}
+
+resource "civo_firewall" "example" {
+ name = "example-firewall"
+ create_default_rules = true
+ network_id = civo_network.example.id
+
+}
+
+resource "civo_network" "example" {
+ label = "example-network"
}
@@ -36,18 +98,30 @@ data "civo_disk_image" "debian" {
}
}
+# To create the example key, run this command:
+# ssh-keygen -f ~/.ssh/example-tf -C "terraform-example@localmachine"
+
+resource "civo_ssh_key" "example"{
+ name = "example"
+ public_key = file("~/.ssh/example-tf.pub")
+}
+
# Create a new instance
-resource "civo_instance" "foo" {
- hostname = "foo.com"
- tags = ["python", "nginx"]
- notes = "this is a note for the server"
- size = element(data.civo_instances_size.small.sizes, 0).name
- disk_image = element(data.civo_disk_image.debian.diskimages, 0).id
+resource "civo_instance" "example" {
+ hostname = "example"
+ tags = ["example", "documentation"]
+ notes = "This is an example instance"
+ sshkey_id = civo_ssh_key.example.id
+ firewall_id = civo_firewall.example.id
+ network_id = civo_network.example.id
+ size = "g3.xsmall"
+ disk_image = data.civo_disk_image.debian.diskimages[0].id
}
+
```
-
-## Schema
+
+## Argument Reference
### Required
@@ -69,10 +143,17 @@ resource "civo_instance" "foo" {
- `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
-- `template` (String, Deprecated) The ID for the template to use to build the instance
-- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
+- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) defines timeouts for cluster creation, read and update, default is 30 minutes for all
-### Read-Only
+
+
+### Nested Schema for `timeouts`
+
+Optional:
+
+- `create` (String) sets timeout for cluster creation - default 30 minutes
+
+## Attributes Reference
- `cpu_cores` (Number) Instance's CPU cores
- `created_at` (String) Timestamp when the instance was created
@@ -86,12 +167,7 @@ resource "civo_instance" "foo" {
- `source_type` (String) Instance's source type
- `status` (String) Instance's status
-
-### Nested Schema for `timeouts`
-
-Optional:
-- `create` (String)
## Import
@@ -99,5 +175,5 @@ Import is supported using the following syntax:
```shell
# using ID
-terraform import civo_instance.myintance 18bd98ad-1b6e-4f87-b48f-e690b4fd7413
+terraform import civo_instance.example 18bd98ad-1b6e-4f87-b48f-e690b4fd7413
```