Skip to content

Commit 84578ea

Browse files
feat: add support for 8.10 (#53)
1 parent fbbfb20 commit 84578ea

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ You need the following permissions to run this module.
8484
| <a name="input_auto_scaling"></a> [auto\_scaling](#input\_auto\_scaling) | Optional rules to allow the database to increase resources in response to usage. Only a single autoscaling block is allowed. Make sure you understand the effects of autoscaling, especially for production environments. See https://cloud.ibm.com/docs/databases-for-elasticsearch?topic=databases-for-elasticsearch-autoscaling in the IBM Cloud Docs. | <pre>object({<br> disk = object({<br> capacity_enabled = optional(bool, false)<br> free_space_less_than_percent = optional(number, 10)<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 3670016)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> memory = object({<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 114688)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> })</pre> | `null` | no |
8585
| <a name="input_backup_encryption_key_crn"></a> [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn) | The CRN of a Key Protect key, that you want to use for encrypting disk that holds deployment backups. Only used if var.kms\_encryption\_enabled is set to true. If no value is passed here, the value passed for the 'kms\_key\_crn' variable is used, unless 'use\_default\_backup\_encryption\_key' is set to 'true'. BYOK for backups is available only in US regions us-south and us-east, and eu-de. Only keys in the us-south and eu-de are durable to region failures. To ensure that your backups are available even if a region failure occurs, you must use a key from us-south or eu-de. Take note that Hyper Protect Crypto Services for IBM Cloud® Databases backups is not currently supported, so if no value is passed here, but a HPCS value is passed for var.kms\_key\_crn, databases backup encryption will use the default encryption keys. | `string` | `null` | no |
8686
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR rules to create | <pre>list(object({<br> description = string<br> account_id = string<br> rule_contexts = list(object({<br> attributes = optional(list(object({<br> name = string<br> value = string<br> }))) }))<br> enforcement_mode = string<br> }))</pre> | `[]` | no |
87-
| <a name="input_elasticsearch_version"></a> [elasticsearch\_version](#input\_elasticsearch\_version) | Version of Elasticsearch to deploy | `string` | `null` | no |
87+
| <a name="input_elasticsearch_version"></a> [elasticsearch\_version](#input\_elasticsearch\_version) | Version of Elasticsearch to deploy, must be 8.7, 8.10 or 7.17 (Enterprise plan only or Platinum if 8.10 or above). If no value passed, the current ICD preferred version is used. | `string` | `null` | no |
8888
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect or Key Protect instance in which the key specified in var.kms\_key\_crn and var.backup\_encryption\_key\_crn is coming from. Only required if var.kms\_encryption\_enabled is 'true', var.skip\_iam\_authorization\_policy is 'false', and passing a value for var.kms\_key\_crn and/or var.backup\_encryption\_key\_crn. | `string` | `null` | no |
8989
| <a name="input_kms_encryption_enabled"></a> [kms\_encryption\_enabled](#input\_kms\_encryption\_enabled) | Set this to true to control the encryption keys used to encrypt the data that you store in IBM Cloud® Databases. If set to false, the data is encrypted by using randomly generated keys. For more info on Key Protect integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect. For more info on HPCS integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs | `bool` | `false` | no |
9090
| <a name="input_kms_key_crn"></a> [kms\_key\_crn](#input\_kms\_key\_crn) | The root key CRN of a Key Management Services like Key Protect or Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. Only used if var.kms\_encryption\_enabled is set to true. | `string` | `null` | no |

tests/other_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
package test
33

44
import (
5+
"crypto/rand"
6+
"encoding/base64"
7+
"github.com/gruntwork-io/terratest/modules/terraform"
58
"testing"
69

710
"github.com/stretchr/testify/assert"
@@ -23,3 +26,44 @@ func TestRunBasicExample(t *testing.T) {
2326
assert.Nil(t, err, "This should not have errored")
2427
assert.NotNil(t, output, "Expected some output")
2528
}
29+
30+
func TestRunCompleteExampleOtherVersion(t *testing.T) {
31+
t.Parallel()
32+
33+
// Generate a 15 char long random string for the admin_pass
34+
randomBytes := make([]byte, 12)
35+
_, err := rand.Read(randomBytes)
36+
randomPass := "A1" + base64.URLEncoding.EncodeToString(randomBytes)[:13]
37+
38+
options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
39+
Testing: t,
40+
TerraformDir: completeExampleTerraformDir,
41+
Prefix: "es-complete-test",
42+
ResourceGroup: resourceGroup,
43+
BestRegionYAMLPath: regionSelectionPath,
44+
TerraformVars: map[string]interface{}{
45+
"elasticsearch_version": "8.7",
46+
"existing_sm_instance_guid": permanentResources["secretsManagerGuid"],
47+
"existing_sm_instance_region": permanentResources["secretsManagerRegion"],
48+
"users": []map[string]interface{}{
49+
{
50+
"name": "testuser",
51+
"password": randomPass, // pragma: allowlist secret
52+
"type": "database",
53+
},
54+
},
55+
"admin_pass": randomPass,
56+
},
57+
})
58+
options.SkipTestTearDown = true
59+
output, err := options.RunTestConsistency()
60+
assert.Nil(t, err, "This should not have errored")
61+
assert.NotNil(t, output, "Expected some output")
62+
63+
// check if outputs exist
64+
outputs := terraform.OutputAll(options.Testing, options.TerraformOptions)
65+
expectedOutputs := []string{"port", "hostname"}
66+
_, outputErr := testhelper.ValidateTerraformOutputs(outputs, expectedOutputs...)
67+
assert.NoErrorf(t, outputErr, "Some outputs not found or nil")
68+
options.TestTearDown()
69+
}

tests/pr_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ func TestMain(m *testing.M) {
4242
func TestRunCompleteExample(t *testing.T) {
4343
t.Parallel()
4444

45-
// Generate a 10 char long random string for the admin_pass
46-
randomBytes := make([]byte, 10)
45+
// Generate a 15 char long random string for the admin_pass
46+
randomBytes := make([]byte, 12)
4747
_, err := rand.Read(randomBytes)
48-
randomPass := "A" + base64.URLEncoding.EncodeToString(randomBytes)[:10]
48+
randomPass := "A1" + base64.URLEncoding.EncodeToString(randomBytes)[:13]
4949

5050
options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
5151
Testing: t,
@@ -54,6 +54,7 @@ func TestRunCompleteExample(t *testing.T) {
5454
ResourceGroup: resourceGroup,
5555
BestRegionYAMLPath: regionSelectionPath,
5656
TerraformVars: map[string]interface{}{
57+
"elasticsearch_version": "8.10",
5758
"existing_sm_instance_guid": permanentResources["secretsManagerGuid"],
5859
"existing_sm_instance_region": permanentResources["secretsManagerRegion"],
5960
"users": []map[string]interface{}{

variables.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ variable "service_endpoints" {
3737

3838
variable "elasticsearch_version" {
3939
type = string
40-
description = "Version of Elasticsearch to deploy"
40+
description = "Version of Elasticsearch to deploy, must be 8.7, 8.10 or 7.17 (Enterprise plan only or Platinum if 8.10 or above). If no value passed, the current ICD preferred version is used."
4141
default = null
4242
validation {
4343
condition = anytrue([
4444
var.elasticsearch_version == null,
4545
var.elasticsearch_version == "8.7",
46+
var.elasticsearch_version == "8.10",
4647
var.elasticsearch_version == "7.17",
4748
])
48-
error_message = "Version must be 8.7 or 7.17 (Enterprise plan only). If no value passed, the current ICD preferred version is used."
49+
error_message = "Version must be 8.7, 8.10 or 7.17 (Enterprise plan only or Platinum if 8.10 or above). If no value passed, the current ICD preferred version is used."
4950
}
5051
}
5152

@@ -56,8 +57,9 @@ variable "plan" {
5657
validation {
5758
condition = anytrue([
5859
var.plan == "enterprise",
60+
var.plan == "platinum",
5961
])
60-
error_message = "Only supported plan is enterprise"
62+
error_message = "Only supported plan is enterprise, or platinum if var.elasticsearch_version is set to 8.10 or above"
6163
}
6264
}
6365

0 commit comments

Comments
 (0)