Skip to content

Commit edb31e0

Browse files
authored
feat: expose append_random_bucket_name_suffix variable to append random generated suffix to the bucket names <br> **IMPORTANT** : When updating from a previous version the buckets will be recreated, to prevent re-creation of the buckets set append_random_bucket_name_suffix to false(#147)
1 parent d6002dc commit edb31e0

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

ibm_catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@
223223
{
224224
"key": "cloud_logs_metrics_cos_bucket_name"
225225
},
226+
{
227+
"key": "append_random_bucket_name_suffix"
228+
},
226229
{
227230
"key": "cloud_logs_cos_buckets_class",
228231
"options": [
@@ -746,6 +749,9 @@
746749
{
747750
"key": "cloud_logs_metrics_cos_bucket_name"
748751
},
752+
{
753+
"key": "append_random_bucket_name_suffix"
754+
},
749755
{
750756
"key": "cloud_logs_cos_buckets_class",
751757
"options": [

solutions/fully-configurable/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ module "buckets" {
104104
kms_encryption_enabled = var.kms_encryption_enabled_buckets
105105
region_location = var.region
106106
resource_instance_id = var.existing_cos_instance_crn
107+
add_bucket_name_suffix = var.append_random_bucket_name_suffix
107108
management_endpoint_type = var.management_endpoint_type_for_buckets
108109
storage_class = var.cloud_logs_cos_buckets_class
109110
force_delete = true # If this is set to false, and the bucket contains data, the destroy will fail. Setting it to false on destroy has no impact, it has to be set on apply, so hence hard coding to true."
@@ -125,6 +126,7 @@ module "buckets" {
125126
kms_encryption_enabled = var.kms_encryption_enabled_buckets
126127
region_location = var.region
127128
resource_instance_id = var.existing_cos_instance_crn
129+
add_bucket_name_suffix = var.append_random_bucket_name_suffix
128130
management_endpoint_type = var.management_endpoint_type_for_buckets
129131
storage_class = var.cloud_logs_cos_buckets_class
130132
skip_iam_authorization_policy = true

solutions/fully-configurable/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ output "metrics_bucket_crn" {
4444

4545
output "logs_bucket_name" {
4646
description = "Logs Cloud Object Storage bucket name"
47-
value = local.data_bucket_name
47+
value = module.buckets.buckets[local.data_bucket_name].bucket_name
4848
}
4949

5050
output "metrics_bucket_name" {
5151
description = "Metrics Cloud Object Storage bucket name"
52-
value = local.metrics_bucket_name
52+
value = module.buckets.buckets[local.metrics_bucket_name].bucket_name
5353
}
5454

5555
output "kms_key_crn" {

solutions/fully-configurable/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ variable "cloud_logs_data_cos_bucket_name" {
8686
description = "The name of an to be given to a new bucket inside the existing Object Storage instance to use for IBM Cloud Logs. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
8787
}
8888

89+
variable "append_random_bucket_name_suffix" {
90+
type = bool
91+
description = "Append random generated suffix (4 characters long) to the newly provisioned IBM Cloud Logs Object Storage bucket names."
92+
default = true
93+
}
94+
8995
variable "cloud_logs_metrics_cos_bucket_name" {
9096
type = string
9197
nullable = true

solutions/security-enforced/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module "security_enforced" {
2525
kms_endpoint_type = "private"
2626
cloud_logs_cos_key_ring_name = var.cloud_logs_cos_key_ring_name
2727
cloud_logs_cos_key_name = var.cloud_logs_cos_key_name
28+
append_random_bucket_name_suffix = var.append_random_bucket_name_suffix
2829
existing_event_notifications_instances = var.existing_event_notifications_instances
2930
skip_logs_routing_auth_policy = var.skip_logs_routing_auth_policy
3031
logs_routing_tenant_regions = var.logs_routing_tenant_regions

solutions/security-enforced/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ variable "cloud_logs_metrics_cos_bucket_name" {
6565
description = "The name of an to be given to a new bucket inside the existing Object Storage instance to use for Cloud Logs. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
6666
}
6767

68+
variable "append_random_bucket_name_suffix" {
69+
type = bool
70+
description = "Append random generated suffix (4 characters long) to the newly provisioned IBM Cloud Logs Object Storage bucket names."
71+
default = true
72+
}
73+
6874
variable "cloud_logs_cos_buckets_class" {
6975
type = string
7076
default = "smart"

0 commit comments

Comments
 (0)