Scylla Cloud has multiple storage size options available for the same node_type attributes that currently cannot be selected in the case of the GCP provider. For example, n2-highmem-8 has five distinct storage size options: 375, 750, 1500, 3000, and 6000.
This pull request adds an optional node_disk_size attribute that gives the ability to select other storage options.
[!IMPORTANT] node_disk_size must match exactly. If there's no instance with a particular, storage size option, the operation will fail.
Discussion and decisions leading to this implementation can be found in the internal issue with reference number 10003.
How Has This Been Tested?
1. New functionality
As GCP has multiple storage options for the same instance name, I've fetched the list of instances for us-west-1 region and decided to pick one with 2+ storage options: n2-highmem-4:
3. Fail to create infrastructure with the same definition but with the `node_disk_size = 1234` attribute that doesn't match any particular `n2-highmem-4` instance:
$ terraform apply
...
╷
│ Error: unrecognized value combination: "n2-highmem-4" for "node_type" and 1234 for "node_disk_size" attributes
│
│ with scylladbcloud_cluster.test,
│ on test.tf line 16, in resource "scylladbcloud_cluster" "test":
│ 16: resource "scylladbcloud_cluster" "test" {
│
╵
### 2. Terraform provider upgrade
1. Create infrastructure with the following definition using `v1.5.0` of `terraform-provider-scylladbcloud`:
```hcl
terraform {
required_providers {
scylladbcloud = {
source = "registry.terraform.io/scylladb/scylladbcloud"
}
}
}
provider "scylladbcloud" {
endpoint = "***"
token = "***"
}
resource "scylladbcloud_cluster" "test" {
name = "test-cluster"
cloud = "AWS"
region = "us-east-1"
node_count = 3
node_type = "t3.micro"
cidr_block = "172.31.0.0/16"
enable_vpc_peering = true
enable_dns = true
}
Override provider with one from this particular pull request branch using .terraformrc and dev_overrides.
Invoke TF_CLI_CONFIG_FILE=.terraformrc terraform apply and diff the terraform.tfstate file; observe how the node_disk_size attribute (which was absent before) is reflecting the actual disk size:
Motivation and Context
Scylla Cloud has multiple storage size options available for the same
node_type
attributes that currently cannot be selected in the case of theGCP
provider. For example,n2-highmem-8
has five distinct storage size options: 375, 750, 1500, 3000, and 6000.This pull request adds an optional
node_disk_size
attribute that gives the ability to select other storage options.Discussion and decisions leading to this implementation can be found in the internal issue with reference number 10003.
How Has This Been Tested?
1. New functionality
As GCP has multiple storage options for the same instance name, I've fetched the list of instances for
us-west-1
region and decided to pick one with 2+ storage options:n2-highmem-4
:provider "scylladbcloud" { endpoint = "" token = "" }
resource "scylladbcloud_cluster" "test" { for_each = toset([ "375", "750" ])
name = "test-cluster-${each.key}" cloud = "GCP" region = "us-west1" node_count = 3 node_type = "n2-highmem-4" cidr_block = "172.31.0.0/16" node_disk_size = each.key
enable_vpc_peering = true enable_dns = true }
$ curl -s -X GET "https://$API_HOST/account/$API_ACCOUNT_ID/clusters?enriched=true" --header "Authorization: Bearer $API_TOKEN" | jq -r '.data.clusters[] | [.clusterName, .instance.id, .instance.externalId, .instance.totalStorage] | @tsv' test-cluster-750 41 n2-highmem-4 750 test-cluster-375 48 n2-highmem-4 375
$ terraform apply
...
╷ │ Error: unrecognized value combination: "n2-highmem-4" for "node_type" and 1234 for "node_disk_size" attributes │ │ with scylladbcloud_cluster.test, │ on test.tf line 16, in resource "scylladbcloud_cluster" "test": │ 16: resource "scylladbcloud_cluster" "test" { │ ╵
.terraformrc
anddev_overrides
.TF_CLI_CONFIG_FILE=.terraformrc terraform apply
and diff theterraform.tfstate
file; observe how thenode_disk_size
attribute (which was absent before) is reflecting the actual disk size: