Skip to content

chore(docs): use smallest type for each example #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/baremetal_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data "scaleway_account_ssh_key" "main" {

resource "scaleway_baremetal_server" "base" {
zone = "fr-par-2"
offer = "GP-BM1-M"
offer = "GP-BM1-S"
os = "d17d6872-0412-45d9-a198-af82c34d3c5c"
ssh_key_ids = [data.scaleway_account_ssh_key.main]
}
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/instance_ip_reverse_dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Manages Scaleway Compute Instance IPs Reverse DNS.

```hcl
resource "scaleway_instance_ip" "server_ip" {}

resource "scaleway_instance_ip_reverse_dns" "reverse" {
ip_id = scaleway_instance_ip.server_ip.id
ip_id = scaleway_instance_ip.server_ip.id
reverse = "www.scaleway.com"
}
```
Expand Down
36 changes: 18 additions & 18 deletions docs/resources/instance_security_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ resource "scaleway_instance_security_group" "allow_all" {

resource "scaleway_instance_security_group" "web" {
inbound_default_policy = "drop" # By default we drop incoming traffic that do not match any inbound_rule

inbound_rule {
action = "accept"
port = 22
ip = "212.47.225.64"
port = 22
ip = "212.47.225.64"
}

inbound_rule {
action = "accept"
port = 80
port = 80
}

inbound_rule {
action = "accept"
protocol = "UDP"
action = "accept"
protocol = "UDP"
port_range = "22-23"
}
}
Expand All @@ -42,28 +42,28 @@ resource "scaleway_instance_security_group" "web" {

```hcl
resource "scaleway_instance_security_group" "web" {
inbound_default_policy = "drop" # By default we drop incoming traffic that do not match any inbound_rule.
inbound_default_policy = "drop" # By default we drop incoming traffic that do not match any inbound_rule.
outbound_default_policy = "drop" # By default we drop outgoing traffic that do not match any outbound_rule.

inbound_rule {
action = "drop"
ip = "1.1.1.1" # Banned IP
ip = "1.1.1.1" # Banned IP
}

inbound_rule {
action = "accept"
port = 22
ip = "212.47.225.64"
port = 22
ip = "212.47.225.64"
}

inbound_rule {
action = "accept"
port = 443
port = 443
}

outbound_rule {
action = "accept"
ip = "8.8.8.8" # Only allow outgoing connection to this IP.
ip = "8.8.8.8" # Only allow outgoing connection to this IP.
}
}
```
Expand Down
18 changes: 9 additions & 9 deletions docs/resources/instance_security_group_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ This resource can be used to externalize rules from a `scaleway_instance_securit
### Basic

```hcl
resource scaleway_instance_security_group sg01 {
external_rules = true
resource "scaleway_instance_security_group" "sg01" {
external_rules = true
}

resource scaleway_instance_security_group_rules sgrs01 {
security_group_id = scaleway_instance_security_group.sg01.id
inbound_rule {
action = "accept"
port = 80
ip_range = "0.0.0.0/0"
}
resource "scaleway_instance_security_group_rules" "sgrs01" {
security_group_id = scaleway_instance_security_group.sg01.id
inbound_rule {
action = "accept"
port = 80
ip_range = "0.0.0.0/0"
}
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/instance_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resource "scaleway_instance_volume" "data" {
}

resource "scaleway_instance_server" "web" {
type = "DEV1-L"
type = "DEV1-S"
image = "ubuntu_focal"

tags = [ "hello", "public" ]
Expand All @@ -50,7 +50,7 @@ resource "scaleway_instance_server" "web" {
resource "scaleway_instance_ip" "ip" {}

resource "scaleway_instance_server" "web" {
type = "DEV1-L"
type = "DEV1-S"
image = "f974feac-abae-4365-b988-8ec7d1cec10d"

tags = [ "hello", "public" ]
Expand Down Expand Up @@ -100,7 +100,7 @@ resource "scaleway_instance_server" "web" {

```hcl
resource "scaleway_instance_server" "web" {
type = "DEV1-L"
type = "DEV1-S"
image = "ubuntu_focal"

tags = [ "web", "public" ]
Expand Down
98 changes: 50 additions & 48 deletions docs/resources/k8s_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,91 +14,92 @@ Creates and manages Scaleway Kubernetes clusters. For more information, see [the

```hcl
resource "scaleway_k8s_cluster" "jack" {
name = "jack"
version = "1.18.0"
cni = "cilium"
name = "jack"
version = "1.19.4"
cni = "cilium"
}

resource "scaleway_k8s_pool" "john" {
cluster_id = scaleway_k8s_cluster.jack.id
name = "john"
node_type = "GP1-XS"
size = 3
name = "john"
node_type = "DEV1-M"
size = 1
}
```

### With additional configuration

```hcl
resource "scaleway_k8s_cluster" "john" {
name = "john"
description = "my awesome cluster"
version = "1.18.0"
cni = "calico"
name = "john"
description = "my awesome cluster"
version = "1.18.0"
cni = "calico"
enable_dashboard = true
ingress = "traefik"
tags = ["i'm an awsome tag", "yay"]
ingress = "traefik"
tags = ["i'm an awsome tag", "yay"]

autoscaler_config {
disable_scale_down = false
scale_down_delay_after_add = "5m"
estimator = "binpacking"
expander = "random"
ignore_daemonsets_utilization = true
balance_similar_node_groups = true
disable_scale_down = false
scale_down_delay_after_add = "5m"
estimator = "binpacking"
expander = "random"
ignore_daemonsets_utilization = true
balance_similar_node_groups = true
expendable_pods_priority_cutoff = -5
}
}

resource "scaleway_k8s_pool" "john" {
cluster_id = scaleway_k8s_cluster.john.id
name = "john"
node_type = "GP1-XS"
size = 3
cluster_id = scaleway_k8s_cluster.john.id
name = "john"
node_type = "DEV1-M"
size = 3
autoscaling = true
autohealing = true
min_size = 1
max_size = 5
min_size = 1
max_size = 5
}
```

### With the kubernetes provider

```hcl
resource "scaleway_k8s_cluster" "joy" {
name = "joy"
name = "joy"
version = "1.18.0"
cni = "flannel"
cni = "flannel"
}

resource "scaleway_k8s_pool" "john" {
cluster_id = scaleway_k8s_cluster.joy.id
name = "john"
node_type = "GP1-XS"
size = 3
name = "john"
node_type = "DEV1-M"
size = 1
}

resource "null_resource" "kubeconfig" {
depends_on = [scaleway_k8s_pool.john] # at least one pool here
triggers = {
host = scaleway_k8s_cluster.joy.kubeconfig[0].host
token = scaleway_k8s_cluster.joy.kubeconfig[0].token
cluster_ca_certificate = scaleway_k8s_cluster.joy.kubeconfig[0].cluster_ca_certificate
}
depends_on = [scaleway_k8s_pool.john] # at least one pool here
triggers = {
host = scaleway_k8s_cluster.joy.kubeconfig[0].host
token = scaleway_k8s_cluster.joy.kubeconfig[0].token
cluster_ca_certificate = scaleway_k8s_cluster.joy.kubeconfig[0].cluster_ca_certificate
}
}

provider "kubernetes" {
load_config_file = "false"

host = null_resource.kubeconfig.triggers.host
token = null_resource.kubeconfig.triggers.token
host = null_resource.kubeconfig.triggers.host
token = null_resource.kubeconfig.triggers.token
cluster_ca_certificate = base64decode(
null_resource.kubeconfig.triggers.cluster_ca_certificate
null_resource.kubeconfig.triggers.cluster_ca_certificate
)
}
```

Th `null_resource` is needed because when the cluter is created, it's status is `pool_required`, but the kubeconfig can already be downloaded. It leads the `kubernetes` provider to start creating its objects, but the DNS entry for the Kubernetes master is not yet ready, that's why it's needed to wait for at least a pool.
The `null_resource` is needed because when the cluster is created, it's status is `pool_required`, but the kubeconfig can already be downloaded.
It leads the `kubernetes` provider to start creating its objects, but the DNS entry for the Kubernetes master is not yet ready, that's why it's needed to wait for at least a pool.

## Arguments Reference

Expand Down Expand Up @@ -194,12 +195,13 @@ Before:

```hcl
resource "scaleway_k8s_cluster" "jack" {
name = "jack"
name = "jack"
version = "1.18.0"
cni = "cilium"
cni = "cilium"

default_pool {
node_type = "GP1-XS"
size = 3
node_type = "DEV1-M"
size = 1
}
}
```
Expand All @@ -208,16 +210,16 @@ After:

```hcl
resource "scaleway_k8s_cluster" "jack" {
name = "jack"
name = "jack"
version = "1.18.0"
cni = "cilium"
cni = "cilium"
}

resource "scaleway_k8s_pool" "default" {
cluster_id = scaleway_k8s_cluster.jack.id
name = "default"
node_type = "GP1-XS"
size = 3
name = "default"
node_type = "DEV1-M"
size = 1
}
```

Expand Down
24 changes: 12 additions & 12 deletions docs/resources/k8s_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ Creates and manages Scaleway Kubernetes cluster pools. For more information, see

```hcl
resource "scaleway_k8s_cluster" "jack" {
name = "jack"
version = "1.18.0"
cni = "cilium"
name = "jack"
version = "1.19.4"
cni = "cilium"
}

resource "scaleway_k8s_pool" "bill" {
cluster_id = scaleway_k8s_cluster.jack.id
name = "bill"
node_type = "GP1-S"
size = 3
min_size = 0
max_size = 10
autoscaling = true
autohealing = true
container_runtime = "docker"
cluster_id = scaleway_k8s_cluster.jack.id
name = "bill"
node_type = "DEV1-M"
size = 3
min_size = 0
max_size = 10
autoscaling = true
autohealing = true
container_runtime = "docker"
placement_group_id = "1267e3fd-a51c-49ed-ad12-857092ee3a3d"
}
```
Expand Down
16 changes: 8 additions & 8 deletions docs/resources/lb.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ resource "scaleway_lb_ip" "ip" {
}

resource "scaleway_lb" "base" {
ip_id = scaleway_lb_ip.ip.id
region = "fr-par"
type = "LB-S"
ip_id = scaleway_lb_ip.ip.id
region = "fr-par"
type = "LB-S"
}
```

Expand Down Expand Up @@ -64,8 +64,8 @@ For instance, if you had the following:

```hcl
resource "scaleway_lb" "base" {
region = "fr-par"
type = "LB-S"
region = "fr-par"
type = "LB-S"
}
```

Expand All @@ -76,9 +76,9 @@ resource "scaleway_lb_ip" "ip" {
}

resource "scaleway_lb" "base" {
ip_id = scaleway_lb_ip.ip.id
region = "fr-par"
type = "LB-S"
ip_id = scaleway_lb_ip.ip.id
region = "fr-par"
type = "LB-S"
}
```

Expand Down
Loading