Skip to content

Commit 07bee76

Browse files
committed
Update to Scaleway Provider 2.0+
1 parent f4caaf1 commit 07bee76

File tree

5 files changed

+71
-26
lines changed

5 files changed

+71
-26
lines changed

.terraform.lock.hcl

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
ssh-keygen -t rsa -b 4096 -q -C 'scaleway' -N '' -f ~/.ssh/scaleway
99
```
1010

11-
2. [Retrieve your organization and API token](https://console.scaleway.com/account/credentials) and export them:
11+
2. [Retrieve your project credentials](https://console.scaleway.com/project/credentials) and export them:
1212

1313
```
14+
export SCW_DEFAULT_PROJECT_ID=<REDACTED>
1415
export SCW_ACCESS_KEY=<REDACTED>
1516
export SCW_SECRET_KEY=<REDACTED>
16-
export SCW_DEFAULT_ORGANIZATION_ID=<REDACTED>
17+
export SCW_DEFAULT_REGION=fr-par
18+
export SCW_DEFAULT_ZONE=fr-par-1
1719
```
1820

1921
3. Initialize Terraform

main.tf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@ provider "scaleway" {
22
# Provide configuration with environment variables, see https://www.terraform.io/docs/providers/scaleway/index.html#environment-variables
33
}
44

5-
data "scaleway_image" "image" {
6-
count = var.node_count > 0 ? 1 : 0
7-
8-
architecture = var.server_arch
9-
name = var.server_image
10-
}
11-
125
data "template_file" "userdata" {
136
template = file("${path.module}/cloud-init-user-data")
147

158
vars = {
16-
codename = var.docker_distrib_codename
179
distrib = var.docker_distrib
1810
user = var.username
1911
}
@@ -24,7 +16,7 @@ resource "scaleway_instance_server" "node" {
2416

2517
name = "${var.node_name}-${count.index}"
2618

27-
image = data.scaleway_image.image[0].id
19+
image = var.server_image
2820
type = var.server_type
2921
enable_dynamic_ip = true
3022

variables.tf

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,14 @@ variable "node_name" {
88
default = "cloud-init"
99
}
1010

11-
variable "server_arch" {
12-
type = string
13-
default = "x86_64"
14-
}
15-
1611
variable "server_image" {
1712
type = string
18-
default = "Ubuntu Bionic"
13+
default = "ubuntu_focal"
1914
}
2015

2116
variable "server_type" {
2217
type = string
23-
default = "START1-S"
18+
default = "DEV1-S"
2419
}
2520

2621
variable "ssh_key_file" {
@@ -37,9 +32,3 @@ variable "docker_distrib" {
3732
type = string
3833
default = "ubuntu"
3934
}
40-
41-
variable "docker_distrib_codename" {
42-
type = string
43-
default = "bionic"
44-
}
45-

versions.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
21
terraform {
3-
required_version = ">= 0.12"
2+
required_providers {
3+
scaleway = {
4+
source = "scaleway/scaleway"
5+
version = "~> 2.0"
6+
}
7+
}
8+
required_version = ">= 0.13"
49
}

0 commit comments

Comments
 (0)