From 9a774d2f63f2b3e0f5ed7841af9a80a54cafa0b8 Mon Sep 17 00:00:00 2001 From: Benjamin Kircher Date: Thu, 8 Apr 2021 15:43:24 +0200 Subject: [PATCH] Update new resource examples Fix up formatting. Add a few notes from QA session with Ibrahim and Tom. --- managed-k8s/cluster-new.tf | 22 ------------------ managed-k8s/cluster.tf | 47 +++++++++++++------------------------- postgresql/.envrc | 3 +++ postgresql/postgres.tf | 23 ++++++++++++------- 4 files changed, 34 insertions(+), 61 deletions(-) delete mode 100644 managed-k8s/cluster-new.tf create mode 100644 postgresql/.envrc diff --git a/managed-k8s/cluster-new.tf b/managed-k8s/cluster-new.tf deleted file mode 100644 index 0580f6f..0000000 --- a/managed-k8s/cluster-new.tf +++ /dev/null @@ -1,22 +0,0 @@ -terraform { - required_providers { - gridscale = { - source = "gridscale/gridscale" - version = "~> 1.9.0" - } - } -} - -resource "gridscale_k8s" "k8s-test" { - name = "test" - # K8s service release. Define which release of k8s service will be used to create the k8s cluster. For convenience, please use gscloud to get the list of available k8s release numbers. - release = "1.18" - node_pool { - name = "my_node_pool" - node_count = 2 - cores = 1 - memory = 2 - storage = 10 - storage_type = "storage_insane" - } - } \ No newline at end of file diff --git a/managed-k8s/cluster.tf b/managed-k8s/cluster.tf index 0272035..a348053 100644 --- a/managed-k8s/cluster.tf +++ b/managed-k8s/cluster.tf @@ -2,40 +2,25 @@ terraform { required_providers { gridscale = { source = "gridscale/gridscale" - version = "~> 1.8.0" + version = "~> 1.9.0" } } } -resource "gridscale_paas" "cluster" { - name = "mycluster" - service_template_uuid = "22e93afb-6b9d-4524-98a4-6580169f76b1" # Kubernetes (Gen 1) 1.19.4-gs1 - timeouts { - create = "20m" - } - parameter { - param = "k8s_worker_node_count" - type = "int" - value = "3" - } - parameter { - param = "k8s_worker_node_cores" - type = "int" - value = "2" - } - parameter { - param = "k8s_worker_node_ram" - type = "int" - value = "4" - } - parameter { - param = "k8s_worker_node_storage" - type = "int" - value = "30" - } - parameter { - param = "k8s_worker_node_storage_type" - type = "string" - value = "storage" +resource "gridscale_k8s" "my_cluster" { + name = "my_cluster" + + # Define the desired Kubernetes release. Define which release of GSK will be + # used for the cluster. For convenience, please use gscloud to get the list of + # available Kubernetes releases. + release = "1.17" + + node_pool { + name = "my_node_pool" + node_count = 2 + cores = 1 + memory = 2 + storage = 30 + storage_type = "storage_insane" } } diff --git a/postgresql/.envrc b/postgresql/.envrc new file mode 100644 index 0000000..c1fa7a2 --- /dev/null +++ b/postgresql/.envrc @@ -0,0 +1,3 @@ +export GRIDSCALE_TOKEN=your-api-token +export GRIDSCALE_URL=https://api.gridscale.io +export GRIDSCALE_UUID=your-user-id diff --git a/postgresql/postgres.tf b/postgresql/postgres.tf index c18593b..9bf5d50 100644 --- a/postgresql/postgres.tf +++ b/postgresql/postgres.tf @@ -7,13 +7,20 @@ terraform { } } -resource "gridscale_postgresql" "terra-postgres-test" { +resource "gridscale_postgresql" "my_postgres_cluster" { name = "test" - # The PostgreSQL release of this instance. For convenience, please use gscloud (https://github.com/gridscale/gscloud) to get the list of available postgreSQL service releases. - release = "13" - # Performance class of postgreSQL service. Available performance classes at the time of writing: `standard`, `high`, `insane`, `ultra`. - performance_class = "standard" - # Maximum CPU core count. The PostgreSQL instance's CPU core count will be autoscaled based on the workload. - # The number of cores stays between 1 and `max_core_count`. + + # The PostgreSQL release of this instance. For convenience, please use gscloud + # (https://github.com/gridscale/gscloud) to get the list of available + # PostgreSQL releases. + release = "12" + + # Performance class of the PaaS service. Available performance classes at + # the time of writing are `standard`, `high`, `insane`, `ultra`. + performance_class = "insane" + + # Maximum CPU core count. The PostgreSQL instance's CPU core count will be + # autoscaled based on the workload. The number of cores stays between 1 and + # `max_core_count`. max_core_count = 20 -} \ No newline at end of file +}