diff --git a/README.md b/README.md index 7aff809..38e786d 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ You need the following permissions to run this module. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.3.0 | -| [ibm](#requirement\_ibm) | >= 1.70.0, <2.0.0 | +| [ibm](#requirement\_ibm) | >= 1.71.0, <2.0.0 | | [time](#requirement\_time) | >= 0.9.1 | ### Modules @@ -120,6 +120,7 @@ You need the following permissions to run this module. | Name | Type | |------|------| | [ibm_event_streams_schema.es_schema](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/event_streams_schema) | resource | +| [ibm_event_streams_schema_global_rule.es_globalrule](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/event_streams_schema_global_rule) | resource | | [ibm_event_streams_topic.es_topic](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/event_streams_topic) | resource | | [ibm_iam_authorization_policy.kms_policy](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/iam_authorization_policy) | resource | | [ibm_resource_instance.es_instance](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_instance) | resource | @@ -143,6 +144,7 @@ You need the following permissions to run this module. | [plan](#input\_plan) | The plan for the Event Streams instance. Possible values: `lite`, `standard`, `enterprise-3nodes-2tb`. | `string` | `"standard"` | no | | [region](#input\_region) | The region where the Event Streams are created. | `string` | `"us-south"` | no | | [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the Event Streams instance is created. | `string` | n/a | yes | +| [schema\_global\_rule](#input\_schema\_global\_rule) | Schema global compatibility rule. Only allowed for enterprise plan, must be '' for other plans. Allowed values are 'NONE', 'FULL', 'FULL\_TRANSITIVE', 'FORWARD', 'FORWARD\_TRANSITIVE', 'BACKWARD', 'BACKWARD\_TRANSITIVE'. | `string` | `""` | no | | [schemas](#input\_schemas) | The list of schema objects. Include the `schema_id` and the `type` and `name` of the schema in the `schema` object. |
list(object(| `[]` | no | | [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event streams. | `map(string)` | `{}` | no | | [service\_endpoints](#input\_service\_endpoints) | The type of service endpoints. Possible values: 'public', 'private', 'public-and-private'. | `string` | `"public"` | no | diff --git a/examples/basic/version.tf b/examples/basic/version.tf index 9279e8c..1a06bdf 100644 --- a/examples/basic/version.tf +++ b/examples/basic/version.tf @@ -3,7 +3,7 @@ terraform { required_providers { ibm = { source = "IBM-Cloud/ibm" - version = "= 1.70.0" + version = "= 1.71.0" } } } diff --git a/examples/complete/version.tf b/examples/complete/version.tf index 56d317d..5e41cfe 100644 --- a/examples/complete/version.tf +++ b/examples/complete/version.tf @@ -4,7 +4,7 @@ terraform { # Use latest version of provider in non-basic examples to verify latest version works with module ibm = { source = "IBM-Cloud/ibm" - version = ">= 1.70.0" + version = ">= 1.71.0" } } } diff --git a/examples/fscloud/main.tf b/examples/fscloud/main.tf index 7608b50..667a7c8 100644 --- a/examples/fscloud/main.tf +++ b/examples/fscloud/main.tf @@ -63,6 +63,7 @@ module "event_streams" { topics = var.topics existing_kms_instance_guid = var.existing_kms_instance_guid metrics = ["topic", "partition", "consumers"] + schema_global_rule = "FORWARD" service_credential_names = { "es_writer" : "Writer", "es_reader" : "Reader", diff --git a/examples/fscloud/version.tf b/examples/fscloud/version.tf index 29e820c..5e41cfe 100644 --- a/examples/fscloud/version.tf +++ b/examples/fscloud/version.tf @@ -4,7 +4,7 @@ terraform { # Use latest version of provider in non-basic examples to verify latest version works with module ibm = { source = "IBM-Cloud/ibm" - version = ">= 1.70.1" + version = ">= 1.71.0" } } } diff --git a/main.tf b/main.tf index 138222c..70dc0ec 100644 --- a/main.tf +++ b/main.tf @@ -26,6 +26,8 @@ locals { ) : null # tflint-ignore: terraform_unused_declarations validate_metrics = var.plan != "enterprise-3nodes-2tb" && length(var.metrics) > 0 ? tobool("metrics are only supported for enterprise plan") : true + # tflint-ignore: terraform_unused_declarations + validate_schema_global_rule = var.plan != "enterprise-3nodes-2tb" && var.schema_global_rule != "" ? tobool("schema global rule is only supported for enterprise plan") : true } # workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478 @@ -68,7 +70,7 @@ resource "ibm_resource_instance" "es_instance" { } ############################################################################## -# SCHEMA +# SCHEMA AND COMPATIBILITY RULE ############################################################################## resource "ibm_event_streams_schema" "es_schema" { @@ -78,6 +80,12 @@ resource "ibm_event_streams_schema" "es_schema" { schema = jsonencode(var.schemas[count.index].schema) } +resource "ibm_event_streams_schema_global_rule" "es_globalrule" { + count = var.schema_global_rule != "" ? 1 : 0 + resource_instance_id = ibm_resource_instance.es_instance.id + config = var.schema_global_rule +} + ############################################################################## # TOPIC ############################################################################## diff --git a/modules/fscloud/README.md b/modules/fscloud/README.md index 7605bc2..e76cc94 100644 --- a/modules/fscloud/README.md +++ b/modules/fscloud/README.md @@ -10,7 +10,7 @@ The default values in this profile were scanned by [IBM Code Risk Analyzer (CRA) | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.3.0 | -| [ibm](#requirement\_ibm) | >= 1.70.0, <2.0.0 | +| [ibm](#requirement\_ibm) | >= 1.71.0, <2.0.0 | ### Modules @@ -34,6 +34,7 @@ No resources. | [metrics](#input\_metrics) | Enhanced metrics to activate, as list of strings. Allowed values: 'topic', 'partition', 'consumers'. | `list(string)` | `[]` | no | | [region](#input\_region) | The region where the Event Streams are created. | `string` | `"us-south"` | no | | [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the Event Streams instance is created. | `string` | n/a | yes | +| [schema\_global\_rule](#input\_schema\_global\_rule) | Schema global compatibility rule. Only allowed for enterprise plan, must be '' for other plans. Allowed values are 'NONE', 'FULL', 'FULL\_TRANSITIVE', 'FORWARD', 'FORWARD\_TRANSITIVE', 'BACKWARD', 'BACKWARD\_TRANSITIVE'. | `string` | `""` | no | | [schemas](#input\_schemas) | The list of schema objects. Include the `schema_id` and the `type` and `name` of the schema in the `schema` object. |
{
schema_id = string
schema = object({
type = string
name = string
fields = optional(list(object({
name = string
type = string
})))
})
}
))
list(object(| `[]` | no | | [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event streams. | `map(string)` | `{}` | no | | [tags](#input\_tags) | The list of tags associated with the Event Steams instance. | `list(string)` | `[]` | no | diff --git a/modules/fscloud/main.tf b/modules/fscloud/main.tf index fb58a44..b6cb4bd 100644 --- a/modules/fscloud/main.tf +++ b/modules/fscloud/main.tf @@ -7,6 +7,7 @@ module "event_streams" { kms_key_crn = var.kms_key_crn existing_kms_instance_guid = var.existing_kms_instance_guid schemas = var.schemas + schema_global_rule = var.schema_global_rule tags = var.tags access_tags = var.access_tags topics = var.topics diff --git a/modules/fscloud/variables.tf b/modules/fscloud/variables.tf index 1be0c4b..41466c8 100644 --- a/modules/fscloud/variables.tf +++ b/modules/fscloud/variables.tf @@ -46,6 +46,16 @@ variable "schemas" { default = [] } +variable "schema_global_rule" { + type = string + description = "Schema global compatibility rule. Only allowed for enterprise plan, must be '' for other plans. Allowed values are 'NONE', 'FULL', 'FULL_TRANSITIVE', 'FORWARD', 'FORWARD_TRANSITIVE', 'BACKWARD', 'BACKWARD_TRANSITIVE'." + default = "" + validation { + condition = contains(["", "NONE", "FULL", "FULL_TRANSITIVE", "FORWARD", "FORWARD_TRANSITIVE", "BACKWARD", "BACKWARD_TRANSITIVE"], var.schema_global_rule) + error_message = "The schema_global_rule must be one of '', 'NONE', 'FULL', 'FULL_TRANSITIVE', 'FORWARD', 'FORWARD_TRANSITIVE', 'BACKWARD', 'BACKWARD_TRANSITIVE'." + } +} + variable "topics" { type = list(object( { diff --git a/modules/fscloud/version.tf b/modules/fscloud/version.tf index 5383f9a..bc2af96 100644 --- a/modules/fscloud/version.tf +++ b/modules/fscloud/version.tf @@ -7,7 +7,7 @@ terraform { # tflint-ignore: terraform_unused_required_providers ibm = { source = "IBM-Cloud/ibm" - version = ">= 1.70.0, <2.0.0" + version = ">= 1.71.0, <2.0.0" } } } diff --git a/variables.tf b/variables.tf index 1e5c64d..ab587fa 100644 --- a/variables.tf +++ b/variables.tf @@ -105,6 +105,16 @@ variable "schemas" { default = [] } +variable "schema_global_rule" { + type = string + description = "Schema global compatibility rule. Only allowed for enterprise plan, must be '' for other plans. Allowed values are 'NONE', 'FULL', 'FULL_TRANSITIVE', 'FORWARD', 'FORWARD_TRANSITIVE', 'BACKWARD', 'BACKWARD_TRANSITIVE'." + default = "" + validation { + condition = contains(["", "NONE", "FULL", "FULL_TRANSITIVE", "FORWARD", "FORWARD_TRANSITIVE", "BACKWARD", "BACKWARD_TRANSITIVE"], var.schema_global_rule) + error_message = "The schema_global_rule must be one of '', 'NONE', 'FULL', 'FULL_TRANSITIVE', 'FORWARD', 'FORWARD_TRANSITIVE', 'BACKWARD', 'BACKWARD_TRANSITIVE'." + } +} + variable "topics" { type = list(object( { diff --git a/version.tf b/version.tf index e8ac7f0..ae953f3 100644 --- a/version.tf +++ b/version.tf @@ -4,7 +4,7 @@ terraform { # Use "greater than or equal to" range in modules ibm = { source = "IBM-Cloud/ibm" - version = ">= 1.70.0, <2.0.0" + version = ">= 1.71.0, <2.0.0" } time = { source = "hashicorp/time"
{
schema_id = string
schema = object({
type = string
name = string
fields = optional(list(object({
name = string
type = string
})))
})
}
))