diff --git a/README.md b/README.md index 57f0c1c8..75a27191 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,11 @@ -Terraform Provider ![Travis build](https://travis-ci.org/civo/terraform-provider-civo.svg?branch=master) +Terraform Provider ================== -- Website: https://www.terraform.io -- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) -- [![Build Status](https://github.com/civo/terraform-provider-civo/workflows/Go/badge.svg)](https://github.com/civo/terraform-provider-civo/actions) -- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool) - Requirements ------------ - [Terraform](https://www.terraform.io/downloads.html) 0.13.x -- [Go](https://golang.org/doc/install) 1.14.x (to build the provider plugin) +- [Go](https://golang.org/doc/install) 1.14.x or later (to build the provider plugin) Building The Provider --------------------- @@ -32,14 +27,13 @@ $ make build Using the provider ---------------------- -When the provider is out of beta the documentation will be at [Civo Provider documentation](https://registry.terraform.io/providers/civo/civo/latest/docs), -but during the beta the best resource for learning about it is [this guide](https://www.civo.com/learn/using-the-civo-terraform-provider) +The documentation is available at [Civo Provider documentation](https://registry.terraform.io/providers/civo/civo/latest/docs) Developing the Provider --------------------------- -If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`. +If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.14.x (or later) is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`. To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. @@ -71,3 +65,16 @@ $ make testacc TESTARGS='-run=TestAccCivoDomain_Basic' ``` For information about writing acceptance tests, see the main Terraform [contributing guide](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#writing-acceptance-tests). + +Documenting the Provider +--------------------------- + +As of 10th September 2021, we decided to use [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs) to auto-generate [docs](docs) from the provider code and [examples](examples). + +For reference, you can see an example of the templates and output in [paultyng/terraform-provider-unifi](https://github.com/paultyng/terraform-provider-unifi) and browse the generated docs in the [Terraform Registry](https://registry.terraform.io/providers/paultyng/unifi/latest/docs). + +Another example would be [https://github.com/fastly/terraform-provider-fastly](https://github.com/fastly/terraform-provider-fastly) - which rendered in the [Terraform Registry](https://registry.terraform.io/providers/fastly/fastly/latest/docs). + +**Caveat** + +While the `tfplugindocs` is still in active development by the Hashicorp and works fine for most cases, except when it comes to generating attribute descriptions located in nested schemas. We think this isn't too critical since the attribute keys are self explanatory. However, we will still watch the [issue](https://github.com/hashicorp/terraform-plugin-docs/issues/28) and update the [docs](docs) once it's fixed. diff --git a/civo/datasource_disk_image.go b/civo/datasource_disk_image.go index 66923de8..42ff8055 100644 --- a/civo/datasource_disk_image.go +++ b/civo/datasource_disk_image.go @@ -11,10 +11,12 @@ func dataSourceDiskImage() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ RecordSchema: templateSchema(), + Description: "Get information on an disk image for use in other resources (e.g. creating a instance) with the ability to filter the results.", ExtraQuerySchema: map[string]*schema.Schema{ "region": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "If is used, all disk image will be from this region. Required if no region is set in provider.", }, }, ResultAttributeName: "diskimages", diff --git a/civo/datasource_dns_domain_name.go b/civo/datasource_dns_domain_name.go index 47eee6e2..86b11623 100644 --- a/civo/datasource_dns_domain_name.go +++ b/civo/datasource_dns_domain_name.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the name of the domain func dataSourceDNSDomainName() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "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.", + }, "\n\n"), Read: dataSourceDNSDomainNameRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,6 +31,7 @@ func dataSourceDNSDomainName() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "name"}, + Description: "The name of the domain", }, }, } diff --git a/civo/datasource_dns_domain_record.go b/civo/datasource_dns_domain_record.go index 6b14c79e..48d087ff 100644 --- a/civo/datasource_dns_domain_record.go +++ b/civo/datasource_dns_domain_record.go @@ -2,6 +2,7 @@ package civo import ( "fmt" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -12,46 +13,59 @@ import ( // using the id or the name of the domain func dataSourceDNSDomainRecord() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "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.", + }, "\n\n"), Read: dataSourceDNSDomainRecordRead, Schema: map[string]*schema.Schema{ "domain_id": { Type: schema.TypeString, Required: true, ValidateFunc: validation.NoZeroValues, + Description: "The ID of the domain", }, "name": { Type: schema.TypeString, Required: true, ValidateFunc: validation.NoZeroValues, + Description: "The name of the record", }, // Computed resource "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The choice of record type from A, CNAME, MX, SRV or TXT", }, "value": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record", }, "priority": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The priority of the record", }, "ttl": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "How long caching DNS servers should cache this record", }, "account_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID account of the domain", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date when it was created in UTC format", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date when it was updated in UTC format", }, }, } diff --git a/civo/datasource_instance.go b/civo/datasource_instance.go index 9639e31d..93643311 100644 --- a/civo/datasource_instance.go +++ b/civo/datasource_instance.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the hostname func dataSourceInstance() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Get information on an instance for use in other resources. This data source provides all of the instance's properties as configured on your Civo account.", + "Note: This data source returns a single instance. When specifying a hostname, an error will be raised if more than one instances found.", + }, "\n\n"), Read: dataSourceInstanceRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,89 +31,110 @@ func dataSourceInstance() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "hostname"}, + Description: "The hostname of the Instance", }, "region": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, + Description: "The region of an existing Instance", }, // computed attributes "reverse_dns": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A fully qualified domain name", }, "size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the size", }, "cpu_cores": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total cpu of the inatance", }, "ram_mb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total ram of the instance", }, "disk_gb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the disk", }, "network_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "his will be the ID of the network", }, "template": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID for the disk image/template to used to build the instance", }, "initial_user": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the initial user created on the server", }, "notes": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The notes of the instance", }, "sshkey_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID SSH key", }, "firewall_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the firewall used", }, "tags": { - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - Computed: true, + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + Description: "An optional list of tags", }, "script": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The contents of a script uploaded", }, "initial_password": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance initial password", }, "private_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The private IP", }, "public_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The public IP", }, "pseudo_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Is the ip that is used to route the public ip from the internet to the instance using NAT", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The status of the instance", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date of creation of the instance", }, }, } diff --git a/civo/datasource_instances.go b/civo/datasource_instances.go index 4cc7e784..862aab1f 100644 --- a/civo/datasource_instances.go +++ b/civo/datasource_instances.go @@ -2,6 +2,7 @@ package civo import ( "fmt" + "strings" "github.com/civo/civogo" "github.com/civo/terraform-provider-civo/internal/datalist" @@ -11,11 +12,16 @@ import ( // Data source to get and filter all instances with filter func dataSourceInstances() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ + Description: strings.Join([]string{ + "Get information on instances for use in other resources, with the ability to filter and sort the results. If no filters are specified, all instances will be returned.", + "Note: You can use the `civo_instance` data source to obtain metadata about a single instance if you already know the id, unique hostname, or unique tag to retrieve.", + }, "\n\n"), RecordSchema: instancesSchema(), ExtraQuerySchema: map[string]*schema.Schema{ "region": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "If used, all instances will be from the provided region", }, }, ResultAttributeName: "instances", @@ -93,23 +99,23 @@ func instancesSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "id": { Type: schema.TypeString, - Description: "id of the instance", + Description: "ID of the instance", }, "hostname": { Type: schema.TypeString, - Description: "hostname of the instance", + Description: "Hostname of the instance", }, "region": { Type: schema.TypeString, - Description: "region of the instance", + Description: "Region of the instance", }, "reverse_dns": { Type: schema.TypeString, - Description: "reverse DNS of the instance", + Description: "Reverse DNS of the instance", }, "size": { Type: schema.TypeString, - Description: "size of the instance", + Description: "Size of the instance", }, "cpu_cores": { Type: schema.TypeInt, @@ -121,64 +127,64 @@ func instancesSchema() map[string]*schema.Schema { }, "disk_gb": { Type: schema.TypeInt, - Description: "SSD of the instance", + Description: "SSD size of the instance", }, "network_id": { Type: schema.TypeString, - Description: "netwoerk id of the instance", + Description: "Network id of the instance", }, "template": { Type: schema.TypeString, - Description: "template of the instance", + Description: "Disk image/template of the instance", }, "initial_user": { Type: schema.TypeString, - Description: "initial user of the instance", + Description: "Initial user of the instance", }, "notes": { Type: schema.TypeString, - Description: "note of the instance", + Description: "Note of the instance", }, "sshkey_id": { Type: schema.TypeString, - Description: "sshkey id of the instance", + Description: "SSH key id of the instance", }, "firewall_id": { Type: schema.TypeString, - Description: "firewall id of the instance", + Description: "Firewall ID of the instance", }, "tags": { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, - Description: "tags of the instance", + Description: "Tags of the instance", }, "script": { Type: schema.TypeString, - Description: "script of the instance", + Description: "Script of the instance", }, "initial_password": { Type: schema.TypeString, - Description: "initial password of the instance", + Description: "Initial password of the instance", }, "private_ip": { Type: schema.TypeString, - Description: "private ip of the instance", + Description: "Private IP of the instance", }, "public_ip": { Type: schema.TypeString, - Description: "public ip of the instance", + Description: "Public IP of the instance", }, "pseudo_ip": { Type: schema.TypeString, - Description: "pseudo ip of the instance", + Description: "Pseudo IP of the instance", }, "status": { Type: schema.TypeString, - Description: "status of the instance", + Description: "Status of the instance", }, "created_at": { Type: schema.TypeString, - Description: "creation date of the instance", + Description: "Creation date of the instance", }, } } diff --git a/civo/datasource_intances_size.go b/civo/datasource_intances_size.go index 363af996..fa9428a7 100644 --- a/civo/datasource_intances_size.go +++ b/civo/datasource_intances_size.go @@ -24,6 +24,7 @@ type SizeList struct { // use to define the size in resourceInstance func dataSourceInstancesSize() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ + Description: "Retrieves information about the instance sizes that Civo supports, with the ability to filter the results.", RecordSchema: instancesSizeSchema(), ResultAttributeName: "sizes", FlattenRecord: flattenInstancesSize, @@ -94,32 +95,39 @@ func flattenInstancesSize(size, m interface{}, extra map[string]interface{}) (ma func instancesSizeSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the instance size", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A human name of the instance size", }, "cpu": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total of CPU in the instance", }, "ram": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total of RAM of the instance", }, "disk": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The instance size of SSD", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A description of the instance size", }, "selectable": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If can use the instance size", }, } } diff --git a/civo/datasource_kubernetes_cluster.go b/civo/datasource_kubernetes_cluster.go index c43b9892..0934d33f 100644 --- a/civo/datasource_kubernetes_cluster.go +++ b/civo/datasource_kubernetes_cluster.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the hostname func dataSourceKubernetesCluster() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Provides a Civo Kubernetes cluster data source.", + "Note: This data source returns a single Kubernetes cluster. When specifying a name, an error will be raised if more than one Kubernetes cluster found.", + }, "\n\n"), Read: dataSourceKubernetesClusterRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,63 +31,77 @@ func dataSourceKubernetesCluster() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "name"}, + Description: "The name of the Kubernetes Cluster", }, "region": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, + Description: "The region where cluster is running", }, // computed attributes "num_target_nodes": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the Kubernetes cluster", }, "target_nodes_size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The size of each node", }, "kubernetes_version": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The version of Kubernetes", }, "tags": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A list of tags", }, "applications": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A list of application installed", }, "instances": dataSourceInstanceSchema(), "installed_applications": dataSourceApplicationSchema(), "pools": dataSourcenodePoolSchema(), "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The status of Kubernetes cluster", }, "ready": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If the Kubernetes cluster is ready", }, "kubeconfig": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A representation of the Kubernetes cluster's kubeconfig in yaml format", }, "api_endpoint": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The base URL of the API server on the Kubernetes master node", }, "master_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The IP of the Kubernetes master node", }, "dns_entry": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The unique dns entry for the cluster in this case point to the master", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date where the Kubernetes cluster was create", }, }, } @@ -96,33 +115,40 @@ func dataSourceInstanceSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "hostname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The hostname of the instance", }, "size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The size of the instance", }, "cpu_cores": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total CPU of the instance", }, "ram_mb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Total RAM of the instance", }, "disk_gb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the instance disk", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The status of the instance", }, "tags": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Description: "The tag of the instance", + Elem: &schema.Schema{Type: schema.TypeString}, }, }, }, @@ -137,21 +163,25 @@ func dataSourcenodePoolSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the pool", }, "count": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the pool", }, "size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The size of each node inside the pool", }, "instance_names": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Description: "A list of the instance in the pool", + Elem: &schema.Schema{Type: schema.TypeString}, }, "instances": dataSourceInstanceSchema(), }, @@ -167,20 +197,24 @@ func dataSourceApplicationSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "application": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the application", }, "version": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The version of the application", }, "installed": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If the application is installed, this will return `true`", }, "category": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The category of the application", }, }, }, diff --git a/civo/datasource_kubernetes_version.go b/civo/datasource_kubernetes_version.go index 9ef29501..59e0bfa0 100644 --- a/civo/datasource_kubernetes_version.go +++ b/civo/datasource_kubernetes_version.go @@ -13,6 +13,7 @@ import ( // moment of the cluster creation in resourceKubernetesCluster func dataSourceKubernetesVersion() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ + Description: "Provides access to the available Civo Kubernetes versions, with the ability to filter the results.", RecordSchema: KubernetesVersionSchema(), ResultAttributeName: "versions", FlattenRecord: flattenKubernetesVersion, @@ -54,20 +55,24 @@ func KubernetesVersionSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "version": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A version of the Kubernetes", }, "label": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The label of this version", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the version - can be `stable`, `legacy` & etc", }, "default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If is the default version used in all cluster, this will return `true`", }, } } diff --git a/civo/datasource_loadbalancer.go b/civo/datasource_loadbalancer.go index aaf34849..115bed55 100644 --- a/civo/datasource_loadbalancer.go +++ b/civo/datasource_loadbalancer.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the hostname of the Load Balancer func dataSourceLoadBalancer() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Get information on a load balancer for use in other resources. This data source provides all of the load balancers properties as configured on your Civo account.", + "An error will be raised if the provided load balancer name does not exist in your Civo account.", + }, "\n\n"), Read: dataSourceLoadBalancerRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,69 +31,85 @@ func dataSourceLoadBalancer() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "hostname"}, + Description: "The hostname of the load balancer", }, "region": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, + Description: "The region where load balancer is running", }, // Computed resource "protocol": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The protocol used", }, "tls_certificate": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "If is set will be returned", }, "tls_key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "If is set will be returned", }, "port": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The port set in the configuration", }, "max_request_size": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The max request size set in the configuration", }, "policy": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The policy set in the load balancer", }, "health_check_path": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The path to check the health of the backend", }, "fail_timeout": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The wait time until the backend is marked as a failure", }, "max_conns": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "How many concurrent connections can each backend handle", }, "ignore_invalid_backend_tls": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Should self-signed/invalid certificates be ignored from the backend servers", }, "backend": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "instance_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The instance ID", }, "protocol": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The protocol used in the configuration", }, "port": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The port set in the configuration", }, }, }, diff --git a/civo/datasource_network.go b/civo/datasource_network.go index 7446cbaa..f2e35972 100644 --- a/civo/datasource_network.go +++ b/civo/datasource_network.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,11 @@ import ( // using the id or the label func dataSourceNetwork() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Retrieve information about a network for use in other resources.", + "This data source provides all of the network's properties as configured on your Civo account.", + "Networks may be looked up by id or label, and you can optionally pass region if you want to make a lookup for an expecific network inside that region.", + }, "\n\n"), Read: dataSourceNetworkRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,21 +32,25 @@ func dataSourceNetwork() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, AtLeastOneOf: []string{"id", "label", "region"}, + Description: "The label of an existing network", }, "region": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, AtLeastOneOf: []string{"id", "label", "region"}, + Description: "The region of an existing network", }, // Computed resource "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the network", }, "default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If is the default network", }, }, } diff --git a/civo/datasource_region.go b/civo/datasource_region.go index ab1d7008..d7a477fc 100644 --- a/civo/datasource_region.go +++ b/civo/datasource_region.go @@ -12,22 +12,27 @@ import ( // use to define the region in the rest of the resource or datasource func dataSourceRegion() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ + Description: "Retrieves information about the region that Civo supports, with the ability to filter the results.", RecordSchema: map[string]*schema.Schema{ "code": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The code of the region", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A human name of the region", }, "country": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The country of the region", }, "default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If the region is the default region, this will return `true`", }, }, ResultAttributeName: "regions", diff --git a/civo/datasource_snapshot.go b/civo/datasource_snapshot.go index 68b12ab2..2c6474b1 100644 --- a/civo/datasource_snapshot.go +++ b/civo/datasource_snapshot.go @@ -15,7 +15,8 @@ import ( // using the id or the name func dataSourceSnapshot() *schema.Resource { return &schema.Resource{ - Read: dataSourceSnapshotRead, + Description: "Snapshots are saved instances of a block storage volume. Use this data source to retrieve the ID of a Civo snapshot for use in other resources.", + Read: dataSourceSnapshotRead, Schema: map[string]*schema.Schema{ "id": { Type: schema.TypeString, @@ -28,51 +29,63 @@ func dataSourceSnapshot() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "name"}, + Description: "The name of the snapshot", }, // Computed resource "instance_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the instance from which the snapshot was be taken", }, "safe": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If `true`, the instance will be shut down during the snapshot", }, "cron_timing": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A string with the cron format", }, "hostname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The hostname of the instance", }, "template_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The disk image/template ID", }, "region": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The region where the snapshot was taken", }, "size_gb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the snapshot in GB", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The status of the snapshot", }, "next_execution": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "If cron was define this date will be the next execution date", }, "requested_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date where the snapshot was requested", }, "completed_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date where the snapshot was completed", }, }, } diff --git a/civo/datasource_ssh.go b/civo/datasource_ssh.go index 77bc3c71..c4189f38 100644 --- a/civo/datasource_ssh.go +++ b/civo/datasource_ssh.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the name func dataSourceSSHKey() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Get information on a SSH key. This data source provides the name, and fingerprint as configured on your Civo account.", + "An error will be raised if the provided SSH key name does not exist in your Civo account.", + }, "\n\n"), Read: dataSourceSSHKeyRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,11 +31,13 @@ func dataSourceSSHKey() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "name"}, + Description: "The name of the SSH key", }, // Computed resource "fingerprint": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The fingerprint of the public key of the SSH key", }, }, } diff --git a/civo/datasource_template.go b/civo/datasource_template.go index 7d2c9907..e82db1d3 100644 --- a/civo/datasource_template.go +++ b/civo/datasource_template.go @@ -2,6 +2,7 @@ package civo import ( "fmt" + "strings" "github.com/civo/civogo" "github.com/civo/terraform-provider-civo/internal/datalist" @@ -21,6 +22,10 @@ type TemplateDisk struct { func dataSourceTemplate() *schema.Resource { dataListConfig := &datalist.ResourceConfig{ + Description: strings.Join([]string{ + "`civo_template` data source is deprecated. Moving forward, please use `civo_disk_image` data source.", + "Get information on an template for use in other resources (e.g. creating a instance) with the ability to filter the results.", + }, "\n\n"), RecordSchema: templateSchema(), ExtraQuerySchema: map[string]*schema.Schema{ "region": { @@ -99,20 +104,24 @@ func templateSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "ID of disk image/template", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of disk image/template", }, "version": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Version of disk image/template", }, "label": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Label of disk image/template", }, } } diff --git a/civo/datasource_volume.go b/civo/datasource_volume.go index a1831a3e..f328b0dc 100644 --- a/civo/datasource_volume.go +++ b/civo/datasource_volume.go @@ -3,6 +3,7 @@ package civo import ( "fmt" "log" + "strings" "github.com/civo/civogo" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -13,6 +14,10 @@ import ( // using the id or the name of the domain func dataSourceVolume() *schema.Resource { return &schema.Resource{ + Description: strings.Join([]string{ + "Get information on a volume for use in other resources. This data source provides all of the volumes properties as configured on your Civo account.", + "An error will be raised if the provided volume name does not exist in your Civo account.", + }, "\n\n"), Read: dataSourceVolumeRead, Schema: map[string]*schema.Schema{ "id": { @@ -26,28 +31,29 @@ func dataSourceVolume() *schema.Resource { Optional: true, ValidateFunc: validation.NoZeroValues, ExactlyOneOf: []string{"id", "name"}, + Description: "The name of the volume", }, "region": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, + Description: "The region where volume is running", }, // Computed resource "size_gb": { - Type: schema.TypeInt, - Computed: true, - }, - "bootable": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the volume (in GB)", }, "mount_point": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The mount point of the volume", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date of the creation of the volume", }, }, } @@ -84,7 +90,6 @@ func dataSourceVolumeRead(d *schema.ResourceData, m interface{}) error { d.SetId(foundVolume.ID) d.Set("name", foundVolume.Name) d.Set("size_gb", foundVolume.SizeGigabytes) - d.Set("bootable", foundVolume.Bootable) d.Set("mount_point", foundVolume.MountPoint) d.Set("created_at", foundVolume.CreatedAt.UTC().String()) diff --git a/civo/provider.go b/civo/provider.go index 5c318c37..a2f6c644 100644 --- a/civo/provider.go +++ b/civo/provider.go @@ -16,12 +16,14 @@ func Provider() *schema.Provider { Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("CIVO_TOKEN", ""), + Description: "This is the Civo API token. Alternatively, this can also be specified using `CIVO_TOKEN` environment variable.", }, "region": { Type: schema.TypeString, Optional: true, Default: "", DefaultFunc: schema.EnvDefaultFunc("CIVO_REGION", ""), + Description: "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.", }, }, DataSourcesMap: map[string]*schema.Resource{ @@ -36,23 +38,24 @@ func Provider() *schema.Provider { "civo_dns_domain_record": dataSourceDNSDomainRecord(), "civo_network": dataSourceNetwork(), "civo_volume": dataSourceVolume(), - "civo_loadbalancer": dataSourceLoadBalancer(), - "civo_ssh_key": dataSourceSSHKey(), - "civo_snapshot": dataSourceSnapshot(), - "civo_region": dataSourceRegion(), + // "civo_loadbalancer": dataSourceLoadBalancer(), + "civo_ssh_key": dataSourceSSHKey(), + // "civo_snapshot": dataSourceSnapshot(), + "civo_region": dataSourceRegion(), }, ResourcesMap: map[string]*schema.Resource{ - "civo_instance": resourceInstance(), - "civo_network": resourceNetwork(), - "civo_volume": resourceVolume(), - "civo_volume_attachment": resourceVolumeAttachment(), - "civo_dns_domain_name": resourceDNSDomainName(), - "civo_dns_domain_record": resourceDNSDomainRecord(), - "civo_firewall": resourceFirewall(), - "civo_firewall_rule": resourceFirewallRule(), - "civo_loadbalancer": resourceLoadBalancer(), - "civo_ssh_key": resourceSSHKey(), - "civo_snapshot": resourceSnapshot(), + "civo_instance": resourceInstance(), + "civo_network": resourceNetwork(), + "civo_volume": resourceVolume(), + "civo_volume_attachment": resourceVolumeAttachment(), + "civo_dns_domain_name": resourceDNSDomainName(), + "civo_dns_domain_record": resourceDNSDomainRecord(), + "civo_firewall": resourceFirewall(), + "civo_firewall_rule": resourceFirewallRule(), + // "civo_loadbalancer": resourceLoadBalancer(), + "civo_ssh_key": resourceSSHKey(), + // "civo_template": resourceTemplate(), + // "civo_snapshot": resourceSnapshot(), "civo_kubernetes_cluster": resourceKubernetesCluster(), "civo_kubernetes_node_pool": resourceKubernetesClusterNodePool(), }, diff --git a/civo/resource_dns_domain_name.go b/civo/resource_dns_domain_name.go index 0999572f..2829fdfa 100644 --- a/civo/resource_dns_domain_name.go +++ b/civo/resource_dns_domain_name.go @@ -11,19 +11,25 @@ import ( // Dns Domain resource, with this we can create and manage DNS Domain func resourceDNSDomainName() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo DNS domain name resource.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, - Description: "A fully qualified domain name", + Description: "The name of the domain", ValidateFunc: utils.ValidateName, }, // Computed resource + "id": { + Description: "The ID of this resource.", + Type: schema.TypeString, + Computed: true, + }, "account_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The account ID of the domain", }, }, Create: resourceDNSDomainNameCreate, diff --git a/civo/resource_dns_domain_record.go b/civo/resource_dns_domain_record.go index 7839cf03..b68508ca 100644 --- a/civo/resource_dns_domain_record.go +++ b/civo/resource_dns_domain_record.go @@ -2,23 +2,24 @@ package civo import ( "fmt" + "log" + "strings" + "github.com/civo/civogo" "github.com/civo/terraform-provider-civo/internal/utils" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "log" - "strings" ) // DNS domain record resource with this we can create and manage DNS Domain func resourceDNSDomainRecord() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo DNS domain record resource.", Schema: map[string]*schema.Schema{ "domain_id": { Type: schema.TypeString, Required: true, - Description: "Id from domain name", + Description: "ID from domain name", }, "type": { Type: schema.TypeString, @@ -56,17 +57,25 @@ func resourceDNSDomainRecord() *schema.Resource { Description: "How long caching DNS servers should cache this record for, in seconds (the minimum is 600 and the default if unspecified is 600)", }, // Computed resource + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", + }, "account_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The account ID of this resource", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp when this resource was created", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp when this resource was updated", }, }, Create: resourceDNSDomainRecordCreate, diff --git a/civo/resource_firewall.go b/civo/resource_firewall.go index 9320e713..909d8dc2 100644 --- a/civo/resource_firewall.go +++ b/civo/resource_firewall.go @@ -11,22 +11,31 @@ import ( // Firewall resource with this we can create and manage all firewall func resourceFirewall() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo firewall resource. This can be used to create, modify, and delete firewalls.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, ValidateFunc: utils.ValidateName, + Description: "The firewall name", }, "region": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The firewall region, if is not defined we use the global defined in the provider", }, "network_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The firewall network, if is not defined we use the default network", + }, + // Computed resource + "id": { + Description: "The ID of this resource.", + Type: schema.TypeString, + Computed: true, }, }, Create: resourceFirewallCreate, diff --git a/civo/resource_firewall_rule.go b/civo/resource_firewall_rule.go index 2fe0e417..77730ef3 100644 --- a/civo/resource_firewall_rule.go +++ b/civo/resource_firewall_rule.go @@ -14,21 +14,22 @@ import ( // this resource don't have an update option because the backend don't have the // support for that, so in this case we use ForceNew for all object in the resource func resourceFirewallRule() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo firewall rule resource. This can be used to create, modify, and delete firewalls rules. This resource don't have an update option because Civo backend doesn't support it at this moment. In that case, we use `ForceNew` for all object in the resource.", Schema: map[string]*schema.Schema{ "firewall_id": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: utils.ValidateName, + Description: "The Firewall ID", }, "protocol": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, - Description: "The protocol choice from tcp, udp or icmp (the default if unspecified is tcp)", + Description: "The protocol choice from `tcp`, `udp` or `icmp` (the default if unspecified is `tcp`)", ValidateFunc: validation.StringInSlice([]string{ "tcp", "udp", @@ -63,7 +64,7 @@ func resourceFirewallRule() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "Will this rule affect ingress traffic", + Description: "Will this rule affect ingress traffic (only `ingress` is supported now)", ValidateFunc: validation.StringInSlice([]string{ "ingress", }, false), @@ -73,7 +74,7 @@ func resourceFirewallRule() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "A string that will be the displayed name/reference for this rule (optional)", + Description: "A string that will be the displayed name/reference for this rule", ValidateFunc: validation.StringIsNotEmpty, }, "region": { @@ -84,6 +85,12 @@ func resourceFirewallRule() *schema.Resource { Description: "The region for this rule", ValidateFunc: validation.StringIsNotEmpty, }, + // Computed resource + "id": { + Description: "The ID of this resource.", + Type: schema.TypeString, + Computed: true, + }, }, Create: resourceFirewallRuleCreate, Read: resourceFirewallRuleRead, diff --git a/civo/resource_instance.go b/civo/resource_instance.go index 6e94daaf..16b6a4c4 100644 --- a/civo/resource_instance.go +++ b/civo/resource_instance.go @@ -18,6 +18,7 @@ import ( // and with it you can handle the instances created with Terraform func resourceInstance() *schema.Resource { return &schema.Resource{ + Description: "Provides a Civo instance resource. This can be used to create, modify, and delete instances.", Schema: map[string]*schema.Schema{ "region": { Type: schema.TypeString, @@ -28,7 +29,7 @@ func resourceInstance() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - Description: "A fully qualified domain name that should be set as the instance's hostname (required)", + Description: "A fully qualified domain name that should be set as the instance's hostname", ForceNew: true, ValidateFunc: utils.ValidateNameSize, }, @@ -102,55 +103,66 @@ func resourceInstance() *schema.Resource { "script": { Type: schema.TypeString, Optional: true, - Description: "the contents of a script that will be uploaded to /usr/local/bin/civo-user-init-script on your instance, " + + Description: "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", ValidateFunc: validation.StringIsNotEmpty, }, // Computed resource + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", + }, "cpu_cores": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's CPU cores", }, "ram_mb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's RAM (MB)", }, "disk_gb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's disk (GB)", }, "source_type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's source type", }, "source_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's source ID", }, "initial_password": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, + Type: schema.TypeString, + Computed: true, + Sensitive: true, + Description: "Initial password for login", }, "private_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's private IP address", }, "public_ip": { - Type: schema.TypeString, - Computed: true, - }, - "pseudo_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's public IP address", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's status", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp when the instance was created", }, }, Create: resourceInstanceCreate, @@ -341,7 +353,6 @@ func resourceInstanceRead(d *schema.ResourceData, m interface{}) error { d.Set("public_ip", resp.PublicIP) d.Set("network_id", resp.NetworkID) d.Set("firewall_id", resp.FirewallID) - // d.Set("pseudo_ip", resp.PseudoIP) d.Set("status", resp.Status) d.Set("script", resp.Script) d.Set("created_at", resp.CreatedAt.UTC().String()) diff --git a/civo/resource_kubernetes_cluster.go b/civo/resource_kubernetes_cluster.go index 673b857c..acc50d2e 100644 --- a/civo/resource_kubernetes_cluster.go +++ b/civo/resource_kubernetes_cluster.go @@ -17,12 +17,13 @@ import ( // Kubernetes Cluster resource, with this you can manage all cluster from terraform func resourceKubernetesCluster() *schema.Resource { return &schema.Resource{ + Description: "Provides a Civo Kubernetes cluster resource. This can be used to create, delete, and modify clusters.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Optional: true, Computed: true, - Description: "a name for your cluster, must be unique within your account (required)", + Description: "Name for your cluster, must be unique within your account", ValidateFunc: utils.ValidateNameSize, }, "region": { @@ -41,34 +42,37 @@ func resourceKubernetesCluster() *schema.Resource { Type: schema.TypeInt, Optional: true, Computed: true, - Description: "the number of instances to create (optional, the default at the time of writing is 3)", + Description: "The number of instances to create (optional, the default at the time of writing is 3)", ValidateFunc: validation.IntAtLeast(1), }, "target_nodes_size": { Type: schema.TypeString, Optional: true, Computed: true, - Description: "the size of each node (optional, the default is currently g2.k3s.medium)", + Description: "The size of each node (optional, the default is currently g3.k3s.medium)", }, "kubernetes_version": { Type: schema.TypeString, Optional: true, Computed: true, - Description: "the version of k3s to install (optional, the default is currently the latest available)", + Description: "The version of k3s to install (optional, the default is currently the latest available)", }, "tags": { Type: schema.TypeString, Optional: true, - Description: "a space separated list of tags, to be used freely as required (optional)", + Description: "Space separated list of tags, to be used freely as required", }, "applications": { Type: schema.TypeString, Optional: true, - Description: "a comma separated list of applications to install." + - "Spaces within application names are fine, but shouldn't be either side of the comma." + - "Application names are case-sensitive; the available applications can be listed with the civo CLI:" + - "'civo kubernetes applications ls'." + + Description: strings.Join([]string{ + "Comma separated list of applications to install.", + "Spaces within application names are fine, but shouldn't be either side of the comma.", + "Application names are case-sensitive; the available applications can be listed with the Civo CLI:", + "'civo kubernetes applications ls'.", "If you want to remove a default installed application, prefix it with a '-', e.g. -Traefik.", + "For application that supports plans, you can use 'app_name:app_plan' format e.g. 'Linkerd:Linkerd & Jaeger' or 'MariaDB:5GB'.", + }, " "), }, "firewall_id": { Type: schema.TypeString, @@ -77,37 +81,49 @@ func resourceKubernetesCluster() *schema.Resource { Description: "The existing firewall ID to use for this cluster", }, // Computed resource + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", + }, "instances": instanceSchema(), "installed_applications": applicationSchema(), "pools": nodePoolSchema(), "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Status of the cluster", }, "ready": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "When cluster is ready, this will return `true`", }, "kubeconfig": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, + Type: schema.TypeString, + Computed: true, + Sensitive: true, + Description: "The kubeconfig of the cluster", }, "api_endpoint": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The API server endpoint of the cluster", }, "master_ip": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The IP address of the master node", }, "dns_entry": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The DNS name of the cluster", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the cluster was created", }, }, Create: resourceKubernetesClusterCreate, @@ -128,33 +144,40 @@ func instanceSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "hostname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's hostname", }, "size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's size", }, "cpu_cores": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's CPU cores", }, "ram_mb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's RAM (MB)", }, "disk_gb": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Instance's disk (GB)", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Instance's status", }, "tags": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Instance's tags", }, }, }, @@ -169,21 +192,25 @@ func nodePoolSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Nodepool ID", }, "count": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Number of nodes in the nodepool", }, "size": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Size of the nodes in the nodepool", }, "instance_names": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Instance names in the nodepool", }, "instances": instanceSchema(), }, @@ -199,20 +226,24 @@ func applicationSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "application": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of application", }, "version": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Version of application", }, "installed": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Application installation status (`true` if installed)", }, "category": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Category of the application", }, }, }, diff --git a/civo/resource_kubernetes_cluster_nodepool.go b/civo/resource_kubernetes_cluster_nodepool.go index 8dfc62c5..9e8fd57c 100644 --- a/civo/resource_kubernetes_cluster_nodepool.go +++ b/civo/resource_kubernetes_cluster_nodepool.go @@ -20,17 +20,18 @@ import ( // Kubernetes Cluster resource, with this you can manage all cluster from terraform func resourceKubernetesClusterNodePool() *schema.Resource { return &schema.Resource{ + Description: "Provides a Civo Kubernetes node pool resource. While the default node pool must be defined in the `civo_kubernetes_cluster` resource, this resource can be used to add additional ones to a cluster.", Schema: map[string]*schema.Schema{ "cluster_id": { Type: schema.TypeString, Required: true, - Description: "The id of your cluster (required)", + Description: "The ID of your cluster", ValidateFunc: validation.StringIsNotEmpty, }, "region": { Type: schema.TypeString, Required: true, - Description: "The region of the node pool, has to match that of the cluster (required)", + Description: "The region of the node pool, has to match that of the cluster", ValidateFunc: validation.StringIsNotEmpty, }, "num_target_nodes": { @@ -43,7 +44,12 @@ func resourceKubernetesClusterNodePool() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - Description: "the size of each node (optional, the default is currently g2.k3s.medium)", + Description: "the size of each node (optional, the default is currently g3.k3s.medium)", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", }, }, Create: resourceKubernetesClusterNodePoolCreate, diff --git a/civo/resource_loadbalancer.go b/civo/resource_loadbalancer.go index 17ee92ef..2765bfe0 100644 --- a/civo/resource_loadbalancer.go +++ b/civo/resource_loadbalancer.go @@ -12,8 +12,8 @@ import ( // This resource represent a load balancer in the system func resourceLoadBalancer() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo load balancer resource. This can be used to create, modify, and delete load balancers.", Schema: map[string]*schema.Schema{ "hostname": { Type: schema.TypeString, diff --git a/civo/resource_network.go b/civo/resource_network.go index 3df880e0..5cc7d9c2 100644 --- a/civo/resource_network.go +++ b/civo/resource_network.go @@ -11,8 +11,8 @@ import ( // The resource network represent a network inside the cloud func resourceNetwork() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo network resource. This can be used to create, modify, and delete networks.", Schema: map[string]*schema.Schema{ "label": { Type: schema.TypeString, @@ -23,16 +23,23 @@ func resourceNetwork() *schema.Resource { "region": { Type: schema.TypeString, Optional: true, - Description: "Name of the region", + Description: "The region of the network", }, // Computed resource "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the network", }, "default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "If the network is default, this will be `true`", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource", }, }, Create: resourceNetworkCreate, diff --git a/civo/resource_snapshot.go b/civo/resource_snapshot.go index 4ef845e3..86ca39b0 100644 --- a/civo/resource_snapshot.go +++ b/civo/resource_snapshot.go @@ -17,6 +17,7 @@ import ( // in any value will be recreate the resource func resourceSnapshot() *schema.Resource { return &schema.Resource{ + Description: "Provides a resource which can be used to create a snapshot from an existing Civo instance.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, diff --git a/civo/resource_ssh.go b/civo/resource_ssh.go index bb105223..02b19f75 100644 --- a/civo/resource_ssh.go +++ b/civo/resource_ssh.go @@ -11,8 +11,8 @@ import ( // Ssh resource, with this we can create and manage all Snapshot func resourceSSHKey() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo SSH key resource to allow you to manage SSH keys for instance access. Keys created with this resource can be referenced in your instance configuration via their ID.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -26,11 +26,17 @@ func resourceSSHKey() *schema.Resource { Description: "a string containing the SSH public key.", ForceNew: true, }, + // Computed resource "fingerprint": { Type: schema.TypeString, Computed: true, Description: "a string containing the SSH finger print.", }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", + }, }, Create: resourceSSHKeyCreate, Read: resourceSSHKeyRead, diff --git a/civo/resource_volume.go b/civo/resource_volume.go index 2992617b..f8b49c13 100644 --- a/civo/resource_volume.go +++ b/civo/resource_volume.go @@ -11,8 +11,8 @@ import ( // Volume resource, with this we can create and manage all volume func resourceVolume() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Provides a Civo volume which can be attached to an instance in order to provide expanded storage.", Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -28,7 +28,7 @@ func resourceVolume() *schema.Resource { "region": { Type: schema.TypeString, Optional: true, - Description: "The region for the volume", + Description: "The region for the volume, if not declare we use the region in declared in the provider.", }, "network_id": { Type: schema.TypeString, @@ -37,8 +37,14 @@ func resourceVolume() *schema.Resource { }, // Computed resource "mount_point": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The mount point of the volume (from instance's perspective)", + }, + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", }, }, Create: resourceVolumeCreate, diff --git a/civo/resource_volume_attachment.go b/civo/resource_volume_attachment.go index 6c71ed7f..c5e15de7 100644 --- a/civo/resource_volume_attachment.go +++ b/civo/resource_volume_attachment.go @@ -12,14 +12,15 @@ import ( // Volume resource, with this we can create and manage all volume func resourceVolumeAttachment() *schema.Resource { - fmt.Print() return &schema.Resource{ + Description: "Manages volume attachment/detachment to an instance.", Schema: map[string]*schema.Schema{ "instance_id": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validation.NoZeroValues, + Description: "The ID of target instance for attachment", }, "volume_id": { @@ -27,6 +28,7 @@ func resourceVolumeAttachment() *schema.Resource { Required: true, ForceNew: true, ValidateFunc: validation.NoZeroValues, + Description: "The ID of target volume for attachment", }, "region": { Type: schema.TypeString, @@ -34,6 +36,12 @@ func resourceVolumeAttachment() *schema.Resource { ForceNew: true, Description: "The region for the volume attachment", }, + // Computed resource + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of this resource.", + }, }, Create: resourceVolumeAttachmentCreate, Read: resourceVolumeAttachmentRead, diff --git a/docs/data-sources/disk_image.md b/docs/data-sources/disk_image.md index 879c1620..6bb21623 100644 --- a/docs/data-sources/disk_image.md +++ b/docs/data-sources/disk_image.md @@ -1,20 +1,18 @@ --- -layout: "civo" -page_title: "Civo: civo_disk_image" -sidebar_current: "docs-civo-datasource-disk_image" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_disk_image Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a Civo disk image. + Get information on an disk image for use in other resources (e.g. creating a instance) with the ability to filter the results. --- -# civo\_disk\_image +# civo_disk_image (Data Source) -Get information on an disk image for use in other resources (e.g. creating a Instance). +Get information on an disk image for use in other resources (e.g. creating a instance) with the ability to filter the results. ## Example Usage -This will filter for `debian-10` disk images. - -```hcl +```terraform data "civo_disk_image" "debian" { filter { key = "name" @@ -31,57 +29,54 @@ resource "civo_instance" "my-test-instance" { } ``` -It is similar to the previous one with the difference that in this one we use region to only look for the disk images of that region. -The Instance/Kubernetes cluster where you use this data source must be in the same region. + +## Schema -```hcl -data "civo_disk_image" "debian" { - region = "LON1" - filter { - key = "name" - values = ["debian"] - match_by = "re" - } - sort { - key = "version" - direction = "asc" - } -} +### Optional -resource "civo_instance" "foo-host" { - region = "LON1" - hostname = "foo.com" - size = element(data.civo_instances_size.small.sizes, 0).name - disk_image = element(data.civo_disk_image.debian.diskimages, 0).id -} -``` +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **region** (String) If is used, all disk image will be from this region. Required if no region is set in provider. +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) + +### Read-Only + +- **diskimages** (List of Object) (see [below for nested schema](#nestedatt--diskimages)) + + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter diskimages by this key. This may be one of `id`, `label`, `name`, `version`. +- **values** (List of String) Only retrieves `diskimages` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. -## Argument Reference -The following arguments are supported: + +### Nested Schema for `sort` -* `region` - (Optional) If is used, them all disk_image will be from that region, has to be declared here if is not declared in the provider -* `filter` - (Optional) Filter the results. The `filter` block is documented below. -* `sort` - (Optional) Sort the results. The `sort` block is documented below. +Required: -`filter` supports the following arguments: +- **key** (String) Sort diskimages by this key. This may be one of `id`, `label`, `name`, `version`. -* `key` - (Required) Filter the sizes by this key. This may be one of `id`,`name`,`version`,`label`. -* `values` - (Required) Only retrieves the disk_image which keys has value that matches - one of the values provided here. +Optional: -`sort` supports the following arguments: +- **direction** (String) The sort direction. This may be either `asc` or `desc`. -* `key` - (Required) Sort the sizes by this key. This may be one of `id`,`name`,`version`,`label`. -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. + +### Nested Schema for `diskimages` -## Attributes Reference +Read-Only: -The following attributes are exported: +- **id** (String) +- **label** (String) +- **name** (String) +- **version** (String) -* `id` - The id of the disk_image -* `name` - A short human readable name for the disk_image -* `version` - The version of the disk_image. -* `label` - The label of the disk_image. diff --git a/docs/data-sources/dns_domain_name.md b/docs/data-sources/dns_domain_name.md index e1a3eb97..a5887844 100644 --- a/docs/data-sources/dns_domain_name.md +++ b/docs/data-sources/dns_domain_name.md @@ -1,24 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_dns_domain_name" -sidebar_current: "docs-civo-datasource-domain" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_dns_domain_name Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a domain. + 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. --- -# civo_dns_domain_name +# civo_dns_domain_name (Data Source) -Get information on a domain. This data source provides the name and the id, this is useful if the domain -name in question is not managed by Terraform. +Get information on a domain. This data source provides the name and the id. -An error is triggered if the provided domain name is not managed with your -Civo account. +An error will be raised if the provided domain name is not in your Civo account. ## Example Usage -Get the name and the id file for a domain: - -```hcl +```terraform data "civo_dns_domain_name" "domain" { name = "domain.com" } @@ -26,35 +23,18 @@ data "civo_dns_domain_name" "domain" { output "domain_output" { value = data.civo_dns_domain_name.domain.name } + output "domain_id_output" { value = data.civo_dns_domain_name.domain.id } - ``` -``` - $ terraform apply - -data.civo_dns_domain_name.domain: Refreshing state... - -Apply complete! Resources: 0 added, 0 changed, 0 destroyed. - -Outputs: - -domain_output = domain.com. -domain_id_output = 6ea98024-c6d7-4d0c-bd01-8ee0cab5224e -``` - -## Argument Reference - -The following arguments are supported: + +## Schema -* `id` - (Optional) The id of the domain. -* `name` - (Optional) The name of the domain. +### Optional -## Attributes Reference +- **id** (String) The ID of this resource. +- **name** (String) The name of the domain -The following attributes are exported: -* `id` - A unique ID that can be used to identify and reference a domain. -* `name` - The name of the domain. diff --git a/docs/data-sources/dns_domain_record.md b/docs/data-sources/dns_domain_record.md index c6771d1b..be4d7166 100644 --- a/docs/data-sources/dns_domain_record.md +++ b/docs/data-sources/dns_domain_record.md @@ -1,25 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_dns_domain_record" -sidebar_current: "docs-civo-datasource-record" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_dns_domain_record Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a DNS record. + 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. --- -# civo_dns_domain_record +# civo_dns_domain_record (Data Source) -Get information on a DNS record. This data source provides the name, TTL, and zone -file as configured on your Civo account. This is useful if the record -in question is not managed by Terraform. +Get information on a DNS record. This data source provides the name, TTL, and zone file as configured on your Civo account. -An error is triggered if the provided domain name or record are not managed with -your Civo account. +An error will be raised if the provided domain name or record are not in your Civo account. ## Example Usage -Get data from a DNS record: - -```hcl +```terraform data "civo_dns_domain_name" "domain" { name = "domain.com" } @@ -38,37 +34,26 @@ output "record_ttl" { } ``` -``` - $ terraform apply - -data.civo_dns_domain_record.www: Refreshing state... + +## Schema -Apply complete! Resources: 0 added, 0 changed, 0 destroyed. +### Required -Outputs: - -record_ttl = 3600 -record_type = A -``` +- **domain_id** (String) The ID of the domain +- **name** (String) The name of the record -## Argument Reference +### Optional -The following arguments are supported: +- **id** (String) The ID of this resource. -* `name` - (Required) The name of the record. -* `domain_id` - (Required) The domain id of the record. +### Read-Only -## Attributes Reference +- **account_id** (String) The ID account of the domain +- **created_at** (String) The date when it was created in UTC format +- **priority** (Number) The priority of the record +- **ttl** (Number) How long caching DNS servers should cache this record +- **type** (String) The choice of record type from A, CNAME, MX, SRV or TXT +- **updated_at** (String) The date when it was updated in UTC format +- **value** (String) The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record -The following attributes are exported: -* `id` - A unique ID that can be used to identify and reference a Record. -* `domain_id` - The id of the domain -* `type` - The choice of record type from A, CNAME, MX, SRV or TXT -* `name` - The portion before the domain name (e.g. www) or an @ for the apex/root domain (you cannot use an A record with an amex/root domain) -* `value` - The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record -* `priority` - The priority of the record. -* `ttl` - How long caching DNS servers should cache this record. -* `account_id` - The id account of the domain. -* `created_at` - The date when it was created in UTC format -* `updated_at` - The date when it was updated in UTC format \ No newline at end of file diff --git a/docs/data-sources/instance.md b/docs/data-sources/instance.md index ce1dfe66..2c20242a 100644 --- a/docs/data-sources/instance.md +++ b/docs/data-sources/instance.md @@ -1,26 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_instance" -sidebar_current: "docs-civo-datasource-instance" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_instance Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a Instance. + Get information on an instance for use in other resources. This data source provides all of the instance's properties as configured on your Civo account. + Note: This data source returns a single instance. When specifying a hostname, an error will be raised if more than one instances found. --- -# civo_instance +# civo_instance (Data Source) -Get information on a Instance for use in other resources. This data source provides -all of the Instance's properties as configured on your Civo account. This -is useful if the Instance in question is not managed by Terraform or you need to -utilize any of the Instance's data. +Get information on an instance for use in other resources. This data source provides all of the instance's properties as configured on your Civo account. -**Note:** This data source returns a single Instance. When specifying a `hostname`, an -error is triggered if more than one Instance is found. +Note: This data source returns a single instance. When specifying a hostname, an error will be raised if more than one instances found. ## Example Usage -Get the Instance by hostname: - -```hcl +```terraform data "civo_instance" "myhostaname" { hostname = "myhostname.com" } @@ -30,54 +25,35 @@ output "instance_output" { } ``` -Get the Instance by id: - -```hcl -data "civo_instance" "myhostaname" { - id = "6f283ab7-c37e-42f9-9b4b-f80aea8c006d" -} -``` - -Get the Instance by id and region: - -```hcl -data "civo_instance" "myhostaname" { - id = "6f283ab7-c37e-42f9-9b4b-f80aea8c006d" - region = "NCY1" -} -``` -## Argument Reference - -One of following the arguments must be provided: - -* `id` - (Optional) The ID of the Instance -* `hostname` - (Optional) The hostname of the Instance. -* `region` - (Optional) The region of an existing Instance. - -## Attributes Reference + +## Schema + +### Optional + +- **hostname** (String) The hostname of the Instance +- **id** (String) The ID of this resource. +- **region** (String) The region of an existing Instance + +### Read-Only + +- **cpu_cores** (Number) Total cpu of the inatance +- **created_at** (String) The date of creation of the instance +- **disk_gb** (Number) The size of the disk +- **firewall_id** (String) The ID of the firewall used +- **initial_password** (String) Instance initial password +- **initial_user** (String) The name of the initial user created on the server +- **network_id** (String) his will be the ID of the network +- **notes** (String) The notes of the instance +- **private_ip** (String) The private IP +- **pseudo_ip** (String) Is the ip that is used to route the public ip from the internet to the instance using NAT +- **public_ip** (String) The public IP +- **ram_mb** (Number) Total ram of the instance +- **reverse_dns** (String) A fully qualified domain name +- **script** (String) The contents of a script uploaded +- **size** (String) The name of the size +- **sshkey_id** (String) The ID SSH key +- **status** (String) The status of the instance +- **tags** (Set of String) An optional list of tags +- **template** (String) The ID for the disk image/template to used to build the instance -The following attributes are exported: -* `id` - The ID of the Instance. -* `hostname` - The Instance hostname. -* `reverse_dns` - A fully qualified domain name. -* `size` - The name of the size. -* `cpu_cores` - Total cpu of the inatance. -* `ram_mb` - Total ram of the instance. -* `disk_gb` - The size of the disk. -* `public_ip_requiered` - This should be either `create`, `none` or `move_ip_from:intances_id`. -* `network_id` - This will be the ID of the network. -* `template` - The ID for the template to used to build the instance. -* `initial_user` - The name of the initial user created on the server. -* `notes` - The notes of the instance. -* `sshkey_id` - The ID SSH. -* `firewall_id` - The ID of the firewall used. -* `tags` - An optional list of tags -* `initial_password` - Instance initial password -* `private_ip` - The private ip. -* `public_ip` - The public ip. -* `pseudo_ip` - Is the ip that is used to route the public ip from the internet to the instance using NAT -* `status` - The status of the instance -* `region` - The region of the instance -* `script` - the contents of a script uploaded -* `created_at` - The date of creation of the instance \ No newline at end of file diff --git a/docs/data-sources/instance_size.md b/docs/data-sources/instance_size.md deleted file mode 100644 index 8a0661c3..00000000 --- a/docs/data-sources/instance_size.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -layout: "civo" -page_title: "Civo: civo_instance_size" -sidebar_current: "docs-civo-datasource-instance_size" -description: |- - Get information on a Civo Instance Size. ---- - -# civo\_instance\_size - -Retrieves information about the Instance sizes that Civo supports, -with the ability to filter the results. - -## Example Usage - -Most common usage will probably be to supply a size to instances: - -```hcl -data "civo_instances_size" "small" { - filter { - key = "name" - values = ["g3.small"] - match_by = "re" - } - - filter { - key = "type" - values = ["instance"] - } - -} - -resource "civo_instance" "my-test-instance" { - hostname = "foo.com" - tags = ["python", "nginx"] - notes = "this is a note for the server" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id -} -``` - -The data source also supports multiple filters and sorts. For example, to fetch sizes with 1 or 2 virtual CPU and sort by disk: - -```hcl -data "civo_instances_size" "small" { - filter { - key = "cpu" - values = [1,2] - } - - sort { - key = "disk" - direction = "desc" - } - -} - -resource "civo_instance" "my-test-instance" { - hostname = "foo.com" - tags = ["python", "nginx"] - notes = "this is a note for the server" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id -} -``` - -The data source can also handle multiple sorts. In which case, the sort will be applied in the order it is defined. For example, to sort by memory in ascending order, then sort by disk in descending order between sizes with same memory: - -```hcl -data "civo_instances_size" "main" { - sort { - // Sort by memory ascendingly - key = "ram" - direction = "asc" - } - - sort { - // Then sort by disk descendingly for sizes with same memory - key = "disk" - direction = "desc" - } -} -``` - -## Argument Reference - -The following arguments are supported: - -* `filter` - (Optional) Filter the results. - The `filter` block is documented below. -* `sort` - (Optional) Sort the results. - The `sort` block is documented below. - -`filter` supports the following arguments: - -* `key` - (Required) Filter the sizes by this key. This may be one of `name`, - `type`, `cpu`, `ram`, `disk`, `selectable`. -* `values` - (Required) Only retrieves images which keys has value that matches - one of the values provided here. - -`sort` supports the following arguments: - -* `key` - (Required) Sort the sizes by this key. This may be one of `name`, - `type`, `cpu`, `ram`, `disk`, `selectable`. -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. - - -## Attributes Reference - -The following attributes are exported: - -* `name`: The name of the instance size. -* `type`: A human name of the instance size. -* `cpu` - Total of CPU in the instance. -* `ram`: Total of RAM of the instance. -* `disk`: The instance size of SSD. -* `description` - A description of the instance size. -* `selectable`: If can use the instance size. diff --git a/docs/data-sources/instances.md b/docs/data-sources/instances.md index 11defd8a..99cd936c 100644 --- a/docs/data-sources/instances.md +++ b/docs/data-sources/instances.md @@ -1,29 +1,21 @@ --- -layout: "civo" -page_title: "Civo: instances" -sidebar_current: "docs-civo-datasource-instances" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_instances Data Source - terraform-provider-civo" +subcategory: "" description: |- - Retrieve information on Instances. + Get information on instances for use in other resources, with the ability to filter and sort the results. If no filters are specified, all instances will be returned. + Note: You can use the civo_instance data source to obtain metadata about a single instance if you already know the id, unique hostname, or unique tag to retrieve. --- -# civo_instances +# civo_instances (Data Source) -Get information on Instances for use in other resources, with the ability to filter and sort the results. -If no filters are specified, all Instances will be returned. +Get information on instances for use in other resources, with the ability to filter and sort the results. If no filters are specified, all instances will be returned. -This data source is useful if the Instances in question are not managed by Terraform or you need to -utilize any of the Instances' data. - -Note: You can use the [`civo_instance`](/docs/providers/civo/d/instance.html) data source to obtain metadata -about a single instance if you already know the `id`, unique `hostname`, or unique `tag` to retrieve. +Note: You can use the `civo_instance` data source to obtain metadata about a single instance if you already know the id, unique hostname, or unique tag to retrieve. ## Example Usage -Use the `filter` block with a `key` string and `values` list to filter images. - -For example to find all instances with size `g3.small`: - -```hcl +```terraform data "civo_instances" "small-size" { region = "NYC1" filter { @@ -33,88 +25,72 @@ data "civo_instances" "small-size" { } ``` -You can filter and sort the results as well: - -```hcl -data "civo_instances" "small-with-backups" { - filter { - key = "size" - values = [g3.small] - } - sort { - key = "created_at" - direction = "desc" - } -} -``` -if you don't know the size you can use the [`civo_instances_size`](/docs/providers/civo/d/instances_size.html) data source to obtain metadata -and use in this way: + +## Schema -```hcl -data "civo_instances_size" "small" { - filter { - key = "name" - values = ["small"] - } -} +### Optional -data "civo_instances" "small-with-backups" { - region = "SVG1" - filter { - key = "size" - values = [element(data.civo_instances_size.small.sizes, 0).name] - } - sort { - key = "created_at" - direction = "desc" - } -} -``` +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **region** (String) If used, all instances will be from the provided region +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) + +### Read-Only + +- **instances** (List of Object) (see [below for nested schema](#nestedatt--instances)) + + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter instances by this key. This may be one of `cpu_cores`, `created_at`, `disk_gb`, `firewall_id`, `hostname`, `id`, `initial_password`, `initial_user`, `network_id`, `notes`, `private_ip`, `pseudo_ip`, `public_ip`, `ram_mb`, `region`, `reverse_dns`, `script`, `size`, `sshkey_id`, `status`, `tags`, `template`. +- **values** (List of String) Only retrieves `instances` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. + + + +### Nested Schema for `sort` + +Required: + +- **key** (String) Sort instances by this key. This may be one of `cpu_cores`, `created_at`, `disk_gb`, `firewall_id`, `hostname`, `id`, `initial_password`, `initial_user`, `network_id`, `notes`, `private_ip`, `pseudo_ip`, `public_ip`, `ram_mb`, `region`, `reverse_dns`, `script`, `size`, `sshkey_id`, `status`, `template`. + +Optional: + +- **direction** (String) The sort direction. This may be either `asc` or `desc`. + + + +### Nested Schema for `instances` + +Read-Only: + +- **cpu_cores** (Number) +- **created_at** (String) +- **disk_gb** (Number) +- **firewall_id** (String) +- **hostname** (String) +- **id** (String) +- **initial_password** (String) +- **initial_user** (String) +- **network_id** (String) +- **notes** (String) +- **private_ip** (String) +- **pseudo_ip** (String) +- **public_ip** (String) +- **ram_mb** (Number) +- **region** (String) +- **reverse_dns** (String) +- **script** (String) +- **size** (String) +- **sshkey_id** (String) +- **status** (String) +- **tags** (Set of String) +- **template** (String) -## Argument Reference -* `region` - (Optional) If is used, them all instances will be from that region. -* `filter` - (Optional) Filter the results. The `filter` block is documented below. -* `sort` - (Optional) Sort the results. The `sort` block is documented below. - -`filter` supports the following arguments: - -* `key` - (Required) Filter the Instances by this key. This may be one of '`id`, `hostname`, `public_ip`, `private_ip`, - `pseudo_ip`, `size`, `cpu_cores`, `ram_mb`, `disk_gb`, `template` or `created_at`. - -* `values` - (Required) A list of values to match against the `key` field. Only retrieves Instances - where the `key` field takes on one or more of the values provided here. - -`sort` supports the following arguments: - -* `key` - (Required) Sort the Instance by this key. This may be one of `id`, `hostname`, `public_ip`, `private_ip`, - `pseudo_ip`, `size`, `cpu_cores`, `ram_mb`, `disk_gb`, `template` or `created_at`. - -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. - -## Attributes Reference - -* `instances` - A list of Instances satisfying any `filter` and `sort` criteria. Each instance has the following attributes: - -* `id` - The ID of the Instance. -* `hostname` - The Instance hostname. -* `reverse_dns` - A fully qualified domain name. -* `size` - The name of the size. -* `cpu_cores` - Total cpu of the inatance. -* `ram_mb` - Total ram of the instance. -* `disk_gb` - The size of the disk. -* `public_ip_requiered` - This should be either `create`, `none` or `move_ip_from:intances_id`. -* `network_id` - This will be the ID of the network. -* `template` - The ID for the template to used to build the instance. -* `initial_user` - The name of the initial user created on the server. -* `notes` - The notes of the instance. -* `sshkey_id` - The ID SSH. -* `firewall_id` - The ID of the firewall used. -* `tags` - An optional list of tags -* `initial_password` - Instance initial password -* `private_ip` - The private ip. -* `public_ip` - The public ip. -* `pseudo_ip` - Is the ip that is used to route the public ip from the internet to the instance using NAT -* `status` - The status of the instance -* `script` - the contents of a script uploaded -* `created_at` - The date of creation of the instance \ No newline at end of file diff --git a/docs/data-sources/instances_size.md b/docs/data-sources/instances_size.md new file mode 100644 index 00000000..8ab340ee --- /dev/null +++ b/docs/data-sources/instances_size.md @@ -0,0 +1,91 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_instances_size Data Source - terraform-provider-civo" +subcategory: "" +description: |- + Retrieves information about the instance sizes that Civo supports, with the ability to filter the results. +--- + +# civo_instances_size (Data Source) + +Retrieves information about the instance sizes that Civo supports, with the ability to filter the results. + +## Example Usage + +```terraform +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +resource "civo_instance" "my-test-instance" { + 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 +} +``` + + +## Schema + +### Optional + +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) + +### Read-Only + +- **sizes** (List of Object) (see [below for nested schema](#nestedatt--sizes)) + + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter sizes by this key. This may be one of `cpu`, `description`, `disk`, `name`, `ram`, `selectable`, `type`. +- **values** (List of String) Only retrieves `sizes` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. + + + +### Nested Schema for `sort` + +Required: + +- **key** (String) Sort sizes by this key. This may be one of `cpu`, `description`, `disk`, `name`, `ram`, `selectable`, `type`. + +Optional: + +- **direction** (String) The sort direction. This may be either `asc` or `desc`. + + + +### Nested Schema for `sizes` + +Read-Only: + +- **cpu** (Number) +- **description** (String) +- **disk** (Number) +- **name** (String) +- **ram** (Number) +- **selectable** (Boolean) +- **type** (String) + + diff --git a/docs/data-sources/kubernetes_cluster.md b/docs/data-sources/kubernetes_cluster.md index 338a54cb..09bd44ce 100644 --- a/docs/data-sources/kubernetes_cluster.md +++ b/docs/data-sources/kubernetes_cluster.md @@ -1,23 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_kubernetes_cluster" -sidebar_current: "docs-civo-datasource-kubernetes-cluster" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_kubernetes_cluster Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get a Civo Kubernetes cluster resource. + Provides a Civo Kubernetes cluster data source. + Note: This data source returns a single Kubernetes cluster. When specifying a name, an error will be raised if more than one Kubernetes cluster found. --- -# civo_kubernetes_cluster +# civo_kubernetes_cluster (Data Source) Provides a Civo Kubernetes cluster data source. -**Note:** This data source returns a single kubernetes cluster. When specifying a `name`, an -error is triggered if more than one kubernetes Cluster is found. +Note: This data source returns a single Kubernetes cluster. When specifying a name, an error will be raised if more than one Kubernetes cluster found. ## Example Usage -Get the Kubernetes Cluster by name: - -```hcl +```terraform data "civo_kubernetes_cluster" "my-cluster" { name = "my-super-cluster" } @@ -27,60 +25,80 @@ output "kubernetes_cluster_output" { } ``` -Get the Kubernetes Cluster by id: + +## Schema + +### Optional + +- **id** (String) The ID of this resource. +- **name** (String) The name of the Kubernetes Cluster +- **region** (String) The region where cluster is running + +### Read-Only + +- **api_endpoint** (String) The base URL of the API server on the Kubernetes master node +- **applications** (String) A list of application installed +- **created_at** (String) The date where the Kubernetes cluster was create +- **dns_entry** (String) The unique dns entry for the cluster in this case point to the master +- **installed_applications** (List of Object) (see [below for nested schema](#nestedatt--installed_applications)) +- **instances** (List of Object) (see [below for nested schema](#nestedatt--instances)) +- **kubeconfig** (String) A representation of the Kubernetes cluster's kubeconfig in yaml format +- **kubernetes_version** (String) The version of Kubernetes +- **master_ip** (String) The IP of the Kubernetes master node +- **num_target_nodes** (Number) The size of the Kubernetes cluster +- **pools** (List of Object) (see [below for nested schema](#nestedatt--pools)) +- **ready** (Boolean) If the Kubernetes cluster is ready +- **status** (String) The status of Kubernetes cluster +- **tags** (String) A list of tags +- **target_nodes_size** (String) The size of each node + + +### Nested Schema for `installed_applications` + +Read-Only: + +- **application** (String) +- **category** (String) +- **installed** (Boolean) +- **version** (String) + + + +### Nested Schema for `instances` + +Read-Only: + +- **cpu_cores** (Number) +- **disk_gb** (Number) +- **hostname** (String) +- **ram_mb** (Number) +- **size** (String) +- **status** (String) +- **tags** (Set of String) + + + +### Nested Schema for `pools` + +Read-Only: + +- **count** (Number) +- **id** (String) +- **instance_names** (Set of String) +- **instances** (List of Object) (see [below for nested schema](#nestedobjatt--pools--instances)) +- **size** (String) + + +### Nested Schema for `pools.instances` + +Read-Only: + +- **cpu_cores** (Number) +- **disk_gb** (Number) +- **hostname** (String) +- **ram_mb** (Number) +- **size** (String) +- **status** (String) +- **tags** (Set of String) + -```hcl -data "civo_kubernetes_cluster" "my-cluster" { - name = "40ac97ee-b82b-4231-9b60-079c7e2e5d79" -} -``` -## Argument Reference - -One of following the arguments must be provided: - -* `id` - (Optional) The ID of the kubernetes Cluster -* `name` - (Optional) The name of the kubernetes Cluster. - -## Attributes Reference - -The following attributes are exported: - -* `id` - A unique ID that can be used to identify and reference a Kubernetes cluster. -* `name` - The name of your cluster,. -* `num_target_nodes` - The size of the Kubernetes cluster. -* `target_nodes_size` - The size of each node. -* `kubernetes_version` - The version of Kubernetes. -* `tags` - A list of tags. -* `applications` - A list of application installed. -* `instances` - In addition to the arguments provided, these additional attributes about the cluster's default node instance are exported: - - `hostname` - The hostname of the instance. - - `cpu_cores` - Total cpu of the inatance. - - `ram_mb` - Total ram of the instance - - `disk_gb` - The size of the disk. - - `status` - The status of the instance. - - `tags` - The tag of the instances -* `pools` - A list of node pools associated with the cluster. Each node pool exports the following attributes: - - `id` - The ID of the pool - - `count` - The size of the pool - - `size` - The size of each node inside the pool - - `instance_names` - A list of the instance in the pool - * `instances` - A list of instance inside the pool - - `hostname` - The hostname of the instance. - - `size` - The size of the instance. - - `cpu_cores` - Total cpu of the inatance. - - `ram_mb` - Total ram of the instance - - `disk_gb` - The size of the disk. - - `status` - The status of the instance. - - `tags` - The tag of the instances -* `installed_applications` - A unique ID that can be used to identify and reference a Kubernetes cluster. - - `application` - The name of the application - - `version` - The version of the application - - `installed` - if installed or not - - `category` - The category of the application -* `status` - The status of Kubernetes cluster. -* `ready` -If the Kubernetes cluster is ready. -* `kubeconfig` - A representation of the Kubernetes cluster's kubeconfig in yaml format. -* `api_endpoint` - The base URL of the API server on the Kubernetes master node. -* `master_ip` - The Ip of the Kubernetes master node. -* `dns_entry` - The unique dns entry for the cluster in this case point to the master. -* `created_at` - The date where the Kubernetes cluster was create. \ No newline at end of file diff --git a/docs/data-sources/kubernetes_version.md b/docs/data-sources/kubernetes_version.md index bfdc8637..2f973ffc 100644 --- a/docs/data-sources/kubernetes_version.md +++ b/docs/data-sources/kubernetes_version.md @@ -1,18 +1,18 @@ --- -layout: "civo" -page_title: "Civo: civo_kubernetes_version" -sidebar_current: "docs-civo-datasource-kubernetes-version" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_kubernetes_version Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get available Civo Kubernetes versions. + Provides access to the available Civo Kubernetes versions, with the ability to filter the results. --- -# civo\_kubernetes\_version +# civo_kubernetes_version (Data Source) -Provides access to the available Civo Kubernetes Service versions, with the ability to filter the results. +Provides access to the available Civo Kubernetes versions, with the ability to filter the results. ## Example Usage -```hcl +```terraform data "civo_kubernetes_version" "stable" { filter { key = "type" @@ -21,61 +21,53 @@ data "civo_kubernetes_version" "stable" { } ``` -### Create a Kubernetes cluster using the most recent version available + +## Schema -```hcl -data "civo_kubernetes_version" "stable" { - filter { - key = "type" - values = ["stable"] - } -} +### Optional -resource "civo_kubernetes_cluster" "my-cluster" { - name = "my-cluster" - applications = "Traefik" - num_target_nodes = 4 - kubernetes_version = element(data.civo_kubernetes_version.stable.versions, 0).version - target_nodes_size = element(data.civo_instances_size.small.sizes, 0).name -} -``` +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) -### Pin a Kubernetes cluster to a specific minor version +### Read-Only -```hcl -data "civo_kubernetes_version" "minor_version" { - filter { - key = "version" - values = ["0.9.1"] - } -} -``` +- **versions** (List of Object) (see [below for nested schema](#nestedatt--versions)) + + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter versions by this key. This may be one of `default`, `label`, `type`, `version`. +- **values** (List of String) Only retrieves `versions` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. + + + +### Nested Schema for `sort` -## Argument Reference +Required: -* `filter` - (Optional) Filter the results. - The `filter` block is documented below. -* `sort` - (Optional) Sort the results. - The `sort` block is documented below. +- **key** (String) Sort versions by this key. This may be one of `default`, `label`, `type`, `version`. -`filter` supports the following arguments: +Optional: -* `key` - (Required) Filter the sizes by this key. This may be one of `version`, - `label`, `type`, `default`. -* `values` - (Required) Only retrieves the version which keys has value that matches - one of the values provided here. +- **direction** (String) The sort direction. This may be either `asc` or `desc`. -`sort` supports the following arguments: -* `key` - (Required) Sort the sizes by this key. This may be one of `version`. -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. + +### Nested Schema for `versions` -## Attributes Reference +Read-Only: -The following attributes are exported: +- **default** (Boolean) +- **label** (String) +- **type** (String) +- **version** (String) -* `version` - A version of the kubernetes. -* `label` - The label of this version. -* `type` - The type of the version can be `stable`, `legacy` etc... -* `default` - If is the default version used in all cluster. diff --git a/docs/data-sources/loadbalancer.md b/docs/data-sources/loadbalancer.md deleted file mode 100644 index 3e0118b2..00000000 --- a/docs/data-sources/loadbalancer.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: "civo" -page_title: "Civo: civo_loadbalancer" -sidebar_current: "docs-civo-datasource-loadbalancer" -description: |- - Get information on a loadbalancer. ---- - -# civo_loadbalancer - -Get information on a load balancer for use in other resources. This data source -provides all of the load balancers properties as configured on your Civo -account. This is useful if the load balancer in question is not managed by -Terraform or you need to utilize any of the load balancers data. - -An error is triggered if the provided load balancer name does not exist. - -## Example Usage - -Get the load balancer: - -```hcl -data "civo_loadbalancer" "example" { - hostname = "example.com" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `id` - (Optional) The ID of the Load Balancer. -* `hostname` - (Optional) The hostname of the Load Balancer. - -## Attributes Reference - -The following attributes are exported: - -* `id` - The ID of the Load Balancer -* `hostname` - The hostname of the Load Balancer -* `protocol` - The protocol used -* `tls_certificate` - If is set will be returned -* `tls_key` - If is set will be returned -* `port` - The port set in the configuration -* `max_request_size` - The max request size set in the configuration -* `policy` - The policy set in the Load Balancer -* `health_check_path` - The path to check the health of the backend -* `fail_timeout` - The wait time until the backend is marked as a failure -* `max_conns` - How many concurrent connections can each backend handle -* `ignore_invalid_backend_tls` - Should self-signed/invalid certificates be ignored from the backend servers -* `backend` - A list of backend instances - - `instance_id` - The instance id - - `protocol` - The protocol used in the configuration. - - `port` - The port set in the configuration. \ No newline at end of file diff --git a/docs/data-sources/network.md b/docs/data-sources/network.md index 06288bd7..ef119b1e 100644 --- a/docs/data-sources/network.md +++ b/docs/data-sources/network.md @@ -1,70 +1,42 @@ --- -layout: "civo" -page_title: "Civo: civo_network" -sidebar_current: "docs-civo-datasource-network" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_network Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information about a Network. + Retrieve information about a network for use in other resources. + This data source provides all of the network's properties as configured on your Civo account. + Networks may be looked up by id or label, and you can optionally pass region if you want to make a lookup for an expecific network inside that region. --- -# civo_network +# civo_network (Data Source) -Retrieve information about a Network for use in other resources. +Retrieve information about a network for use in other resources. -This data source provides all of the Network's properties as configured on your -Civo account. This is useful if the Network in question is not managed by -Terraform or you need to utilize any of the Network's data. +This data source provides all of the network's properties as configured on your Civo account. -Networks may be looked up by `id` or `label`, and optional you can pass `region` -if you wanna made a lookup for an expecific network inside that region. -## Example Usage +Networks may be looked up by id or label, and you can optionally pass region if you want to make a lookup for an expecific network inside that region. -### Network by name in a region +## Example Usage -```hcl +```terraform data "civo_network" "test" { label = "test-network" region = "NYC1" } ``` -### Network By Name - -```hcl -data "civo_network" "test" { - label = "test-network" -} -``` - -Reuse the data about a Network to assign a Instance to it: - -```hcl -data "civo_network" "test" { - label = "test-network" -} - -resource "civo_instance" "my-test-instance" { - hostname = "foo.com" - tags = ["python", "nginx"] - notes = "this is a note for the server" - size = data.civo_size.small.id - template = data.civo_template.debian.id - network_id = data.civo_network.test.id -} -``` + +## Schema -## Argument Reference +### Optional -The following arguments are supported and are mutually exclusive: +- **id** (String) The ID of this resource. +- **label** (String) The label of an existing network +- **region** (String) The region of an existing network -* `id` - (Optional) The unique identifier of an existing Network. -* `label` - (Optional) The label of an existing Network. -* `region` - (Optional) The region of an existing Network. +### Read-Only -## Attributes Reference +- **default** (Boolean) If is the default network +- **name** (String) The name of the network -The following attributes are exported: -* `id` - A unique ID that can be used to identify and reference a Network. -* `label` - The label used in the configuration. -* `name` - The name of the network. -* `default` - If is the default network. diff --git a/docs/data-sources/region.md b/docs/data-sources/region.md index af1cbea9..17cd20b0 100644 --- a/docs/data-sources/region.md +++ b/docs/data-sources/region.md @@ -1,21 +1,18 @@ --- -layout: "civo" -page_title: "Civo: civo_region" -sidebar_current: "docs-civo-datasource-region" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_region Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a Civo Region. + Retrieves information about the region that Civo supports, with the ability to filter the results. --- -# civo_region +# civo_region (Data Source) -Retrieves information about the Region that Civo supports, -with the ability to filter the results. +Retrieves information about the region that Civo supports, with the ability to filter the results. ## Example Usage -Most common usage will probably be to supply regions: - -```hcl +```terraform data "civo_region" "default" { filter { key = "default" @@ -29,51 +26,57 @@ resource "civo_instance" "my-test-instance" { tags = ["python", "nginx"] notes = "this is a note for the server" size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id } ``` -The data source also supports multiple filters and sorts. For example, to fetch all region for `us` and `uk`: + +## Schema -```hcl -data "civo_region" "NYC" { - filter { - key = "code" - values = ["NYC1"] - } +### Optional - sort { - key = "code" - direction = "desc" - } +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) -} -``` +### Read-Only + +- **regions** (List of Object) (see [below for nested schema](#nestedatt--regions)) + + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter regions by this key. This may be one of `code`, `country`, `default`, `name`. +- **values** (List of String) Only retrieves `regions` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. + + + +### Nested Schema for `sort` -## Argument Reference +Required: -The following arguments are supported: +- **key** (String) Sort regions by this key. This may be one of `code`, `country`, `default`, `name`. -* `filter` - (Optional) Filter the results. - The `filter` block is documented below. -* `sort` - (Optional) Sort the results. - The `sort` block is documented below. +Optional: -`filter` supports the following arguments: +- **direction** (String) The sort direction. This may be either `asc` or `desc`. -* `key` - (Required) Filter the sizes by this key. This may be one of `code`, `name`, `country`, `default`. -* `values` - (Required) Only retrieves region which keys has value that matches one of the values provided here. -`sort` supports the following arguments: + +### Nested Schema for `regions` -* `key` - (Required) Sort the sizes by this key. This may be one of `code`,`name`. -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. +Read-Only: -## Attributes Reference +- **code** (String) +- **country** (String) +- **default** (Boolean) +- **name** (String) -The following attributes are exported: -* `code`: The code of the region. -* `name`: A human name of the region. -* `country` The country of the region. -* `default`: If the region is the default region. diff --git a/docs/data-sources/snapshot.md b/docs/data-sources/snapshot.md deleted file mode 100644 index 1cf47d50..00000000 --- a/docs/data-sources/snapshot.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: "civo" -page_title: "Civo: civo_snapshot" -sidebar_current: "docs-civo-datasource-snapshot" -description: |- - Get information about a Civo snapshot. ---- - -# civo_snapshot - -Snapshots are saved instances of a block storage volume. Use this data -source to retrieve the ID of a Civo snapshot for use in other -resources. - -## Example Usage - -Get the snapshot: - -```hcl -data "civo_snapshot" "mysql-vm" { - name = "mysql-vm" -} -``` - -## Argument Reference - -* `id` - (Optional) The ID of the snapshot. -* `name` - (Optional) The name of the snapshot. - -## Attributes Reference - -The following attributes are exported: - -* `id` The ID of the Instance snapshot. -* `name` - The name of the snapshot. -* `instance_id` - The ID of the Instance from which the snapshot was be taken. -* `safe` - If is `true` the instance will be shut down during the snapshot if id `false` them not. -* `cron_timing` - A string with the cron format. -* `hostname` - The hostname of the instance. -* `template_id` - The template id. -* `region` - The region where the snapshot was take. -* `size_gb` - The size of the snapshot in GB. -* `state` - The status of the snapshot. -* `next_execution` - if cron was define this date will be the next execution date. -* `requested_at` - The date where the snapshot was requested. -* `completed_at` - The date where the snapshot was completed. \ No newline at end of file diff --git a/docs/data-sources/ssh_key.md b/docs/data-sources/ssh_key.md index afa1feed..a83102d5 100644 --- a/docs/data-sources/ssh_key.md +++ b/docs/data-sources/ssh_key.md @@ -1,25 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_ssh_key" -sidebar_current: "docs-civo-datasource-ssh-key" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_ssh_key Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a ssh key. + Get information on a SSH key. This data source provides the name, and fingerprint as configured on your Civo account. + An error will be raised if the provided SSH key name does not exist in your Civo account. --- -# civo_ssh_key +# civo_ssh_key (Data Source) -Get information on a ssh key. This data source provides the name, -and fingerprint as configured on your Civo account. This is useful if -the ssh key in question is not managed by Terraform or you need to utilize any -of the keys data. +Get information on a SSH key. This data source provides the name, and fingerprint as configured on your Civo account. -An error is triggered if the provided ssh key name does not exist. +An error will be raised if the provided SSH key name does not exist in your Civo account. ## Example Usage -Get the ssh key: - -```hcl +```terraform data "civo_ssh_key" "example" { name = "example" } @@ -29,22 +25,21 @@ resource "civo_instance" "my-test-instance" { tags = ["python", "nginx"] notes = "this is a note for the server" size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id sshkey_id = data.civo_ssh_key.example.id } ``` -## Argument Reference + +## Schema + +### Optional -The following arguments are supported: +- **id** (String) The ID of this resource. +- **name** (String) The name of the SSH key -* `id` - (Optional) The ID of the ssh key. -* `name` - (Optional) The name of the ssh key. +### Read-Only -## Attributes Reference +- **fingerprint** (String) The fingerprint of the public key of the SSH key -The following attributes are exported: -* `id`: The ID of the ssh key. -* `name`: The name of the ssh key. -* `fingerprint`: The fingerprint of the public key of the ssh key. diff --git a/docs/data-sources/template.md b/docs/data-sources/template.md index 256f79ce..00378b30 100644 --- a/docs/data-sources/template.md +++ b/docs/data-sources/template.md @@ -1,22 +1,21 @@ --- -layout: "civo" -page_title: "Civo: civo_template" -sidebar_current: "docs-civo-datasource-template" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_template Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a Civo template. + civo_template data source is deprecated. Moving forward, please use civo_disk_image data source. + Get information on an template for use in other resources (e.g. creating a instance) with the ability to filter the results. --- -# civo\_template (DEPRECATED) +# civo_template (Data Source) `civo_template` data source is deprecated. Moving forward, please use `civo_disk_image` data source. -Get information on an template for use in other resources (e.g. creating a Instance). -This is useful if the template in question is not managed by Terraform or -you need to utilize any of the image's data, with the ability to filter the results. +Get information on an template for use in other resources (e.g. creating a instance) with the ability to filter the results. ## Example Usage -```hcl +```terraform data "civo_template" "debian" { filter { key = "name" @@ -33,79 +32,54 @@ resource "civo_instance" "my-test-instance" { } ``` -This filter will garatice to install the latest version of debian always + +## Schema -```hcl -data "civo_template" "debian" { - filter { - key = "name" - values = ["debian"] - match_by = "re" - } - sort { - key = "version" - direction = "asc" - } -} +### Optional -resource "civo_instance" "foo-host" { - hostname = "foo.com" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id -} -``` +- **filter** (Block Set) One or more key/value pairs on which to filter results (see [below for nested schema](#nestedblock--filter)) +- **id** (String) The ID of this resource. +- **region** (String) +- **sort** (Block List) One or more key/direction pairs on which to sort results (see [below for nested schema](#nestedblock--sort)) -It is similar to the previous one with the difference that in this one we use region to only look for the templates of that region. -The Instance/Kubernetes cluster where you use this data source must be in the same region. +### Read-Only -```hcl -data "civo_template" "debian" { - region = "LON1" - filter { - key = "name" - values = ["debian"] - match_by = "re" - } - sort { - key = "version" - direction = "asc" - } -} +- **templates** (List of Object) (see [below for nested schema](#nestedatt--templates)) -resource "civo_instance" "foo-host" { - region = "LON1" - hostname = "foo.com" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id -} -``` + +### Nested Schema for `filter` + +Required: + +- **key** (String) Filter templates by this key. This may be one of `id`, `label`, `name`, `version`. +- **values** (List of String) Only retrieves `templates` which keys has value that matches one of the values provided here + +Optional: + +- **all** (Boolean) Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set. +- **match_by** (String) One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field. -## Argument Reference -The following arguments are supported: + +### Nested Schema for `sort` -* `region` - (Optional) If is used, them all template will be from that region, has to be declared here if is not declared in the provider -* `filter` - (Optional) Filter the results. The `filter` block is documented below. -* `sort` - (Optional) Sort the results. The `sort` block is documented below. +Required: -`filter` supports the following arguments: +- **key** (String) Sort templates by this key. This may be one of `id`, `label`, `name`, `version`. -* `key` - (Required) Filter the sizes by this key. This may be one of `id`,`name`,`version`,`label`. -* `values` - (Required) Only retrieves the template which keys has value that matches - one of the values provided here. +Optional: -`sort` supports the following arguments: +- **direction** (String) The sort direction. This may be either `asc` or `desc`. -* `key` - (Required) Sort the sizes by this key. This may be one of `id`,`name`,`version`,`label`. -* `direction` - (Required) The sort direction. This may be either `asc` or `desc`. + +### Nested Schema for `templates` -## Attributes Reference +Read-Only: -The following attributes are exported: +- **id** (String) +- **label** (String) +- **name** (String) +- **version** (String) -* `id` - The id of the template -* `name` - A short human readable name for the template -* `version` - The version of the template. -* `label` - The label of the template. diff --git a/docs/data-sources/volume.md b/docs/data-sources/volume.md index a78fe259..f410d71a 100644 --- a/docs/data-sources/volume.md +++ b/docs/data-sources/volume.md @@ -1,65 +1,39 @@ --- -layout: "civo" -page_title: "Civo: civo_volume" -sidebar_current: "docs-civo-datasource-volume" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_volume Data Source - terraform-provider-civo" +subcategory: "" description: |- - Get information on a volume. + Get information on a volume for use in other resources. This data source provides all of the volumes properties as configured on your Civo account. + An error will be raised if the provided volume name does not exist in your Civo account. --- -# civo_volume +# civo_volume (Data Source) -Get information on a volume for use in other resources. This data source provides -all of the volumes properties as configured on your Civo account. This is -useful if the volume in question is not managed by Terraform or you need to utilize -any of the volumes data. +Get information on a volume for use in other resources. This data source provides all of the volumes properties as configured on your Civo account. -An error is triggered if the provided volume name does not exist. +An error will be raised if the provided volume name does not exist in your Civo account. ## Example Usage -Get the volume: - -```hcl +```terraform data "civo_volume" "mysql" { name = "database-mysql" } ``` -Reuse the data about a volume to attach it to a Instance: - -```hcl -data "civo_volume" "mysql" { - name = "database-mysql" -} - -resource "civo_instance" "mysql-server" { - hostname = "mysql.domain.com" - tags = ["mysql", "db"] - notes = "this is a note for the server" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id -} - -resource "civo_volume_attachment" "foobar" { - instance_id = civo_instance.mysql-server.id - volume_id = data.civo_volume.mysql.id -} -``` + +## Schema -## Argument Reference +### Optional -The following arguments are supported: +- **id** (String) The ID of this resource. +- **name** (String) The name of the volume +- **region** (String) The region where volume is running -* `id` - (Optional) The unique identifier for the volume. -* `name` - (Optional) The name of the volume. +### Read-Only -## Attributes Reference +- **created_at** (String) The date of the creation of the volume +- **mount_point** (String) The mount point of the volume +- **size_gb** (Number) The size of the volume (in GB) -The following attributes are exported: -* `id` - The unique identifier for the volume. -* `name` - Name of the volume. -* `size_gb` - The size of the volume. -* `bootable` - if is bootable or not. -* `mount_point` - The mount point of the volume. -* `created_at` - The date of the creation of the volume. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 815a995d..e6004a55 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,39 +1,23 @@ --- -layout: "civo" +layout: "" page_title: "Provider: Civo" -sidebar_current: "docs-civo-index" description: |- 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. --- # 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. The provider needs to be configured with the proper credentials before it can be used. Use the navigation to the left to read about the available resources. ## Example Usage -```hcl -# Set the variable value in *.tfvars file -# or using -var="civo_token=..." CLI option +```terraform +# Set the variable value in *.tfvars file or using -var="civo_token=..." CLI flag variable "civo_token" {} # Configure the Civo Provider -provider "civo" { - token = var.civo_token -} - -# Create a web server -resource "civo_instance" "web" { - # ... -} -``` - -```hcl -# Configure the Civo Provider using region provider "civo" { token = var.civo_token region = "LON1" @@ -45,11 +29,10 @@ resource "civo_instance" "web" { } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Optional -* `token` - (Optional) This is the Civo API token. Alternatively, this can also be specified - using environment variables ordered by precedence: - * `CIVO_TOKEN` -* `region` - (Optional) 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. \ No newline at end of file +- **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. diff --git a/docs/resources/dns_domain_name.md b/docs/resources/dns_domain_name.md index 103a05e1..8f312ac4 100644 --- a/docs/resources/dns_domain_name.md +++ b/docs/resources/dns_domain_name.md @@ -1,42 +1,41 @@ --- -layout: "civo" -page_title: "Civo: civo_dns_domain_name" -sidebar_current: "docs-civo-resource-dns-domain-name" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_dns_domain_name Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo dns domain name resource. + Provides a Civo DNS domain name resource. --- -# civo\_dns_domain_name +# civo_dns_domain_name (Resource) -Provides a Civo dns domain name resource. +Provides a Civo DNS domain name resource. ## Example Usage -```hcl +```terraform # Create a new domain name resource "civo_dns_domain_name" "main" { name = "mydomain.com" } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `name` - (Required) The name of the domain +- **name** (String) The name of the domain -## Attributes Reference +### Read-Only -The following attributes are exported: - -* `id` - A unique ID that can be used to identify and reference a domain. -* `name` - The name of the domain. -* `account_id` - The id account of the domain +- **account_id** (String) The account ID of the domain +- **id** (String) The ID of this resource. ## Import -Domains can be imported using the `domain name`, e.g. +Import is supported using the following syntax: -``` +```shell +# using domain name terraform import civo_dns_domain_name.main mydomain.com ``` diff --git a/docs/resources/dns_domain_record.md b/docs/resources/dns_domain_record.md index 9c6cbe4d..16532dac 100644 --- a/docs/resources/dns_domain_record.md +++ b/docs/resources/dns_domain_record.md @@ -1,53 +1,91 @@ --- -layout: "civo" -page_title: "Civo: civo_dns_domain_record" -sidebar_current: "docs-civo-resource-dns-domain-record" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_dns_domain_record Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo dns domain record resource. + Provides a Civo DNS domain record resource. --- -# civo\_dns_domain_record +# civo_dns_domain_record (Resource) -Provides a Civo dns domain record resource. +Provides a Civo DNS domain record resource. ## Example Usage -```hcl +```terraform +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# Create a new instance +resource "civo_instance" "foo" { + hostname = "foo.com" + size = element(data.civo_instances_size.small.sizes, 0).name + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id +} + +# Create a new domain name +resource "civo_dns_domain_name" "mydomain" { + name = "mydomain.com" +} + # Create a new domain record resource "civo_dns_domain_record" "www" { - domain_id = civo_dns_domain_name.main.id + domain_id = civo_dns_domain_name.mydomain.id type = "A" name = "www" value = civo_instance.foo.public_ip ttl = 600 - depends_on = [civo_dns_domain_name.main, civo_instance.foo] + depends_on = [civo_dns_domain_name.mydomain, civo_instance.foo] } ``` -## Argument Reference + +## Schema + +### Required -The following arguments are supported: +- **domain_id** (String) ID from domain name +- **name** (String) The portion before the domain name (e.g. www) or an @ for the apex/root domain (you cannot use an A record with an amex/root domain) +- **ttl** (Number) How long caching DNS servers should cache this record for, in seconds (the minimum is 600 and the default if unspecified is 600) +- **type** (String) The choice of RR type from a, cname, mx or txt +- **value** (String) The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record -* `domain_id` - (Required) The id of the domain -* `type` - (Required) The choice of record type from A, CNAME, MX, SRV or TXT -* `name` - (Required) The portion before the domain name (e.g. www) or an @ for the apex/root domain (you cannot use an A record with an amex/root domain) -* `value` - (Required) The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record -* `priority` - (Optional) Useful for MX records only, the priority mail should be attempted it (defaults to 10) -* `ttl` - (Required) How long caching DNS servers should cache this record for, in seconds (the minimum is 600 and the default if unspecified is 600) +### Optional -## Attributes Reference +- **priority** (Number) Useful for MX records only, the priority mail should be attempted it (defaults to 10) -The following attributes are exported including the arguments: +### Read-Only -* `id` - A unique ID that can be used to identify and reference a Record. -* `account_id` - The id account of the domain -* `created_at` - The date when it was created in UTC format -* `updated_at` - The date when it was updated in UTC format +- **account_id** (String) The account ID of this resource +- **created_at** (String) Timestamp when this resource was created +- **id** (String) The ID of this resource. +- **updated_at** (String) Timestamp when this resource was updated ## Import -Domains can be imported using the `id_domain:id_domain_record`, e.g. +Import is supported using the following syntax: -``` +```shell +# using domain_id:domain_record_id terraform import civo_dns_domain_record.www a3cd6832-9577-4017-afd7-17d239fc0bf0:c9a39d14-ee1b-4870-8fb0-a2d4f465e822 ``` diff --git a/docs/resources/firewall.md b/docs/resources/firewall.md index f3beb658..474ba1b8 100644 --- a/docs/resources/firewall.md +++ b/docs/resources/firewall.md @@ -1,52 +1,51 @@ --- -layout: "civo" -page_title: "Civo: civo_firewall" -sidebar_current: "docs-civo-resource-firewall" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_firewall Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Cloud Firewall resource. This can be used to create, modify, and delete Firewalls. + Provides a Civo firewall resource. This can be used to create, modify, and delete firewalls. --- -# civo\_firewall +# civo_firewall (Resource) -Provides a Civo Cloud Firewall resource. This can be used to create, -modify, and delete Firewalls. +Provides a Civo firewall resource. This can be used to create, modify, and delete firewalls. ## Example Usage -```hcl -resource "civo_firewall" "www" { - name = "www" +```terraform +# Create a network +resource "civo_network" "custom_net" { + label = "my-custom-network" } -``` -### Example with region -```hcl + +# Create a firewall resource "civo_firewall" "www" { name = "www" - region = "NYC1" + network_id = civo_network.custom_net.id } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `name` - (Required) The Firewall name -* `region` - (Optional) The Firewall region, if is not defined we use the global defined in the provider -* `nertwork_id` - (Optional) The Firewall network, if is not defined we use the default network +- **name** (String) The firewall name +### Optional -## Attributes Reference +- **network_id** (String) The firewall network, if is not defined we use the default network +- **region** (String) The firewall region, if is not defined we use the global defined in the provider -The following attributes are exported: +### Read-Only -* `id` - A unique ID that can be used to identify and reference a Firewall. -* `name` - The name of the Firewall. -* `network_id` - The ID of the network of the firewall +- **id** (String) The ID of this resource. ## Import -Firewalls can be imported using the firewall `id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_firewall.www b8ecd2ab-2267-4a5e-8692-cbf1d32583e3 ``` diff --git a/docs/resources/firewall_rule.md b/docs/resources/firewall_rule.md index 520346f2..c6af0ddf 100644 --- a/docs/resources/firewall_rule.md +++ b/docs/resources/firewall_rule.md @@ -1,66 +1,99 @@ --- -layout: "civo" -page_title: "Civo: civo_firewall_rule" -sidebar_current: "docs-civo-resource-firewall_rule" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_firewall_rule Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Cloud Firewall Rule resource. This can be used to create, modify, and delete Firewalls Rules. + Provides a Civo firewall rule resource. This can be used to create, modify, and delete firewalls rules. This resource don't have an update option because Civo backend doesn't support it at this moment. In that case, we use ForceNew for all object in the resource. --- -# civo\_firewall_rule +# civo_firewall_rule (Resource) -Provides a Civo Cloud Firewall Rule resource. -This can be used to create, modify, and delete Firewalls Rules. -This resource don't have an update option because the backend don't have the -support for that, so in this case we use ForceNew for all object in the resource. +Provides a Civo firewall rule resource. This can be used to create, modify, and delete firewalls rules. This resource don't have an update option because Civo backend doesn't support it at this moment. In that case, we use `ForceNew` for all object in the resource. ## Example Usage -```hcl -resource "civo_firewall" "www" { - name = "www" +```terraform +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# Create a new instance +resource "civo_instance" "foo" { + hostname = "foo.com" + size = element(data.civo_instances_size.small.sizes, 0).name + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id } -resource "civo_firewall_rule" "http" { - firewall_id = civo_firewall.www.id - protocol = "tcp" - start_port = "80" - end_port = "80" - cidr = ["192.168.1.2/32", "10.10.10.1/32", format("%s/%s",civo_instance.foo.public_ip,"32")] - direction = "ingress" - label = "server web" - depends_on = [civo_firewall.www] +# Create a network +resource "civo_network" "custom_net" { + label = "my-custom-network" +} + +# Create a firewall +resource "civo_firewall" "custom_firewall" { + name = "my-custom-firewall" + network_id = civo_network.custom_net.id +} + +# Create a firewall rule and only allow +# connections from instance we created above +resource "civo_firewall_rule" "custom_port" { + firewall_id = civo_firewall.custom_firewall.id + protocol = "tcp" + start_port = "3000" + end_port = "3000" + cidr = [format("%s/%s",civo_instance.foo.public_ip,"32")] + direction = "ingress" + label = "custom-application" + depends_on = [civo_firewall.custom_firewall] } ``` -## Argument Reference + +## Schema + +### Required -The following arguments are supported: +- **cidr** (Set of String) The CIDR notation of the other end to affect, or a valid network CIDR (e.g. 0.0.0.0/0 to open for everyone or 1.2.3.4/32 to open just for a specific IP address) +- **firewall_id** (String) The Firewall ID -* `firewall_id` - (Required) The Firewall id -* `protocol` (Required) This may be one of "tcp", "udp", or "icmp". -* `start_port` (Required) The start port where traffic to be allowed. -* `end_port` (Required) The end port where traffic to be allowed. -* `cidr` (Required) The CIDR notation of the other end to affect, or a valid network CIDR (e.g. 0.0.0.0/0 to open for everyone or 1.2.3.4/32 to open just for a specific IP address. -* `direction` (Required) will this rule affect ingress traffic -* `label` (Optional) a string that will be the displayed name/reference for this rule (optional) +### Optional -## Attributes Reference +- **direction** (String) Will this rule affect ingress traffic (only `ingress` is supported now) +- **end_port** (String) The end of the port range (this is optional, by default it will only apply to the single port listed in start_port) +- **label** (String) A string that will be the displayed name/reference for this rule +- **protocol** (String) The protocol choice from `tcp`, `udp` or `icmp` (the default if unspecified is `tcp`) +- **region** (String) The region for this rule +- **start_port** (String) The start of the port range to configure for this rule (or the single port if required) -The following attributes are exported: +### Read-Only -* `id` - A unique ID that can be used to identify and reference a Firewall Rule. -* `firewall_id` - The Firewall id -* `protocol` This may be one of "tcp", "udp", or "icmp". -* `start_port` The start port where traffic to be allowed. -* `end_port` The end port where traffic to be allowed. -* `cidr` A list of CIDR notations of the other end to affect. -* `direction` Will this rule affect ingress traffic -* `label` A string that will be the displayed name/reference for this rule (optional) +- **id** (String) The ID of this resource. ## Import -Firewalls can be imported using the firewall `firewall_id:firewall_rule_id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using firewall_id:firewall_rule_id terraform import civo_firewall_rule.http b8ecd2ab-2267-4a5e-8692-cbf1d32583e3:4b0022ee-00b2-4f81-a40d-b4f8728923a7 ``` diff --git a/docs/resources/instance.md b/docs/resources/instance.md index 542de715..f6523f6d 100644 --- a/docs/resources/instance.md +++ b/docs/resources/instance.md @@ -1,90 +1,90 @@ --- -layout: "civo" -page_title: "Civo: civo_instance" -sidebar_current: "docs-civo-resource-instance" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_instance Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Instance resource. This can be used to create, modify, and delete Instances. + Provides a Civo instance resource. This can be used to create, modify, and delete instances. --- -# civo\_instance +# civo_instance (Resource) -Provides a Civo Instance resource. This can be used to create, -modify, and delete Instances. +Provides a Civo instance resource. This can be used to create, modify, and delete instances. ## Example Usage -```hcl -# Create a new Web instances -resource "civo_instance" "my-test-instance" { - hostname = "foo.com" - tags = ["python", "nginx"] - notes = "this is a note for the server" - size = element(data.civo_instances_size.small.sizes, 0).name - template = element(data.civo_template.debian.templates, 0).id +```terraform +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + } -``` -```hcl -# Create a new Web instances in a expecific region -resource "civo_instance" "my-test-instance" { - region = "LON1" +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# 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 - template = element(data.civo_template.debian.templates, 0).id + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id } ``` -## Argument Reference - -The following arguments are supported: - -* `region` - (Optional) The region for the instance, if not declare we use the region in declared in the provider. -* `hostname` - (Required) The Instance hostname, if is not declare the provider will generate one for you -* `reverse_dns` - (Optional) A fully qualified domain name that should be used as the instance's IP's reverse DNS (optional, uses the hostname if unspecified). -* `size` - (Optional) The name of the size, from the current list, e.g. g3.k3s.small (required). -* `public_ip_required` - (Optional) This should be either `create` or `none` (default: `create`). -* `network_id` - (Optional) This must be the ID of the network from the network listing (optional; default network used when not specified). -* `template` - (Deprecated, Optional) The ID for the template to use to build the instance. -* `disk_image` - (Optional) The ID for the disk image to use to build the instance. -* `initial_user` - (Optional) The name of the initial user created on the server (optional; this will default to the template's default_username and fallback to civo). -* `notes` - (Optional) Add some notes to the instance. -* `sshkey_id` - (Optional) 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). -* `firewall_id` - (Optional) 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). -* `script` - (Optional) 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 -* `tags` - (Optional) An optional list of tags, represented as a key, value pair. - -## Attributes Reference - -The following attributes are exported: - -* `hostname` - The Instance hostname. -* `reverse_dns` - A fully qualified domain name. -* `size` - The name of the size. -* `cpu_cores` - Total cpu of the inatance. -* `ram_mb` - Total ram of the instance. -* `disk_gb` - The size of the disk. -* `public_ip_requiered` - This should be either `create` or `none`. -* `network_id` - This will be the ID of the network. -* `template` - The ID for the template to used to build the instance. -* `disk_image` - The ID for the disk image to use to build the instance. -* `initial_user` - The name of the initial user created on the server. -* `notes` - The notes of the instance. -* `sshkey_id` - The ID SSH. -* `firewall_id` - The ID of the firewall used. -* `tags` - An optional list of tags -* `initial_password` - Instance initial password -* `private_ip` - The private ip. -* `public_ip` - The public ip. -* `pseudo_ip` - Is the ip that is used to route the public ip from the internet to the instance using NAT -* `status` - The status of the instance -* `script` - the contents of a script uploaded -* `created_at` - The date of creation of the instance + + +## Schema + +### Optional + +- **disk_image** (String) The ID for the disk image to use to build the instance +- **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) +- **hostname** (String) A fully qualified domain name that should be set as the instance's hostname +- **initial_user** (String) The name of the initial user created on the server (optional; this will default to the template's default_username and fallback to civo) +- **network_id** (String) This must be the ID of the network from the network listing (optional; default network used when not specified) +- **notes** (String) Add some notes to the instance +- **public_ip_required** (String) This should be either 'none' or 'create' (default: 'create') +- **region** (String) The region for the instance, if not declare we use the region in declared in the provider +- **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 +- **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 + +### Read-Only + +- **cpu_cores** (Number) Instance's CPU cores +- **created_at** (String) Timestamp when the instance was created +- **disk_gb** (Number) Instance's disk (GB) +- **id** (String) The ID of this resource. +- **initial_password** (String, Sensitive) Initial password for login +- **private_ip** (String) Instance's private IP address +- **public_ip** (String) Instance's public IP address +- **ram_mb** (Number) Instance's RAM (MB) +- **source_id** (String) Instance's source ID +- **source_type** (String) Instance's source type +- **status** (String) Instance's status ## Import -Instances can be imported using the instance `id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_instance.myintance 18bd98ad-1b6e-4f87-b48f-e690b4fd7413 ``` diff --git a/docs/resources/kubernetes_cluster.md b/docs/resources/kubernetes_cluster.md index befcb612..c7babbb7 100644 --- a/docs/resources/kubernetes_cluster.md +++ b/docs/resources/kubernetes_cluster.md @@ -1,19 +1,20 @@ --- -layout: "civo" -page_title: "Civo: civo_kubernetes_cluster" -sidebar_current: "docs-civo-resource-kubernetes-cluster" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_kubernetes_cluster Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Kubernetes cluster resource. + Provides a Civo Kubernetes cluster resource. This can be used to create, delete, and modify clusters. --- -# civo\_kubernetes\_cluster +# civo_kubernetes_cluster (Resource) Provides a Civo Kubernetes cluster resource. This can be used to create, delete, and modify clusters. ## Example Usage -```hcl -data "civo_instances_size" "small" { +```terraform +# Query xsmall instance size +data "civo_instances_size" "xsmall" { filter { key = "type" values = ["kubernetes"] @@ -25,116 +26,98 @@ data "civo_instances_size" "small" { } } +# Create a cluster resource "civo_kubernetes_cluster" "my-cluster" { name = "my-cluster" - applications = "Portainer,Traefik" - num_target_nodes = 4 - target_nodes_size = element(data.civo_instances_size.small.sizes, 0).name + applications = "Portainer,Linkerd:Linkerd & Jaeger" + num_target_nodes = 2 + target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name } ``` -## Node Sizes + +## Schema -Apart from using Data Source to find `target_nodes_size`, you can also use [Civo CLI](https://github.com/civo/cli) to list all Kubernetes node sizes. +### Optional -``` -$ civo kubernetes sizes - -+----------------+-------------+------------+-----+-------+-----+------------+ -| Name | Description | Type | CPU | RAM | SSD | Selectable | -+----------------+-------------+------------+-----+-------+-----+------------+ -| g3.k3s.xsmall | Extra Small | Kubernetes | 1 | 1024 | 15 | Yes | -| g3.k3s.small | Small | Kubernetes | 1 | 2048 | 15 | Yes | -| g3.k3s.medium | Medium | Kubernetes | 2 | 4096 | 15 | Yes | -| g3.k3s.large | Large | Kubernetes | 4 | 8192 | 15 | Yes | -| g3.k3s.xlarge | Extra Large | Kubernetes | 6 | 16384 | 15 | Yes | -| g3.k3s.2xlarge | 2X Large | Kubernetes | 8 | 32768 | 15 | Yes | -+----------------+-------------+------------+-----+-------+-----+------------+ -``` +- **applications** (String) Comma separated list of applications to install. Spaces within application names are fine, but shouldn't be either side of the comma. Application names are case-sensitive; the available applications can be listed with the Civo CLI: 'civo kubernetes applications ls'. If you want to remove a default installed application, prefix it with a '-', e.g. -Traefik. For application that supports plans, you can use 'app_name:app_plan' format e.g. 'Linkerd:Linkerd & Jaeger' or 'MariaDB:5GB'. +- **firewall_id** (String) The existing firewall ID to use for this cluster +- **kubernetes_version** (String) The version of k3s to install (optional, the default is currently the latest available) +- **name** (String) Name for your cluster, must be unique within your account +- **network_id** (String) The network for the cluster, if not declare we use the default one +- **num_target_nodes** (Number) The number of instances to create (optional, the default at the time of writing is 3) +- **region** (String) The region for the cluster, if not declare we use the region in declared in the provider +- **tags** (String) Space separated list of tags, to be used freely as required +- **target_nodes_size** (String) The size of each node (optional, the default is currently g3.k3s.medium) -### Kubernetes Terraform Provider Example +### Read-Only -The cluster's kubeconfig is exported as an attribute allowing you to use it with the [Kubernetes Terraform provider](https://www.terraform.io/docs/providers/kubernetes/index.html). For example: +- **api_endpoint** (String) The API server endpoint of the cluster +- **created_at** (String) The timestamp when the cluster was created +- **dns_entry** (String) The DNS name of the cluster +- **id** (String) The ID of this resource. +- **installed_applications** (List of Object) (see [below for nested schema](#nestedatt--installed_applications)) +- **instances** (List of Object) (see [below for nested schema](#nestedatt--instances)) +- **kubeconfig** (String, Sensitive) The kubeconfig of the cluster +- **master_ip** (String) The IP address of the master node +- **pools** (List of Object) (see [below for nested schema](#nestedatt--pools)) +- **ready** (Boolean) When cluster is ready, this will return `true` +- **status** (String) Status of the cluster -```hcl + +### Nested Schema for `installed_applications` -resource "civo_kubernetes_cluster" "my-cluster" { - name = "my-cluster" - region = "NYC1" - applications = "Portainer,Traefik" - num_target_nodes = 4 - target_nodes_size = element(data.civo_instances_size.small.sizes, 0).name -} +Read-Only: -provider "kubernetes" { - host = civo_kubernetes_cluster.my-cluster.api_endpoint - client_certificate = base64decode(yamldecode(civo_kubernetes_cluster.my-cluster.kubeconfig).users[0].user.client-certificate-data) - client_key = base64decode(yamldecode(civo_kubernetes_cluster.my-cluster.kubeconfig).users[0].user.client-key-data) - cluster_ca_certificate = base64decode(yamldecode(civo_kubernetes_cluster.my-cluster.kubeconfig).clusters[0].cluster.certificate-authority-data) -} -``` +- **application** (String) +- **category** (String) +- **installed** (Boolean) +- **version** (String) + + + +### Nested Schema for `instances` -## Argument Reference - -The following arguments are supported: - -* `name` - (Optional) A name for the Kubernetes cluster, if is not declare the provider will generate one for you. -* `region` - (Optional) The region for the cluster. -* `num_target_nodes` - (Optional) The number of instances to create (The default at the time of writing is 3). -* `target_nodes_size` - (Optional) The size of each node (The default is currently g3.k3s.small) -* `kubernetes_version` - (Optional) The version of k3s to install (The default is currently the latest available). -* `tags` - (Optional) A space separated list of tags, to be used freely as required. -* `applications` - (Optional) This field is a case-sensitive, a comma separated list of applications to install. Spaces within application names are fine, but shouldn't be either side of the comma. Application names are case-sensitive; the available applications can be listed with the civo CLI: 'civo kubernetes applications ls'. If you want to remove a default installed application, prefix it with a '-', e.g. -Traefik - -## Attributes Reference - -In addition to the arguments listed above, the following additional attributes are exported: - -* `id` - A unique ID that can be used to identify and reference a Kubernetes cluster. -* `name` - The name of your cluster. -* `num_target_nodes` - The size of the Kubernetes cluster. -* `target_nodes_size` - The size of each node. -* `kubernetes_version` - The version of Kubernetes. -* `tags` - A list of tags. -* `applications` - A list of application installed. -* `instances` - In addition to the arguments provided, these additional attributes about the cluster's default node instance are exported: - - `hostname` - The hostname of the instance. - - `cpu_cores` - Total cpu of the inatance. - - `ram_mb` - Total ram of the instance - - `disk_gb` - The size of the disk. - - `status` - The status of the instance. - - `tags` - The tag of the instances -* `pools` - A list of node pools associated with the cluster. Each node pool exports the following attributes: - - `id` - The ID of the pool - - `count` - The size of the pool - - `size` - The size of each node inside the pool - - `instance_names` - A list of the instance in the pool - * `instances` - A list of instance inside the pool - - `hostname` - The hostname of the instance. - - `size` - The size of the instance. - - `cpu_cores` - Total cpu of the inatance. - - `ram_mb` - Total ram of the instance - - `disk_gb` - The size of the disk. - - `status` - The status of the instance. - - `tags` - The tag of the instances -* `installed_applications` - A unique ID that can be used to identify and reference a Kubernetes cluster. - - `application` - The name of the application - - `version` - The version of the application - - `installed` - if installed or not - - `category` - The category of the application -* `status` - The status of Kubernetes cluster. -* `ready` -If the Kubernetes cluster is ready. -* `kubeconfig` - A representation of the Kubernetes cluster's kubeconfig in yaml format. -* `api_endpoint` - The base URL of the API server on the Kubernetes master node. -* `master_ip` - The Ip of the Kubernetes master node. -* `dns_entry` - The unique dns entry for the cluster in this case point to the master. -* `created_at` - The date where the Kubernetes cluster was create. +Read-Only: +- **cpu_cores** (Number) +- **disk_gb** (Number) +- **hostname** (String) +- **ram_mb** (Number) +- **size** (String) +- **status** (String) +- **tags** (Set of String) + + + +### Nested Schema for `pools` + +Read-Only: + +- **count** (Number) +- **id** (String) +- **instance_names** (Set of String) +- **instances** (List of Object) (see [below for nested schema](#nestedobjatt--pools--instances)) +- **size** (String) + + +### Nested Schema for `pools.instances` + +Read-Only: + +- **cpu_cores** (Number) +- **disk_gb** (Number) +- **hostname** (String) +- **ram_mb** (Number) +- **size** (String) +- **status** (String) +- **tags** (Set of String) ## Import -Then the Kubernetes cluster can be imported using the cluster's `id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_kubernetes_cluster.my-cluster 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af ``` diff --git a/docs/resources/kubernetes_node_pool.md b/docs/resources/kubernetes_node_pool.md index 877c3fe4..d14ceb00 100644 --- a/docs/resources/kubernetes_node_pool.md +++ b/docs/resources/kubernetes_node_pool.md @@ -1,54 +1,68 @@ --- -layout: "civo" -page_title: "Civo: civo_kubernetes_node_pool" -sidebar_current: "docs-civo-resource-kubernetes-node-pool" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_kubernetes_node_pool Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Kubernetes cluster node pool resource. + Provides a Civo Kubernetes node pool resource. While the default node pool must be defined in the civo_kubernetes_cluster resource, this resource can be used to add additional ones to a cluster. --- -# civo\_kubernetes\_node_\pool +# civo_kubernetes_node_pool (Resource) -Provides a Civo Kubernetes node pool resource. While the default node pool must be defined in the civo_kubernetes_cluster resource, this resource can be used to add additional ones to a cluster. +Provides a Civo Kubernetes node pool resource. While the default node pool must be defined in the `civo_kubernetes_cluster` resource, this resource can be used to add additional ones to a cluster. ## Example Usage -```hcl +```terraform +# Query xsmall instance size +data "civo_instances_size" "xsmall" { + filter { + key = "type" + values = ["kubernetes"] + } + + sort { + key = "ram" + direction = "asc" + } +} +# Create a cluster resource "civo_kubernetes_cluster" "my-cluster" { name = "my-cluster" - num_target_nodes = 4 - target_nodes_size = element(data.civo_instances_size.small.sizes, 0).name + num_target_nodes = 1 + target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name } +# Add a node pool resource "civo_kubernetes_node_pool" "front-end" { cluster_id = civo_kubernetes_cluster.my-cluster.id - num_target_nodes = 4 + num_target_nodes = 1 + region = "LON1" } - ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `cluster_id` - (Required) The ID of the Kubernetes cluster to which the node pool is associated. -* `region` - (Required) The region of the node pool, has to match that of the cluster. -* `target_nodes_size` - (Optional) The size of each node. -* `num_target_nodes` - (Optional) The number of instances to create (The default at the time of writing is 3). +- **cluster_id** (String) The ID of your cluster +- **region** (String) The region of the node pool, has to match that of the cluster -## Attributes Reference +### Optional -In addition to the arguments listed above, the following additional attributes are exported: +- **num_target_nodes** (Number) the number of instances to create (optional, the default at the time of writing is 3) +- **target_nodes_size** (String) the size of each node (optional, the default is currently g3.k3s.medium) -* `cluster_id` - (Required) The ID of the Kubernetes cluster to which the node pool is associated. -* `region` - (Required) The region of the node pool, has to match that of the cluster. -* `target_nodes_size` - (Optional) The size of each node. -* `num_target_nodes` - (Optional) The number of instances to create. +### Read-Only + +- **id** (String) The ID of this resource. ## Import -Then the Kubernetes cluster node pool can be imported using the cluster's and pool id `cluster_id:node_pool_id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using cluster_id:node_pool_id terraform import civo_kubernetes_node_pool.my-pool 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af:502c1130-cb9b-4a88-b6d2-307bd96d946a ``` diff --git a/docs/resources/loadbalance.md b/docs/resources/loadbalance.md deleted file mode 100644 index 749c01c0..00000000 --- a/docs/resources/loadbalance.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -layout: "civo" -page_title: "Civo: civo_loadbalancer" -sidebar_current: "docs-civo-resource-loadbalancer" -description: |- - Provides a Civo Load Balancer resource. This can be used to create, modify, and delete Load Balancers. ---- - -# civo\_loadbalancer - -Provides a Civo Load Balancer resource. This can be used to create, -modify, and delete Load Balancers. - -## Example Usage - -```hcl -resource "civo_loadbalancer" "myloadbalancer" { - hostname = "www.foo.com" - protocol = "http" - port = 80 - max_request_size = 30 - policy = "round_robin" - max_conns = 10 - fail_timeout = 40 - - backend { - instance_id = civo_instance.my-test-instance.id - protocol = "http" - port = 80 - } - - backend { - instance_id = civo_instance.my-test-instance-1.id - protocol = "http" - port = "80" - } -} -``` - -## Argument Reference - -The following arguments are supported: - -* `hostname` - (Required) The hostname to receive traffic for, e.g. www.example.com (optional: sets hostname to loadbalancer-uuid.civo.com if blank) -* `protocol` - (Required) Either http or https. If you specify https then you must also provide the next two fields, the default is http", -* `tls_certificate` - (Optional) If your protocol is https then you should send the TLS certificate in Base64-encoded PEM format -* `tls_key` - (Optional) If your protocol is https then you should send the TLS private key in Base64-encoded PEM format -* `port` - (Required) You can listen on any port, the default is 80 to match the default protocol of http, if not you must specify it here (commonly 80 for HTTP or 443 for HTTPS) -* `max_request_size` - (Required) The size in megabytes of the maximum request content that will be accepted -* `policy` - (Required) One of: `least_conn` (sends new requests to the least busy server) -`random` (sends new requests to a random backend), `round_robin` (sends new requests to the next backend in order), -`ip_hash` (sends requests from a given IP address to the same backend), default is `random` -* `health_check_path` - (Optional) What URL should be used on the backends to determine if it's OK (2xx/3xx status), defaults to / -* `fail_timeout` - (Required) How long to wait in seconds before determining a backend has failed, defaults to 30. -* `max_conns` (Required) - how many concurrent connections can each backend handle, defaults to 10. -* `ignore_invalid_backend_tls` (Optional) - Should self-signed/invalid certificates be ignored from the backend servers, defaults to true. -* `backend` - (Required) A list of backend instances, each containing an `instance_id`, `protocol` (http or https) and `port`. - - `instance_id` - (Required) - The instance id - - `protocol` - (Required) - The protocol Either http or https. - - `port` - (Required) - You can listen on any port. - -## Attributes Reference - -The following attributes are exported: - -* `id` - The ID of the Load Balancer -* `hostname` - The hostname of the Load Balancer -* `protocol` - The protocol used -* `tls_certificate` - If is set will be returned -* `tls_key` - If is set will be returned -* `port` - The port set in the configuration -* `max_request_size` - The max request size set in the configuration -* `policy` - The policy set in the Load Balancer -* `health_check_path` - The path to check the health of the backend -* `fail_timeout` - The wait time until the backend is marked as a failure -* `max_conns` - How many concurrent connections can each backend handle -* `ignore_invalid_backend_tls` - Should self-signed/invalid certificates be ignored from the backend servers -* `backend` - A list of backend instances - - `instance_id` - The instance id - - `protocol` - The protocol used in the configuration. - - `port` - The port set in the configuration. - -## Import - -Load Balancers can be imported using the `id`, e.g. - -``` -terraform import civo_loadbalancer.myloadbalancer 4de7ac8b-495b-4884-9a69-1050c6793cd6 -``` diff --git a/docs/resources/network.md b/docs/resources/network.md index 139b5e0e..483e90ff 100644 --- a/docs/resources/network.md +++ b/docs/resources/network.md @@ -1,45 +1,45 @@ --- -layout: "civo" -page_title: "Civo: civo_network" -sidebar_current: "docs-civo-resource-network" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_network Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo Network resource. This can be used to create, modify, and delete Networks. + Provides a Civo network resource. This can be used to create, modify, and delete networks. --- -# civo\_network +# civo_network (Resource) -Provides a Civo Network resource. This can be used to create, -modify, and delete Networks. +Provides a Civo network resource. This can be used to create, modify, and delete networks. ## Example Usage -```hcl +```terraform resource "civo_network" "custom_net" { label = "test_network" } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `label` - (Required) The Network label +- **label** (String) Name for the network +### Optional -## Attributes Reference +- **region** (String) The region of the network -The following attributes are exported: +### Read-Only -* `id` - A unique ID that can be used to identify and reference a Network. -* `label` - The label used in the configuration. -* `name` - The name of the network. -* `region` - The region where the network was create. -* `default` - If is the default network +- **default** (Boolean) If the network is default, this will be `true` +- **id** (String) The ID of this resource +- **name** (String) The name of the network ## Import -Firewalls can be imported using the firewall `id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_network.custom_net b8ecd2ab-2267-4a5e-8692-cbf1d32583e3 ``` diff --git a/docs/resources/snapshot.md b/docs/resources/snapshot.md deleted file mode 100644 index 9b7d3894..00000000 --- a/docs/resources/snapshot.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: "civo" -page_title: "Civo: civo_snapshot" -sidebar_current: "docs-civo-resource-snapshot" -description: |- - Provides a Civo Instance snapshot resource. ---- - -# civo\_snapshot - -Provides a resource which can be used to create a snapshot from an existing Civo Instance. - -## Example Usage - -```hcl -resource "civo_snapshot" "myinstance-backup" { - name = "myinstance-backup" - instance_id = civo_instance.myinstance.id -} - -``` - -## Argument Reference - -The following arguments are supported: - -* `name` - (Required) A name for the instance snapshot. -* `instance_id` - (Required) The ID of the Instance from which the snapshot will be taken. -* `safe` - (Optional) If `true` the instance will be shut down during the snapshot to ensure all files -are in a consistent state (e.g. database tables aren't in the middle of being optimised -and hence risking corruption). The default is `false` so you experience no interruption -of service, but a small risk of corruption. -* `cron_timing` - (Optional) If a valid cron string is passed, the snapshot will be saved as an automated snapshot -continuing to automatically update based on the schedule of the cron sequence provided -The default is nil meaning the snapshot will be saved as a one-off snapshot. - -## Attributes Reference - -The following attributes are exported: - -* `id` The ID of the Instance snapshot. -* `name` - The name of the snapshot. -* `instance_id` - The ID of the Instance from which the snapshot was be taken. -* `safe` - If is `true` the instance will be shut down during the snapshot if id `false` them not. -* `cron_timing` - A string with the cron format. -* `hostname` - The hostname of the instance. -* `template_id` - The template id. -* `region` - The region where the snapshot was take. -* `size_gb` - The size of the snapshot in GB. -* `state` - The status of the snapshot. -* `next_execution` - if cron was define this date will be the next execution date. -* `requested_at` - The date where the snapshot was requested. -* `completed_at` - The date where the snapshot was completed. - - -## Import - -Instance Snapshots can be imported using the `snapshot id`, e.g. - -``` -terraform import civo_snapshot.myinstance-backup 4cc87851-e1d0-4270-822a-b36d28c7a77f -``` diff --git a/docs/resources/ssh_key.md b/docs/resources/ssh_key.md index 89382330..c10c3c61 100644 --- a/docs/resources/ssh_key.md +++ b/docs/resources/ssh_key.md @@ -1,47 +1,42 @@ --- -layout: "civo" -page_title: "Civo: civo_ssh_key" -sidebar_current: "docs-civo-resource-ssh-key" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_ssh_key Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo SSH key resource. + Provides a Civo SSH key resource to allow you to manage SSH keys for instance access. Keys created with this resource can be referenced in your instance configuration via their ID. --- -# civo\_ssh_key +# civo_ssh_key (Resource) -Provides a Civo SSH key resource to allow you to manage SSH -keys for Instance access. Keys created with this resource -can be referenced in your instance configuration via their ID. +Provides a Civo SSH key resource to allow you to manage SSH keys for instance access. Keys created with this resource can be referenced in your instance configuration via their ID. ## Example Usage -```hcl +```terraform resource "civo_ssh_key" "my-user"{ name = "my-user" public_key = file("~/.ssh/id_rsa.pub") } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `name` - (Required) The name of the SSH key for identification -* `public_key` - (Required) The public key. If this is a file, it -can be read using the file interpolation function. +- **name** (String) a string that will be the reference for the SSH key. +- **public_key** (String) a string containing the SSH public key. -## Attributes Reference +### Read-Only -The following attributes are exported: - -* `id` - The unique ID of the key -* `name` - The name of the SSH key -* `public_key` - The text of the public key -* `fingerprint` - The fingerprint of the SSH key +- **fingerprint** (String) a string containing the SSH finger print. +- **id** (String) The ID of this resource. ## Import -SSH Keys can be imported using the `ssh key id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_ssh_key.mykey 87ca2ee4-57d3-4420-b9b6-411b0b4b2a0e ``` diff --git a/docs/resources/volume.md b/docs/resources/volume.md index df13fcae..547438be 100644 --- a/docs/resources/volume.md +++ b/docs/resources/volume.md @@ -1,47 +1,57 @@ --- -layout: "civo" -page_title: "Civo: civo_volume" -sidebar_current: "docs-civo-resource-volume" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_volume Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo volume resource. + Provides a Civo volume which can be attached to an instance in order to provide expanded storage. --- -# civo\_volume +# civo_volume (Resource) -Provides a Civo volume which can be attached to a Instance in order to provide expanded storage. +Provides a Civo volume which can be attached to an instance in order to provide expanded storage. ## Example Usage -```hcl +```terraform +# Get network +data "civo_network" "default_network" { + label = "Default" +} + +# Create volume resource "civo_volume" "db" { - name = "backup-data" - size_gb = 60 - bootable = false + name = "backup-data" + size_gb = 5 + network_id = data.civo_network.default_network.id + depends_on = [ + data.civo_network.default_network + ] } ``` -## Argument Reference + +## Schema -The following arguments are supported: +### Required -* `name` - (Required) A name that you wish to use to refer to this volume. -* `size_gb` - (Required) A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes. -* `network_id` - (Required) The network that the volume belongs to. +- **name** (String) A name that you wish to use to refer to this volume +- **network_id** (String) The network that the volume belongs to +- **size_gb** (Number) A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes -## Attributes Reference +### Optional -The following attributes are exported: +- **region** (String) The region for the volume, if not declare we use the region in declared in the provider. -* `id` - The unique identifier for the volume. -* `name` - Name of the volume. -* `size_gb` - The size of the volume. -* `mount_point` - The mount point of the volume. -* `network_id` - The network that the volume belongs to. +### Read-Only + +- **id** (String) The ID of this resource. +- **mount_point** (String) The mount point of the volume (from instance's perspective) ## Import -Volumes can be imported using the `volume id`, e.g. +Import is supported using the following syntax: -``` +```shell +# using ID terraform import civo_volume.db 506f78a4-e098-11e5-ad9f-000f53306ae1 ``` diff --git a/docs/resources/volume_attachment.md b/docs/resources/volume_attachment.md index c5c8b495..324ba606 100644 --- a/docs/resources/volume_attachment.md +++ b/docs/resources/volume_attachment.md @@ -1,39 +1,78 @@ --- -layout: "civo" -page_title: "Civo: civo_volume_attachment" -sidebar_current: "docs-civo-resource-volume-attachment" +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "civo_volume_attachment Resource - terraform-provider-civo" +subcategory: "" description: |- - Provides a Civo volume attachment resource. + Manages volume attachment/detachment to an instance. --- -# civo\_volume\_attachment +# civo_volume_attachment (Resource) -Manages attaching a Volume to a Instance. +Manages volume attachment/detachment to an instance. ## Example Usage -```hcl +```terraform +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# 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 +} + +# Create volume resource "civo_volume" "db" { - name = "backup-data" - size_gb = 60 - bootable = false + name = "backup-data" + size_gb = 5 + network_id = civo_instance.foo.network_id } +# Create volume attachment resource "civo_volume_attachment" "foobar" { - instance_id = civo_instance.my-test-instance.id + instance_id = civo_instance.foo.id volume_id = civo_volume.db.id } ``` -## Argument Reference + +## Schema + +### Required + +- **instance_id** (String) The ID of target instance for attachment +- **volume_id** (String) The ID of target volume for attachment + +### Optional -The following arguments are supported: +- **region** (String) The region for the volume attachment -* `instance_id` - (Required) ID of the instance to attach the volume to. -* `volume_id` - (Required) ID of the Volume to be attached to the instance. +### Read-Only -## Attributes Reference +- **id** (String) The ID of this resource. -The following attributes are exported: -* `id` - The unique identifier for the volume attachment. \ No newline at end of file diff --git a/examples/data-sources/civo_disk_image/data-source.tf b/examples/data-sources/civo_disk_image/data-source.tf new file mode 100644 index 00000000..32f09ec8 --- /dev/null +++ b/examples/data-sources/civo_disk_image/data-source.tf @@ -0,0 +1,14 @@ +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +resource "civo_instance" "my-test-instance" { + 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 +} diff --git a/examples/data-sources/civo_dns_domain_name/data-source.tf b/examples/data-sources/civo_dns_domain_name/data-source.tf new file mode 100644 index 00000000..4423ac29 --- /dev/null +++ b/examples/data-sources/civo_dns_domain_name/data-source.tf @@ -0,0 +1,12 @@ +data "civo_dns_domain_name" "domain" { + name = "domain.com" +} + +output "domain_output" { + value = data.civo_dns_domain_name.domain.name +} + +output "domain_id_output" { + value = data.civo_dns_domain_name.domain.id +} + diff --git a/examples/data-sources/civo_dns_domain_record/data-source.tf b/examples/data-sources/civo_dns_domain_record/data-source.tf new file mode 100644 index 00000000..b5b9a7a2 --- /dev/null +++ b/examples/data-sources/civo_dns_domain_record/data-source.tf @@ -0,0 +1,16 @@ +data "civo_dns_domain_name" "domain" { + name = "domain.com" +} + +data "civo_dns_domain_record" "www" { + domain_id = data.civo_dns_domain_name.domain.id + name = "www" +} + +output "record_type" { + value = data.civo_dns_domain_record.www.type +} + +output "record_ttl" { + value = data.civo_dns_domain_record.www.ttl +} diff --git a/examples/data-sources/civo_instance/data-source.tf b/examples/data-sources/civo_instance/data-source.tf new file mode 100644 index 00000000..571ee802 --- /dev/null +++ b/examples/data-sources/civo_instance/data-source.tf @@ -0,0 +1,7 @@ +data "civo_instance" "myhostaname" { + hostname = "myhostname.com" +} + +output "instance_output" { + value = data.civo_instance.myhostaname.public_ip +} diff --git a/examples/data-sources/civo_instances/data-source.tf b/examples/data-sources/civo_instances/data-source.tf new file mode 100644 index 00000000..635f432e --- /dev/null +++ b/examples/data-sources/civo_instances/data-source.tf @@ -0,0 +1,7 @@ +data "civo_instances" "small-size" { + region = "NYC1" + filter { + key = "size" + values = [g3.small] + } +} diff --git a/examples/data-sources/civo_instances_size/data-source.tf b/examples/data-sources/civo_instances_size/data-source.tf new file mode 100644 index 00000000..0e3efbe8 --- /dev/null +++ b/examples/data-sources/civo_instances_size/data-source.tf @@ -0,0 +1,21 @@ +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +resource "civo_instance" "my-test-instance" { + 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 +} diff --git a/examples/data-sources/civo_kubernetes_cluster/data-source.tf b/examples/data-sources/civo_kubernetes_cluster/data-source.tf new file mode 100644 index 00000000..ff374153 --- /dev/null +++ b/examples/data-sources/civo_kubernetes_cluster/data-source.tf @@ -0,0 +1,7 @@ +data "civo_kubernetes_cluster" "my-cluster" { + name = "my-super-cluster" +} + +output "kubernetes_cluster_output" { + value = data.civo_kubernetes_cluster.my-cluster.master_ip +} diff --git a/examples/data-sources/civo_kubernetes_version/data-source.tf b/examples/data-sources/civo_kubernetes_version/data-source.tf new file mode 100644 index 00000000..ef6f9d56 --- /dev/null +++ b/examples/data-sources/civo_kubernetes_version/data-source.tf @@ -0,0 +1,6 @@ +data "civo_kubernetes_version" "stable" { + filter { + key = "type" + values = ["stable"] + } +} diff --git a/examples/data-sources/civo_loadbalancer/data-source.tf b/examples/data-sources/civo_loadbalancer/data-source.tf new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/examples/data-sources/civo_loadbalancer/data-source.tf @@ -0,0 +1 @@ +# TODO diff --git a/examples/data-sources/civo_network/data-source.tf b/examples/data-sources/civo_network/data-source.tf new file mode 100644 index 00000000..64c14901 --- /dev/null +++ b/examples/data-sources/civo_network/data-source.tf @@ -0,0 +1,4 @@ +data "civo_network" "test" { + label = "test-network" + region = "NYC1" +} diff --git a/examples/data-sources/civo_region/data-source.tf b/examples/data-sources/civo_region/data-source.tf new file mode 100644 index 00000000..a4645762 --- /dev/null +++ b/examples/data-sources/civo_region/data-source.tf @@ -0,0 +1,15 @@ +data "civo_region" "default" { + filter { + key = "default" + values = ["true"] + } +} + +resource "civo_instance" "my-test-instance" { + hostname = "foo.com" + region = element(data.civo_region.default.regions, 0).code + 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 +} diff --git a/examples/data-sources/civo_snapshot/data-source.tf b/examples/data-sources/civo_snapshot/data-source.tf new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/examples/data-sources/civo_snapshot/data-source.tf @@ -0,0 +1 @@ +# TODO diff --git a/examples/data-sources/civo_ssh_key/data-source.tf b/examples/data-sources/civo_ssh_key/data-source.tf new file mode 100644 index 00000000..b4bc4e12 --- /dev/null +++ b/examples/data-sources/civo_ssh_key/data-source.tf @@ -0,0 +1,12 @@ +data "civo_ssh_key" "example" { + name = "example" +} + +resource "civo_instance" "my-test-instance" { + 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 + sshkey_id = data.civo_ssh_key.example.id +} diff --git a/examples/data-sources/civo_template/data-source.tf b/examples/data-sources/civo_template/data-source.tf new file mode 100644 index 00000000..0a7dc550 --- /dev/null +++ b/examples/data-sources/civo_template/data-source.tf @@ -0,0 +1,14 @@ +data "civo_template" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +resource "civo_instance" "my-test-instance" { + hostname = "foo.com" + tags = ["python", "nginx"] + notes = "this is a note for the server" + size = element(data.civo_instances_size.small.sizes, 0).name + template = element(data.civo_template.debian.templates, 0).id +} diff --git a/examples/data-sources/civo_volume/data-source.tf b/examples/data-sources/civo_volume/data-source.tf new file mode 100644 index 00000000..3fc4e052 --- /dev/null +++ b/examples/data-sources/civo_volume/data-source.tf @@ -0,0 +1,3 @@ +data "civo_volume" "mysql" { + name = "database-mysql" +} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf new file mode 100644 index 00000000..bd9d5d6b --- /dev/null +++ b/examples/provider/provider.tf @@ -0,0 +1,13 @@ +# Set the variable value in *.tfvars file or using -var="civo_token=..." CLI flag +variable "civo_token" {} + +# Configure the Civo Provider +provider "civo" { + token = var.civo_token + region = "LON1" +} + +# Create a web server +resource "civo_instance" "web" { + # ... +} diff --git a/examples/resources/civo_dns_domain_name/import.sh b/examples/resources/civo_dns_domain_name/import.sh new file mode 100644 index 00000000..c8828988 --- /dev/null +++ b/examples/resources/civo_dns_domain_name/import.sh @@ -0,0 +1,2 @@ +# using domain name +terraform import civo_dns_domain_name.main mydomain.com diff --git a/examples/resources/civo_dns_domain_name/resource.tf b/examples/resources/civo_dns_domain_name/resource.tf new file mode 100644 index 00000000..f55d16b6 --- /dev/null +++ b/examples/resources/civo_dns_domain_name/resource.tf @@ -0,0 +1,4 @@ +# Create a new domain name +resource "civo_dns_domain_name" "main" { + name = "mydomain.com" +} diff --git a/examples/resources/civo_dns_domain_record/import.sh b/examples/resources/civo_dns_domain_record/import.sh new file mode 100644 index 00000000..c1e3eefa --- /dev/null +++ b/examples/resources/civo_dns_domain_record/import.sh @@ -0,0 +1,2 @@ +# using domain_id:domain_record_id +terraform import civo_dns_domain_record.www a3cd6832-9577-4017-afd7-17d239fc0bf0:c9a39d14-ee1b-4870-8fb0-a2d4f465e822 diff --git a/examples/resources/civo_dns_domain_record/resource.tf b/examples/resources/civo_dns_domain_record/resource.tf new file mode 100644 index 00000000..9e6f3d49 --- /dev/null +++ b/examples/resources/civo_dns_domain_record/resource.tf @@ -0,0 +1,44 @@ +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# Create a new instance +resource "civo_instance" "foo" { + hostname = "foo.com" + size = element(data.civo_instances_size.small.sizes, 0).name + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id +} + +# Create a new domain name +resource "civo_dns_domain_name" "mydomain" { + name = "mydomain.com" +} + +# Create a new domain record +resource "civo_dns_domain_record" "www" { + domain_id = civo_dns_domain_name.mydomain.id + type = "A" + name = "www" + value = civo_instance.foo.public_ip + ttl = 600 + depends_on = [civo_dns_domain_name.mydomain, civo_instance.foo] +} diff --git a/examples/resources/civo_firewall/import.sh b/examples/resources/civo_firewall/import.sh new file mode 100644 index 00000000..dc34cab6 --- /dev/null +++ b/examples/resources/civo_firewall/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_firewall.www b8ecd2ab-2267-4a5e-8692-cbf1d32583e3 diff --git a/examples/resources/civo_firewall/resource.tf b/examples/resources/civo_firewall/resource.tf new file mode 100644 index 00000000..93f650c6 --- /dev/null +++ b/examples/resources/civo_firewall/resource.tf @@ -0,0 +1,10 @@ +# Create a network +resource "civo_network" "custom_net" { + label = "my-custom-network" +} + +# Create a firewall +resource "civo_firewall" "www" { + name = "www" + network_id = civo_network.custom_net.id +} diff --git a/examples/resources/civo_firewall_rule/import.sh b/examples/resources/civo_firewall_rule/import.sh new file mode 100644 index 00000000..f9d34e90 --- /dev/null +++ b/examples/resources/civo_firewall_rule/import.sh @@ -0,0 +1,2 @@ +# using firewall_id:firewall_rule_id +terraform import civo_firewall_rule.http b8ecd2ab-2267-4a5e-8692-cbf1d32583e3:4b0022ee-00b2-4f81-a40d-b4f8728923a7 diff --git a/examples/resources/civo_firewall_rule/resource.tf b/examples/resources/civo_firewall_rule/resource.tf new file mode 100644 index 00000000..569bfb59 --- /dev/null +++ b/examples/resources/civo_firewall_rule/resource.tf @@ -0,0 +1,53 @@ +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# Create a new instance +resource "civo_instance" "foo" { + hostname = "foo.com" + size = element(data.civo_instances_size.small.sizes, 0).name + disk_image = element(data.civo_disk_image.debian.diskimages, 0).id +} + +# Create a network +resource "civo_network" "custom_net" { + label = "my-custom-network" +} + +# Create a firewall +resource "civo_firewall" "custom_firewall" { + name = "my-custom-firewall" + network_id = civo_network.custom_net.id +} + +# Create a firewall rule and only allow +# connections from instance we created above +resource "civo_firewall_rule" "custom_port" { + firewall_id = civo_firewall.custom_firewall.id + protocol = "tcp" + start_port = "3000" + end_port = "3000" + cidr = [format("%s/%s",civo_instance.foo.public_ip,"32")] + direction = "ingress" + label = "custom-application" + depends_on = [civo_firewall.custom_firewall] +} diff --git a/examples/resources/civo_instance/import.sh b/examples/resources/civo_instance/import.sh new file mode 100644 index 00000000..ca4f54a8 --- /dev/null +++ b/examples/resources/civo_instance/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_instance.myintance 18bd98ad-1b6e-4f87-b48f-e690b4fd7413 diff --git a/examples/resources/civo_instance/resource.tf b/examples/resources/civo_instance/resource.tf new file mode 100644 index 00000000..74fa012c --- /dev/null +++ b/examples/resources/civo_instance/resource.tf @@ -0,0 +1,31 @@ +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# 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 +} diff --git a/examples/resources/civo_kubernetes_cluster/import.sh b/examples/resources/civo_kubernetes_cluster/import.sh new file mode 100644 index 00000000..17aa67e8 --- /dev/null +++ b/examples/resources/civo_kubernetes_cluster/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_kubernetes_cluster.my-cluster 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af diff --git a/examples/resources/civo_kubernetes_cluster/resource.tf b/examples/resources/civo_kubernetes_cluster/resource.tf new file mode 100644 index 00000000..e04bdbed --- /dev/null +++ b/examples/resources/civo_kubernetes_cluster/resource.tf @@ -0,0 +1,20 @@ +# Query xsmall instance size +data "civo_instances_size" "xsmall" { + filter { + key = "type" + values = ["kubernetes"] + } + + sort { + key = "ram" + direction = "asc" + } +} + +# Create a cluster +resource "civo_kubernetes_cluster" "my-cluster" { + name = "my-cluster" + applications = "Portainer,Linkerd:Linkerd & Jaeger" + num_target_nodes = 2 + target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name +} diff --git a/examples/resources/civo_kubernetes_node_pool/import.sh b/examples/resources/civo_kubernetes_node_pool/import.sh new file mode 100644 index 00000000..9827b3b8 --- /dev/null +++ b/examples/resources/civo_kubernetes_node_pool/import.sh @@ -0,0 +1,2 @@ +# using cluster_id:node_pool_id +terraform import civo_kubernetes_node_pool.my-pool 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af:502c1130-cb9b-4a88-b6d2-307bd96d946a diff --git a/examples/resources/civo_kubernetes_node_pool/resource.tf b/examples/resources/civo_kubernetes_node_pool/resource.tf new file mode 100644 index 00000000..d82f4048 --- /dev/null +++ b/examples/resources/civo_kubernetes_node_pool/resource.tf @@ -0,0 +1,26 @@ +# Query xsmall instance size +data "civo_instances_size" "xsmall" { + filter { + key = "type" + values = ["kubernetes"] + } + + sort { + key = "ram" + direction = "asc" + } +} + +# Create a cluster +resource "civo_kubernetes_cluster" "my-cluster" { + name = "my-cluster" + num_target_nodes = 1 + target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name +} + +# Add a node pool +resource "civo_kubernetes_node_pool" "front-end" { + cluster_id = civo_kubernetes_cluster.my-cluster.id + num_target_nodes = 1 + region = "LON1" +} diff --git a/examples/resources/civo_loadbalancer/import.sh b/examples/resources/civo_loadbalancer/import.sh new file mode 100644 index 00000000..2ac5f86e --- /dev/null +++ b/examples/resources/civo_loadbalancer/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_loadbalancer.myloadbalancer 4de7ac8b-495b-4884-9a69-1050c6793cd6 diff --git a/examples/resources/civo_loadbalancer/resource.tf b/examples/resources/civo_loadbalancer/resource.tf new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/examples/resources/civo_loadbalancer/resource.tf @@ -0,0 +1 @@ +# TODO diff --git a/examples/resources/civo_network/import.sh b/examples/resources/civo_network/import.sh new file mode 100644 index 00000000..b7beaabe --- /dev/null +++ b/examples/resources/civo_network/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_network.custom_net b8ecd2ab-2267-4a5e-8692-cbf1d32583e3 diff --git a/examples/resources/civo_network/resource.tf b/examples/resources/civo_network/resource.tf new file mode 100644 index 00000000..6c45bbdd --- /dev/null +++ b/examples/resources/civo_network/resource.tf @@ -0,0 +1,3 @@ +resource "civo_network" "custom_net" { + label = "test_network" +} diff --git a/examples/resources/civo_snapshot/import.sh b/examples/resources/civo_snapshot/import.sh new file mode 100644 index 00000000..98b3d3a7 --- /dev/null +++ b/examples/resources/civo_snapshot/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_snapshot.myinstance-backup 4cc87851-e1d0-4270-822a-b36d28c7a77f diff --git a/examples/resources/civo_snapshot/resource.tf b/examples/resources/civo_snapshot/resource.tf new file mode 100644 index 00000000..70b786d1 --- /dev/null +++ b/examples/resources/civo_snapshot/resource.tf @@ -0,0 +1 @@ +// TODO diff --git a/examples/resources/civo_ssh_key/import.sh b/examples/resources/civo_ssh_key/import.sh new file mode 100644 index 00000000..3f6ab88a --- /dev/null +++ b/examples/resources/civo_ssh_key/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_ssh_key.mykey 87ca2ee4-57d3-4420-b9b6-411b0b4b2a0e diff --git a/examples/resources/civo_ssh_key/resource.tf b/examples/resources/civo_ssh_key/resource.tf new file mode 100644 index 00000000..a3c1f07d --- /dev/null +++ b/examples/resources/civo_ssh_key/resource.tf @@ -0,0 +1,4 @@ +resource "civo_ssh_key" "my-user"{ + name = "my-user" + public_key = file("~/.ssh/id_rsa.pub") +} diff --git a/examples/resources/civo_template/import.sh b/examples/resources/civo_template/import.sh new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/examples/resources/civo_template/import.sh @@ -0,0 +1 @@ +# TODO diff --git a/examples/resources/civo_template/resource.tf b/examples/resources/civo_template/resource.tf new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/examples/resources/civo_template/resource.tf @@ -0,0 +1 @@ +# TODO diff --git a/examples/resources/civo_volume/import.sh b/examples/resources/civo_volume/import.sh new file mode 100644 index 00000000..e3312ac2 --- /dev/null +++ b/examples/resources/civo_volume/import.sh @@ -0,0 +1,2 @@ +# using ID +terraform import civo_volume.db 506f78a4-e098-11e5-ad9f-000f53306ae1 diff --git a/examples/resources/civo_volume/resource.tf b/examples/resources/civo_volume/resource.tf new file mode 100644 index 00000000..c5fc6564 --- /dev/null +++ b/examples/resources/civo_volume/resource.tf @@ -0,0 +1,14 @@ +# Get network +data "civo_network" "default_network" { + label = "Default" +} + +# Create volume +resource "civo_volume" "db" { + name = "backup-data" + size_gb = 5 + network_id = data.civo_network.default_network.id + depends_on = [ + data.civo_network.default_network + ] +} diff --git a/examples/resources/civo_volume_attachment/resource.tf b/examples/resources/civo_volume_attachment/resource.tf new file mode 100644 index 00000000..e7e1d5fe --- /dev/null +++ b/examples/resources/civo_volume_attachment/resource.tf @@ -0,0 +1,44 @@ +# Query small instance size +data "civo_instances_size" "small" { + filter { + key = "name" + values = ["g3.small"] + match_by = "re" + } + + filter { + key = "type" + values = ["instance"] + } + +} + +# Query instance disk image +data "civo_disk_image" "debian" { + filter { + key = "name" + values = ["debian-10"] + } +} + +# 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 +} + +# Create volume +resource "civo_volume" "db" { + name = "backup-data" + size_gb = 5 + network_id = civo_instance.foo.network_id +} + +# Create volume attachment +resource "civo_volume_attachment" "foobar" { + instance_id = civo_instance.foo.id + volume_id = civo_volume.db.id +} diff --git a/internal/datalist/filter.go b/internal/datalist/filter.go index c46a8fcf..926b204f 100644 --- a/internal/datalist/filter.go +++ b/internal/datalist/filter.go @@ -11,6 +11,7 @@ import ( "regexp" "strconv" + "github.com/civo/terraform-provider-civo/internal/utils" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -22,7 +23,7 @@ type commonFilter struct { matchBy string } -func filterSchema(allowedKeys []string) *schema.Schema { +func filterSchema(resultAttributeName string, allowedKeys []string) *schema.Schema { return &schema.Schema{ Type: schema.TypeSet, Elem: &schema.Resource{ @@ -31,22 +32,26 @@ func filterSchema(allowedKeys []string) *schema.Schema { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(allowedKeys, false), + Description: fmt.Sprintf("Filter %s by this key. This may be one of %s.", resultAttributeName, utils.GetCommaSeparatedAllowedKeys(allowedKeys)), }, "values": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: fmt.Sprintf("Only retrieves `%s` which keys has value that matches one of the values provided here", resultAttributeName), }, "all": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Set to `true` to require that a field match all of the `values` instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the `values` are present in the list or set.", }, "match_by": { Type: schema.TypeString, Optional: true, Default: "exact", ValidateFunc: validation.StringInSlice([]string{"exact", "re", "substring"}, false), + Description: "One of `exact` (default), `re`, or `substring`. For string-typed fields, specify `re` to match by using the `values` as regular expressions, or specify `substring` to match by treating the `values` as substrings to find within the string field.", }, }, }, diff --git a/internal/datalist/schema.go b/internal/datalist/schema.go index 1ac5c13f..04af62e3 100644 --- a/internal/datalist/schema.go +++ b/internal/datalist/schema.go @@ -36,6 +36,9 @@ type ResourceConfig struct { // Extra parameters to expose on the datasource alongside `filter` and `sort`. ExtraQuerySchema map[string]*schema.Schema + + // Description for schema + Description string } // Returns a new "data list" resource given the specified configuration. This @@ -63,8 +66,8 @@ func NewResource(config *ResourceConfig) *schema.Resource { sortKeys := computeSortKeys(recordSchema) datasourceSchema := map[string]*schema.Schema{ - "filter": filterSchema(filterKeys), - "sort": sortSchema(sortKeys), + "filter": filterSchema(config.ResultAttributeName, filterKeys), + "sort": sortSchema(config.ResultAttributeName, sortKeys), config.ResultAttributeName: { Type: schema.TypeList, Computed: true, @@ -81,6 +84,7 @@ func NewResource(config *ResourceConfig) *schema.Resource { return &schema.Resource{ ReadContext: dataListResourceRead(config), Schema: datasourceSchema, + Description: config.Description, } } diff --git a/internal/datalist/sort.go b/internal/datalist/sort.go index d37f1606..4f54b5c4 100644 --- a/internal/datalist/sort.go +++ b/internal/datalist/sort.go @@ -7,10 +7,13 @@ Source: https://github.com/terraform-providers/terraform-provider-digitalocean package datalist import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "fmt" "sort" "strings" + + "github.com/civo/terraform-provider-civo/internal/utils" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) var ( @@ -22,7 +25,7 @@ type commonSort struct { direction string } -func sortSchema(allowedKeys []string) *schema.Schema { +func sortSchema(resultAttributeName string, allowedKeys []string) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, Elem: &schema.Resource{ @@ -31,11 +34,13 @@ func sortSchema(allowedKeys []string) *schema.Schema { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(allowedKeys, false), + Description: fmt.Sprintf("Sort %s by this key. This may be one of %s.", resultAttributeName, utils.GetCommaSeparatedAllowedKeys(allowedKeys)), }, "direction": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice(sortKeys, false), + Description: "The sort direction. This may be either `asc` or `desc`.", }, }, }, diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 4b1aa241..298c8a02 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -6,6 +6,7 @@ package utils import ( "fmt" "regexp" + "sort" "strings" "github.com/civo/civogo" @@ -75,3 +76,13 @@ func CheckAPPName(appName string, client *civogo.Client) bool { return false } + +// GetCommaSeparatedAllowedKeys is used by "tfplugindocs" CLI to generate Markdown docs +func GetCommaSeparatedAllowedKeys(allowedKeys []string) string { + res := []string{} + for _, ak := range allowedKeys { + res = append(res, fmt.Sprintf("`%s`", ak)) + } + sort.Strings(res) + return strings.Join(res, ", ") +} diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 00000000..ad62209c --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,18 @@ +--- +layout: "" +page_title: "Provider: Civo" +description: |- + 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. +--- + +# 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. + +Use the navigation to the left to read about the available resources. + +## Example Usage + +{{tffile "examples/provider/provider.tf"}} + +{{ .SchemaMarkdown | trimspace }}