I have 2 lists of variables in terraform. Need to use both lists and create the resource
What I have
locals {
bucket_name = ["SRE", "Engg", "QA"]
access_type =["Private", "Public" ]
}
resource "oci_objectstorage_bucket" "test_bucket" {
for_each = local.bucket_name
compartment_id = var.compartment_id
name = each.value
namespace = var.bucket_namespace
access_type = "Private" ## for Private
}
resource "oci_objectstorage_bucket" "test_bucket" {
for_each = local.bucket_name
compartment_id = var.compartment_id
name = each.value
namespace = var.bucket_namespace
access_type = "Public" ## For Public
}
With the above resource blocks, I can create the required buckets. However, I don't want to use 2 blocks for the same set (one for private and the other for public) of code. Is there any possibility to combine 2 lists and create the resource