@@ -16,7 +16,7 @@ locals {
1616 cos_name = var. use_existing_cos == true || (var. use_existing_cos == false && var. cos_name != null ) ? var. cos_name : " ${ var . cluster_name } _cos"
1717 cos_location = " global"
1818 cos_plan = " standard"
19- cos_instance_crn = var. use_existing_cos != false ? var. existing_cos_id : ibm_resource_instance . cos_instance [0 ]. id
19+ cos_instance_crn = var. use_existing_cos != false ? var. existing_cos_id : module . cos_instance [0 ]. cos_instance_id
2020
2121 # Validation approach based on https://stackoverflow.com/a/66682419
2222 validate_condition = var. use_existing_cos == true && var. existing_cos_id == null
@@ -37,19 +37,26 @@ data "ibm_container_cluster_versions" "cluster_versions" {
3737 region = var. region
3838}
3939
40- resource "ibm_resource_instance" "cos_instance" {
40+ module "cos_instance" {
4141 count = var. use_existing_cos ? 0 : 1
4242
43- name = local. cos_name
44- resource_group_id = var. resource_group_id
45- service = " cloud-object-storage"
46- plan = local. cos_plan
47- location = local. cos_location
43+ source = " git::https://github.com/terraform-ibm-modules/terraform-ibm-cos.git?ref=v6.1.0"
44+ cos_instance_name = local. cos_name
45+ resource_group_id = var. resource_group_id
46+ cos_plan = local. cos_plan
47+ cos_location = local. cos_location
48+ encryption_enabled = false
49+ create_cos_bucket = false
50+ }
51+
52+ moved {
53+ from = ibm_resource_instance. cos_instance [0 ]
54+ to = module. cos_instance [0 ]. ibm_resource_instance . cos_instance [0 ]
4855}
4956
5057resource "ibm_resource_tag" "cos_access_tag" {
5158 count = var. use_existing_cos || length (var. access_tags ) == 0 ? 0 : 1
52- resource_id = ibm_resource_instance . cos_instance [0 ]. crn
59+ resource_id = module . cos_instance [0 ]. cos_instance_id
5360 tags = var. access_tags
5461 tag_type = " access"
5562}
0 commit comments