Skip to content

Commit

Permalink
Merge pull request #248 from ovh/ava-improve-doc
Browse files Browse the repository at this point in the history
feat: improve the provider configuration and init for TF version 0.13 and 0.12
  • Loading branch information
yanndegat authored Apr 6, 2022
2 parents 4432c49 + 7ebcb99 commit 71a2f17
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The provider needs to be configured with the proper credentials before it can be

Use the navigation to the left to read about the available resources.

## Configuration of the provider
## Provider configuration

Requests to OVHcloud APIs require a set of secrets keys and the definition of the API end point.
See [First Steps with the API](https://docs.ovh.com/gb/en/customer/first-steps-with-ovh-api/) (or the French version, [Premiers pas avec les API OVHcloud](https://docs.ovh.com/fr/api/api-premiers-pas/)) for a detailed explanation.
Expand All @@ -23,17 +23,36 @@ These keys can be generated via the [OVH token generation page](https://api.ovh.

These parameters can be configured directly in the provider block as shown hereafter.

Terraform 0.13 and later:

```hcl
# Configure the OVHcloud Provider
terraform {
required_providers {
ovh = {
source = "ovh/ovh"
}
}
}
provider "ovh" {
endpoint = "ovh-eu"
application_key = "yyyyyy"
application_secret = "xxxxxxxxxxxxxx"
application_key = "xxxxxxxxx"
application_secret = "yyyyyyyyy"
consumer_key = "zzzzzzzzzzzzzz"
}
```

Terraform 0.12 and earlier:

```hcl
# Configure the OVHcloud Provider
provider "ovh" {
endpoint = "ovh-eu"
application_key = "xxxxxxxxx"
application_secret = "yyyyyyyyy"
consumer_key = "zzzzzzzzzzzzzz"
}
Alternatively the secret keys can be retrieved from your environment.
* `OVH_ENDPOINT`
Expand All @@ -47,9 +66,27 @@ This later method (or a similar alternative) is recommended to avoid storing sec
## Example Usage
```hcl
# Create a public cloud user
resource "ovh_cloud_project_user" "user-test" {
# ...
variable "service_name" {
default = "wwwwwww"
}
# Create an OVHcloud Managed Kubernetes cluster
resource "ovh_cloud_project_kube" "my_kube_cluster" {
service_name = var.service_name
name = "my-super-kube-cluster"
region = "GRA5"
version = "1.22"
}
# Create a Node Pool for our Kubernetes clusterx
resource "ovh_cloud_project_kube_nodepool" "node_pool" {
service_name = var.service_name
kube_id = ovh_cloud_project_kube.my_kube_cluster.id
name = "my-pool" //Warning: "_" char is not allowed!
flavor_name = "b2-7"
desired_nodes = 3
max_nodes = 3
min_nodes = 3
}
```

Expand Down

0 comments on commit 71a2f17

Please sign in to comment.