Skip to content

Commit

Permalink
Adding the documentation for issue #296
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Villalba committed Aug 13, 2024
1 parent 2c2e357 commit ee9f05c
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/dns_domain_name.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_dns_domain_name Data Source - terraform-provider-civo"
subcategory: "Civo DNS"
subcategory: "Civo Network"
description: |-
Get information on a domain. This data source provides the name and the id.
An error will be raised if the provided domain name is not in your Civo account.
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/dns_domain_record.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_dns_domain_record Data Source - terraform-provider-civo"
subcategory: "Civo DNS"
subcategory: "Civo Network"
description: |-
Get information on a DNS record. This data source provides the name, TTL, and zone file as configured on your Civo account.
An error will be raised if the provided domain name or record are not in your Civo account.
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/firewall.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_firewall Data Source - terraform-provider-civo"
subcategory: "Civo Firewall"
subcategory: "Civo Network"
description: |-
Retrieve information about a firewall for use in other resources.
This data source provides all of the firewall's properties as configured on your Civo account.
Expand Down
40 changes: 37 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ 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:
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 provider will use credentials in the following order:

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`)

That means that if the `CIVO_TOKEN` variable is set, all other credentials will be ignored, and if the `credentials_file` is set, that will be used over the CLI credentials.

### Obtaining a token

First you will need to create a [Civo Account](https://dashboard.civo.com/signup) and then you can do the following:
Expand All @@ -27,6 +29,37 @@ First you will need to create a [Civo Account](https://dashboard.civo.com/signup
* To fetch an API key go to the [security section](https://dashboard.civo.com/security) on the dashboard


### Using the CIVO_TOKEN variable

To use the Civo token, export the variable containing your token:

```bash
export CIVO_TOKEN=<your token>
```

### Using a credentials file

The format of the credentials file is as follows:

```json
{
"apikeys": {
"tf_key": "write-your-token-here"
},
"meta": {
"current_apikey": "tf_key"
}
}
```

you will then need to configure the `credentials_file` input to the correct location, for example:

`credentials_file = "/secure/path/civo.json"`

### Using the CLI

If you install the CLI and [configure a token](https://www.civo.com/docs/overview/civo-cli#add-an-api-key-to-civo-cli), there is nothing else you need to do if those are the credentials you wish to use, ideal for local usage.


## Example Usage

Expand Down Expand Up @@ -65,13 +98,14 @@ terraform {
}
provider "civo" {
credentials_file = "~/civo_tf_token"
credentials_file = "/secure/path/civo.json"
region = "LON1"
}
```
~> **Note** currently only full path is supported on the `credentials_file` input, but in the future using tilde (~) will work as well.



<!-- schema generated by tfplugindocs -->
## Argument Reference

### Optional
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/dns_domain_name.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_dns_domain_name Resource - terraform-provider-civo"
subcategory: "Civo DNS"
subcategory: "Civo Network"
description: |-
Provides a Civo DNS domain name resource.
---
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/dns_domain_record.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_dns_domain_record Resource - terraform-provider-civo"
subcategory: "Civo DNS"
subcategory: "Civo Network"
description: |-
Provides a Civo DNS domain record resource.
---
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/firewall.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "civo_firewall Resource - terraform-provider-civo"
subcategory: "Civo Firewall"
subcategory: "Civo Network"
description: |-
Provides a Civo firewall resource. This can be used to create, modify, and delete firewalls.
---
Expand Down

0 comments on commit ee9f05c

Please sign in to comment.