Fix contradiction in terms with provider documentation (#10815) (#10874)

* Remove contradiction with Scaleway documentation

The parameters previously termed by Terraform:

1. Organization
2. Access key

Are referred to, respectively, by Scaleway [0] as:

1. Access key
2. Token

which is a confusing contradiction for a user.

Since Scaleway terms (1) both 'access key' [0] and 'organization ID' [1],
@nicolai86 suggested keeping the latter as already used, but changing (2) for
'token'; removing the contradiction.

This commit thus changes the parameters to:

1. Organization
2. Token

Closes #10815.

[0] - https://cloud.scaleway.com/#/credentials
[1] - https://www.scaleway.com/docs/retrieve-my-organization-id-throught-the-api

* Update docs to reflect Scaleway offering x86

Scaleway now provides x86 servers [0] as well as ARM.

This commit removes 'ARM' from various references suggesting that might be the
only option.

[0] - https://blog.online.net/2016/03/08/c2-insanely-affordable-x64-servers/
This commit is contained in:
Ollie Ford 2017-01-17 12:02:55 +00:00 committed by Paul Stack
parent 2a022f73c0
commit ed2b959f7e
6 changed files with 32 additions and 15 deletions

View File

@ -14,13 +14,21 @@ func Provider() terraform.ResourceProvider {
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ACCESS_KEY", nil), DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ACCESS_KEY", nil),
Deprecated: "Use `token` instead.",
Description: "The API key for Scaleway API operations.",
},
"token": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_TOKEN", nil),
Description: "The API key for Scaleway API operations.", Description: "The API key for Scaleway API operations.",
}, },
"organization": &schema.Schema{ "organization": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ORGANIZATION", nil), DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ORGANIZATION", nil),
Description: "The Organization ID for Scaleway API operations.", Description: "The Organization ID (a.k.a. 'access key') for Scaleway API operations.",
}, },
"region": &schema.Schema{ "region": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
@ -51,9 +59,18 @@ func Provider() terraform.ResourceProvider {
var scalewayMutexKV = mutexkv.NewMutexKV() var scalewayMutexKV = mutexkv.NewMutexKV()
func providerConfigure(d *schema.ResourceData) (interface{}, error) { func providerConfigure(d *schema.ResourceData) (interface{}, error) {
apiKey := ""
if v, ok := d.Get("token").(string); ok {
apiKey = v
} else {
if v, ok := d.Get("access_key").(string); ok {
apiKey = v
}
}
config := Config{ config := Config{
Organization: d.Get("organization").(string), Organization: d.Get("organization").(string),
APIKey: d.Get("access_key").(string), APIKey: apiKey,
Region: d.Get("region").(string), Region: d.Get("region").(string),
} }

View File

@ -32,7 +32,7 @@ func testAccPreCheck(t *testing.T) {
if v := os.Getenv("SCALEWAY_ORGANIZATION"); v == "" { if v := os.Getenv("SCALEWAY_ORGANIZATION"); v == "" {
t.Fatal("SCALEWAY_ORGANIZATION must be set for acceptance tests") t.Fatal("SCALEWAY_ORGANIZATION must be set for acceptance tests")
} }
if v := os.Getenv("SCALEWAY_ACCESS_KEY"); v == "" { if v := os.Getenv("SCALEWAY_TOKEN"); v == "" {
t.Fatal("SCALEWAY_ACCESS_KEY must be set for acceptance tests") t.Fatal("SCALEWAY_TOKEN must be set for acceptance tests")
} }
} }

View File

@ -3,7 +3,7 @@ layout: "scaleway"
page_title: "Provider: Scaleway" page_title: "Provider: Scaleway"
sidebar_current: "docs-scaleway-index" sidebar_current: "docs-scaleway-index"
description: |- description: |-
The Scaleway provider is used to interact with Scaleway ARM cloud provider. The Scaleway provider is used to interact with Scaleway bare metal & VPS provider.
--- ---
# Scaleway Provider # Scaleway Provider
@ -85,13 +85,13 @@ you can leave them out:
``` ```
provider "scaleway" { provider "scaleway" {
organization = "" organization = ""
access_key = "" token = ""
region = "par1" region = "par1"
} }
``` ```
...and instead set these environment variables: ...and instead set these environment variables:
- **SCALEWAY_ORGANIZATION**: Your Scaleway organization `access key` - **SCALEWAY_ORGANIZATION**: Your Scaleway `organization` access key
- **SCALEWAY_ACCESS_KEY**: Your API access `token` - **SCALEWAY_TOKEN**: Your API access `token`
- **SCALEWAY_REGION**: The Scaleway region - **SCALEWAY_REGION**: The Scaleway region

View File

@ -8,7 +8,7 @@ description: |-
# scaleway\_ip # scaleway\_ip
Provides IPs for ARM servers. This allows IPs to be created, updated and deleted. Provides IPs for servers. This allows IPs to be created, updated and deleted.
For additional details please refer to [API documentation](https://developer.scaleway.com/#ips). For additional details please refer to [API documentation](https://developer.scaleway.com/#ips).
## Example Usage ## Example Usage
@ -22,7 +22,7 @@ resource "scaleway_ip" "test_ip" {
The following arguments are supported: The following arguments are supported:
* `server` - (Optional) ID of ARM server to associate IP with * `server` - (Optional) ID of server to associate IP with
Field `server` is editable. Field `server` is editable.

View File

@ -8,7 +8,7 @@ description: |-
# scaleway\_server # scaleway\_server
Provides ARM servers. This allows servers to be created, updated and deleted. Provides servers. This allows servers to be created, updated and deleted.
For additional details please refer to [API documentation](https://developer.scaleway.com/#servers). For additional details please refer to [API documentation](https://developer.scaleway.com/#servers).
## Example Usage ## Example Usage
@ -30,9 +30,9 @@ resource "scaleway_server" "test" {
The following arguments are supported: The following arguments are supported:
* `name` - (Required) name of ARM server * `name` - (Required) name of server
* `image` - (Required) base image of ARM server * `image` - (Required) base image of server
* `type` - (Required) type of ARM server * `type` - (Required) type of server
* `bootscript` - (Optional) server bootscript * `bootscript` - (Optional) server bootscript
* `tags` - (Optional) list of tags for server * `tags` - (Optional) list of tags for server
* `enable_ipv6` - (Optional) enable ipv6 * `enable_ipv6` - (Optional) enable ipv6

View File

@ -8,7 +8,7 @@ description: |-
# scaleway\_volume # scaleway\_volume
Provides ARM volumes. This allows volumes to be created, updated and deleted. Provides volumes. This allows volumes to be created, updated and deleted.
For additional details please refer to [API documentation](https://developer.scaleway.com/#volumes). For additional details please refer to [API documentation](https://developer.scaleway.com/#volumes).
## Example Usage ## Example Usage