diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml index 7028ae6b..e52693a1 100644 --- a/.github/ISSUE_TEMPLATE/other.yml +++ b/.github/ISSUE_TEMPLATE/other.yml @@ -11,9 +11,9 @@ body: placeholder: | Please provide the following information here: 1. What's the issue/request? - 1. Why do you think we should implement this feature? - 1. Visualize your idea as much as possible so it's easy to understand what you mean. - 1. Additional information --> Links to additional resources, for example other tools with similar feature implemented. + 2. Why do you think we should implement this feature? + 3. Visualize your idea as much as possible so it's easy to understand what you mean. + 4. Additional information --> Links to additional resources, for example other tools with similar feature implemented. validations: required: true - type: textarea diff --git a/docs/index.md b/docs/index.md index fde71115..1e334cdf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,17 +7,35 @@ description: |- # Civo Provider -The Civo provider is used to interact with the resources supported by Civo. The provider needs to be configured with the proper credentials before it can be used. +The Civo provider is used to interact with the resources supported by Civo. Use the navigation to the left to read about the available resources. +## Configuration + +The provider will use the credentials of the [Civo CLI](https://github.com/civo/cli) (stored in ` ~/.civo.json`) if no other credentials have been set up. The credentials preference is the following: + +1. Environment variable (`CIVO_TOKEN`). +1. Token provided via a credentials file (See `credentials_file` input [below](#credentials_file)) +1. [CLI](https://github.com/civo/cli) configuration (`~/.civo.json`) + +### Obtaining a token + +First you will need to create a [Civo Account](https://dashboard.civo.com/signup) and then you can do the following: + +* If you can want to configure your credentials with the CLI, instructions are [here](https://www.civo.com/docs/overview/civo-cli#add-an-api-key-to-civo-cli) +* To fetch an API key go to the [security section](https://dashboard.civo.com/security) on the dashboard + + + ## Example Usage +### Simplest usage + +In this example the provider will look for credentials set by the CLI and use LON1 region as default, or use the environment variable `CIVO_TOKEN` if set. + ```terraform -# Set the variable value in *.tfvars file or using -var="civo_token=..." CLI flag -variable "civo_token" {} -# Specify required provider as maintained by civo terraform { required_providers { civo = { @@ -26,23 +44,40 @@ terraform { } } -# Configure the Civo Provider provider "civo" { - token = var.civo_token region = "LON1" } -# Create a web server -resource "civo_instance" "web" { - # ... +``` + +### Example with credentials file + +In this example we are providing a specific version of the terraform provider and setting a credentials file to use. The credentials file will be used if the environment variable `CIVO_TOKEN` is not set. + +```terraform +terraform { + required_providers { + civo = { + source = "civo/civo" + version = "1.1.0" + } + } +} + +provider "civo" { + credentials_file = "~/civo_tf_token" + region = "LON1" } ``` + -## Schema +## Argument Reference ### Optional - `api_endpoint` (String) The Base URL to use for CIVO API. -- `region` (String) If region is not set, then no region will be used and them you need expensify in every resource even if you expensify here you can overwrite in a resource. -- `token` (String) This is the Civo API token. Alternatively, this can also be specified using `CIVO_TOKEN` environment variable. +- `region` (String) This sets the default region for all resources. If no default region is set, you will need to specify individually in every resource. + +- `credentials_file` (string) specify a location for a file containing your civo credentials token +- `token` (String) (**Deprecated**) for legacy reasons the user can still specify the token as an input, but in order to avoid storing that in terraform state we have deprecated this and will be remove in future versions - don't use it. diff --git a/docs/resources/instance.md b/docs/resources/instance.md index 26b23ad3..987ae17d 100644 --- a/docs/resources/instance.md +++ b/docs/resources/instance.md @@ -127,7 +127,7 @@ resource "civo_instance" "example" { - `firewall_id` (String) The ID of the firewall to use, from the current list. If left blank or not sent, the default firewall will be used (open to all) - `disk_image` (String) The ID for the disk image to use to build the instance -- + ### Optional - `hostname` (String) A fully qualified domain name that should be set as the instance's hostname