Skip to content

Commit 4bcbef5

Browse files
authored
feat: Support has been added for adding and removing a topic and quota at any index of the topics and quotas input variable lists. Previously, it was only possible to add or remove topics and quotas at the end of the list. (#350)
BREAKING CHANGE: When upgrading from a previous version, if you configure topics, run the following Terraform move commands based on your environment to avoid recreating the topics: - Terraform CLI ```sh terraform state mv 'module.<module-name>.ibm_event_streams_topic.es_topic[<index of topic-name-1>]' 'module.<module-name>.ibm_event_streams_topic.es_topic["<topics-name-1>"]' ... ``` - Schematics ``` ibmcloud schematics workspace state mv --id <workspace-id> --source 'module.<module-name>.ibm_event_streams_topic.es_topic[<index of topic-name-1>]' --destination 'module.<module-name>.ibm_event_streams_topic.es_topic["<topic-name-1>"]' ... ``` Similarly if you configure quotas, run the following commands: - Terraform CLI ```sh terraform state mv 'ibm_event_streams_quota.eventstreams_quotas[<index of quota-entity-1>]' 'ibm_event_streams_quota.eventstreams_quotas["<quota-entity-1>"]' ... ``` - Schematics ``` ibmcloud schematics workspace state mv --id <workspace-id> --source 'ibm_event_streams_quota.eventstreams_quotas[<index of quota-entity-1>]' --destination 'ibm_event_streams_quota.eventstreams_quotas["<quota-entity-1>"]' ... ```
1 parent 3b10a87 commit 4bcbef5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.secrets.baseline

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2023-12-10T12:42:07Z",
6+
"generated_at": "2023-12-11T12:42:07Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

main.tf

+8-8
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ resource "ibm_event_streams_schema_global_rule" "es_globalrule" {
100100
##############################################################################
101101

102102
resource "ibm_event_streams_topic" "es_topic" {
103-
count = length(var.topics)
103+
for_each = { for topic in var.topics : topic.name => topic }
104104
resource_instance_id = ibm_resource_instance.es_instance.id
105-
name = var.topics[count.index].name
106-
partitions = var.topics[count.index].partitions
107-
config = var.topics[count.index].config
105+
name = each.value.name
106+
partitions = each.value.partitions
107+
config = each.value.config
108108
}
109109

110110
##############################################################################
@@ -122,11 +122,11 @@ resource "ibm_resource_tag" "es_access_tag" {
122122
##############################################################################
123123

124124
resource "ibm_event_streams_quota" "eventstreams_quotas" {
125-
count = length(var.quotas)
125+
for_each = { for quota in var.quotas : quota.entity => quota }
126126
resource_instance_id = ibm_resource_instance.es_instance.id
127-
entity = var.quotas[count.index].entity
128-
producer_byte_rate = var.quotas[count.index].producer_byte_rate
129-
consumer_byte_rate = var.quotas[count.index].consumer_byte_rate
127+
entity = each.value.entity
128+
producer_byte_rate = each.value.producer_byte_rate
129+
consumer_byte_rate = each.value.consumer_byte_rate
130130
}
131131

132132
##############################################################################

0 commit comments

Comments
 (0)