» Scaleway Provider
The Scaleway provider is used to manage Scaleway resources.
Use the navigation to the left to read about the available resources.
» Example Usage
Here is an example that will setup the following: * A Server. * An IP Address. * A security group.
(create this as sl.tf
and run terraform commands from this directory):
provider "scaleway" {
organization = "<YOUR-ORGANIZATION-ID>"
token = "<YOUR-SECRET-TOKEN>"
region = "par1"
}
resource "scaleway_ip" "ip" {
server = "${scaleway_server.test.id}"
}
resource "scaleway_server" "test" {
name = "test"
image = "aecaed73-51a5-4439-a127-6d8229847145"
type = "C2S"
}
resource "scaleway_volume" "test" {
name = "test"
size_in_gb = 50
type = "l_ssd"
}
resource "scaleway_volume_attachment" "test" {
server = "${scaleway_server.test.id}"
volume = "${scaleway_volume.test.id}"
}
resource "scaleway_security_group" "http" {
name = "http"
description = "allow HTTP and HTTPS traffic"
}
resource "scaleway_security_group_rule" "http_accept" {
security_group = "${scaleway_security_group.http.id}"
action = "accept"
direction = "inbound"
ip_range = "0.0.0.0/0"
protocol = "TCP"
port = 80
}
resource "scaleway_security_group_rule" "https_accept" {
security_group = "${scaleway_security_group.http.id}"
action = "accept"
direction = "inbound"
ip_range = "0.0.0.0/0"
protocol = "TCP"
port = 443
}
You'll need to provide your Scaleway organization ID and a secret token. Both are UUIDs.
Your organization ID can be found in the Account tab of the Scaleway control panel. It
is labeled "Organization ID". Alternatively, if you already have a secret token you can
issue a request to the Scaleway API directly and query for your organization ID:
shell
$ curl https://account.scaleway.com/organizations -H "X-Auth-Token: <YOUR-SECRET-TOKEN>"
A secret token can be generated by visiting the Credentials tab of the Scaleway control panel and looking in the Tokens section at the bottom of the page. Each listed "Secret Key" (if any tokens have already been created) can be used as your secret token. Since secret keys are only revealed one time (when the token is first created) you might need to create a new token to get a new "Secret Key". Giving each token a friendly-name is recommended.
If you do not want to put credentials in your configuration file, you can leave them out:
provider "scaleway" {
region = "par1"
}
...and instead set these environment variables:
-
SCALEWAY_ORGANIZATION: Your Scaleway
organization
ID -
SCALEWAY_TOKEN: Your API access
token
, generated by you - SCALEWAY_REGION: The Scaleway region
Alternatively the ~/.scwrc
will be parsed to load your Scaleway CLI configuration, if it exists.
» Volume usage
You can add volumes to bare metal instances. The minimal size of increment is 50GB and you can add at most 15 different volumes on an instance.
Additional volumes cannot be added to virtual cloud servers.
Check out the list of different instances on the pricing page.
» Scaleway S3-compatible
Scaleway object storage can be used to store your Terraform state. Configure your backend as:
terraform {
backend "s3" {
bucket = "terraform_state"
key = "my_state.tfstate"
region = "nl-ams"
endpoint = "https://s3.nl-ams.scw.cloud"
access_key = "SCWXYZ"
secret_key = "xxxxxxxxxxxxxxxxxxx"
skip_credentials_validation = true
skip_region_validation = true
}
}
Beware as no locking mechanism are yet supported. Using scaleway object storage as terraform backend is not suitable if you work in a team with à risk of simultaneously access to the same plan.