diff --git a/README.md b/README.md index f4db87082..004073138 100644 --- a/README.md +++ b/README.md @@ -916,7 +916,7 @@ module "cluster_pattern" { | [appid](#input\_appid) | The App ID instance to be used for the teleport vsi deployments |
object({
name = optional(string)
resource_group = optional(string)
use_data = optional(bool)
keys = optional(list(string))
use_appid = bool
}) | {
"use_appid": false
} | no |
| [atracker](#input\_atracker) | atracker variables | object({
resource_group = string
receive_global_events = bool
collector_bucket_name = string
add_route = bool
}) | n/a | yes |
| [clusters](#input\_clusters) | A list describing clusters workloads to create | list(| n/a | yes | -| [cos](#input\_cos) | Object describing the cloud object storage instance, buckets, and keys. Set `use_data` to false to create instance |
object({
name = string # Name of Cluster
vpc_name = string # Name of VPC
subnet_names = list(string) # List of vpc subnets for cluster
workers_per_subnet = number # Worker nodes per subnet.
machine_type = string # Worker node flavor
kube_type = string # iks or openshift
kube_version = optional(string) # Can be a version from `ibmcloud ks versions` or `default`
entitlement = optional(string) # entitlement option for openshift
secondary_storage = optional(string) # Secondary storage type
pod_subnet = optional(string) # Portable subnet for pods
service_subnet = optional(string) # Portable subnet for services
resource_group = string # Resource Group used for cluster
cos_name = optional(string) # Name of COS instance Required only for OpenShift clusters
access_tags = optional(list(string), [])
boot_volume_crk_name = optional(string) # Boot volume encryption key name
disable_public_endpoint = optional(bool, true) # disable cluster public, leaving only private endpoint
disable_outbound_traffic_protection = optional(bool, false) # public outbound access from the cluster workers
cluster_force_delete_storage = optional(bool, false) # force the removal of persistent storage associated with the cluster during cluster deletion
operating_system = string # The operating system of the workers in the default worker pool. See https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions#openshift_versions_available .
kms_wait_for_apply = optional(bool, true) # make terraform wait until KMS is applied to master and it is ready and deployed
verify_cluster_network_readiness = optional(bool, true) # Flag to run a script will run kubectl commands to verify that all worker nodes can communicate successfully with the master. If the runtime does not have access to the kube cluster to run kubectl commands, this should be set to false.
use_ibm_cloud_private_api_endpoints = optional(bool, true) # Flag to force all cluster related api calls to use the IBM Cloud private endpoints.
allow_default_worker_pool_replacement = optional(bool) # (Advanced users) Set to true to allow the module to recreate a default worker pool. If you wish to make any change to the default worker pool which requires the re-creation of the default pool follow these [steps](https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc?tab=readme-ov-file#important-considerations-for-terraform-and-default-worker-pool).
labels = optional(map(string)) # A list of labels that you want to add to the default worker pool.
enable_ocp_console = optional(bool) # Flag to specify whether to enable or disable the OpenShift console. If set to `null` the module will not modify the setting currently set on the cluster. Bare in mind when setting this to `true` or `false` on a cluster with private only endpoint enabled, the runtime must be able to access the private endpoint.
addons = optional(object({ # Map of OCP cluster add-on versions to install
debug-tool = optional(string)
image-key-synchronizer = optional(string)
openshift-data-foundation = optional(string)
vpc-file-csi-driver = optional(string)
static-route = optional(string)
cluster-autoscaler = optional(string)
vpc-block-csi-driver = optional(string)
ibm-storage-operator = optional(string)
}), {})
manage_all_addons = optional(bool, false) # Instructs Terraform to manage all cluster addons, even if addons were installed outside of the module. If set to 'true' this module will destroy any addons that were installed by other sources.
kms_config = optional(
object({
crk_name = string # Name of key
private_endpoint = optional(bool) # Private endpoint
})
)
worker_pools = optional(
list(
object({
name = string # Worker pool name
vpc_name = string # VPC name
workers_per_subnet = number # Worker nodes per subnet
flavor = string # Worker node flavor
subnet_names = list(string) # List of vpc subnets for worker pool
entitlement = optional(string) # entitlement option for openshift
secondary_storage = optional(string) # Secondary storage type
boot_volume_crk_name = optional(string) # Boot volume encryption key name
operating_system = string # The operating system of the workers in the worker pool. See https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions#openshift_versions_available .
labels = optional(map(string)) # A list of labels that you want to add to all the worker nodes in the worker pool.
})
)
)
})
)
list(| n/a | yes | +| [cos](#input\_cos) | Object describing the cloud object storage instance, buckets, and keys. Set `use_data` to false to create instance |
object({
name = string
use_data = optional(bool)
resource_group = string
plan = optional(string)
random_suffix = optional(bool) # Use a random suffix for COS instance
access_tags = optional(list(string), [])
skip_kms_s2s_auth_policy = optional(bool, false) # skip auth policy between this instance and kms instance, useful if existing resources are used
skip_flowlogs_s2s_auth_policy = optional(bool, false) # skip auth policy between flow logs service and this instance, set to true if this policy is already in place on account
skip_atracker_s2s_auth_policy = optional(bool, false) # skip auth policyt between atracker service and this instance, set to true if this is existing recipient of atracker already
buckets = list(object({
name = string
storage_class = string
endpoint_type = string
force_delete = bool
single_site_location = optional(string)
region_location = optional(string)
cross_region_location = optional(string)
kms_key = optional(string)
access_tags = optional(list(string), [])
allowed_ip = optional(list(string), [])
hard_quota = optional(number)
archive_rule = optional(object({
days = number
archive_filter_prefix = optional(string)
enable = bool
rule_id = optional(string)
type = string
}))
expire_rule = optional(object({
days = optional(number)
expire_filter_prefix = optional(string)
date = optional(string)
enable = bool
expired_object_delete_marker = optional(string)
prefix = optional(string)
rule_id = optional(string)
}))
activity_tracking = optional(object({
activity_tracker_crn = string
read_data_events = bool
write_data_events = bool
management_events = bool
}))
metrics_monitoring = optional(object({
metrics_monitoring_crn = string
request_metrics_enabled = optional(bool)
usage_metrics_enabled = optional(bool)
}))
}))
keys = optional(
list(object({
name = string
role = string
enable_HMAC = bool
}))
)
})
)
list(| n/a | yes | | [enable\_transit\_gateway](#input\_enable\_transit\_gateway) | Create transit gateway | `bool` | `true` | no | | [existing\_vpc\_cbr\_zone\_id](#input\_existing\_vpc\_cbr\_zone\_id) | ID of the existing CBR (Context-based restrictions) network zone, with context set to the VPC. This zone is used in a CBR rule, which allows traffic to flow only from the landing zone VPCs to specific cloud services. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/blob/main/patterns/DA-cbr-tutorial.md). | `string` | `null` | no | | [f5\_template\_data](#input\_f5\_template\_data) | Data for all f5 templates |
object({
name = string
use_data = optional(bool)
resource_group = string
plan = optional(string)
random_suffix = optional(bool) # Use a random suffix for COS instance
access_tags = optional(list(string), [])
skip_kms_s2s_auth_policy = optional(bool, false) # skip auth policy between this instance and kms instance, useful if existing resources are used
skip_flowlogs_s2s_auth_policy = optional(bool, false) # skip auth policy between flow logs service and this instance, set to true if this policy is already in place on account
skip_atracker_s2s_auth_policy = optional(bool, false) # skip auth policyt between atracker service and this instance, set to true if this is existing recipient of atracker already
buckets = list(object({
name = string
storage_class = string
endpoint_type = string
force_delete = bool
single_site_location = optional(string)
region_location = optional(string)
cross_region_location = optional(string)
kms_key = optional(string)
access_tags = optional(list(string), [])
allowed_ip = optional(list(string), [])
hard_quota = optional(number)
archive_rule = optional(object({
days = number
archive_filter_prefix = optional(string)
enable = bool
rule_id = optional(string)
type = string
}))
expire_rule = optional(object({
days = optional(number)
expire_filter_prefix = optional(string)
date = optional(string)
enable = bool
expired_object_delete_marker = optional(string)
prefix = optional(string)
rule_id = optional(string)
}))
activity_tracking = optional(object({
activity_tracker_crn = string
read_data_events = bool
write_data_events = bool
management_events = bool
}))
metrics_monitoring = optional(object({
metrics_monitoring_crn = string
request_metrics_enabled = optional(bool)
usage_metrics_enabled = optional(bool)
}))
retention_rule = optional(object({
default = number
maximum = number
minimum = number
permanent = optional(bool)
}))
}))
keys = optional(
list(object({
name = string
role = string
enable_HMAC = bool
}))
)
})
)
object({
tmos_admin_password = optional(string)
license_type = optional(string)
byol_license_basekey = optional(string)
license_host = optional(string)
license_username = optional(string)
license_password = optional(string)
license_pool = optional(string)
license_sku_keyword_1 = optional(string)
license_sku_keyword_2 = optional(string)
license_unit_of_measure = optional(string)
do_declaration_url = optional(string)
as3_declaration_url = optional(string)
ts_declaration_url = optional(string)
phone_home_url = optional(string)
template_source = optional(string)
template_version = optional(string)
app_id = optional(string)
tgactive_url = optional(string)
tgstandby_url = optional(string)
tgrefresh_url = optional(string)
}) | {
"license_type": "none"
} | no |
diff --git a/cos.tf b/cos.tf
index 7500a059b..c884b4c52 100644
--- a/cos.tf
+++ b/cos.tf
@@ -126,6 +126,21 @@ resource "ibm_cos_bucket" "buckets" {
usage_metrics_enabled = metrics_monitoring.value.usage_metrics_enabled
}
}
+
+ dynamic "retention_rule" {
+ for_each = (
+ each.value.retention_rule == null
+ ? []
+ : [each.value.retention_rule]
+ )
+
+ content {
+ default = retention_rule.value.default
+ minimum = retention_rule.value.minimum
+ maximum = retention_rule.value.maximum
+ permanent = retention_rule.value.permanent
+ }
+ }
}
resource "time_sleep" "wait_for_cos_bucket_lifecycle" {
diff --git a/patterns/mixed/override.json b/patterns/mixed/override.json
index df550ca74..e43e5847a 100644
--- a/patterns/mixed/override.json
+++ b/patterns/mixed/override.json
@@ -65,6 +65,12 @@
"enable": true,
"days": 0,
"type": "Glacier"
+ },
+ "retention_rule": {
+ "default": 1,
+ "maximum": 1,
+ "minimum": 1,
+ "permanent": false
}
}
],
diff --git a/patterns/roks/override.json b/patterns/roks/override.json
index 7818d5f58..7dc529102 100644
--- a/patterns/roks/override.json
+++ b/patterns/roks/override.json
@@ -108,6 +108,12 @@
"enable": true,
"days": 0,
"type": "Glacier"
+ },
+ "retention_rule": {
+ "default": 1,
+ "maximum": 1,
+ "minimum": 1,
+ "permanent": false
}
}
],
diff --git a/patterns/vpc/override.json b/patterns/vpc/override.json
index 978ee7a48..60f8c1ec7 100644
--- a/patterns/vpc/override.json
+++ b/patterns/vpc/override.json
@@ -29,6 +29,12 @@
"enable": true,
"days": 0,
"type": "Glacier"
+ },
+ "retention_rule": {
+ "default": 1,
+ "maximum": 1,
+ "minimum": 1,
+ "permanent": false
}
}
],
diff --git a/patterns/vsi/override.json b/patterns/vsi/override.json
index 942a2d04d..aadcfc801 100644
--- a/patterns/vsi/override.json
+++ b/patterns/vsi/override.json
@@ -88,6 +88,12 @@
"enable": true,
"days": 0,
"type": "Glacier"
+ },
+ "retention_rule": {
+ "default": 1,
+ "maximum": 1,
+ "minimum": 1,
+ "permanent": false
}
}
],
diff --git a/variables.tf b/variables.tf
index 61f6692b9..a2695549d 100644
--- a/variables.tf
+++ b/variables.tf
@@ -581,6 +581,12 @@ variable "cos" {
request_metrics_enabled = optional(bool)
usage_metrics_enabled = optional(bool)
}))
+ retention_rule = optional(object({
+ default = number
+ maximum = number
+ minimum = number
+ permanent = optional(bool)
+ }))
}))
keys = optional(
list(object({
@@ -748,6 +754,36 @@ variable "cos" {
]
) == 0
}
+
+ validation {
+ error_message = "`retention_rule.minimum` value must be less than or equal to the `retention_rule.default` value."
+ condition = length(
+ flatten(
+ [
+ for instance in var.cos :
+ [
+ for bucket in instance.buckets :
+ bucket.retention_rule == null ? true : bucket.retention_rule.minimum <= bucket.retention_rule.default
+ ]
+ ]
+ )
+ ) == length(flatten([for instance in var.cos : [for bucket in instance.buckets : true]]))
+ }
+
+ validation {
+ error_message = "`retention_rule.default` value must be less than or equal to the `retention_rule.maximum` value."
+ condition = length(
+ flatten(
+ [
+ for instance in var.cos :
+ [
+ for bucket in instance.buckets :
+ bucket.retention_rule == null ? true : bucket.retention_rule.default <= bucket.retention_rule.maximum
+ ]
+ ]
+ )
+ ) == length(flatten([for instance in var.cos : [for bucket in instance.buckets : true]]))
+ }
}
##############################################################################