forked from terraform-ibm-modules/terraform-ibm-cos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
42 lines (37 loc) · 1.63 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
##############################################################################
# Resource group
##############################################################################
module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.4"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}
##############################################################################
# Create Cloud Object Storage instance and a bucket
##############################################################################
module "cos" {
source = "../../"
resource_group_id = module.resource_group.resource_group_id
region = var.region
cos_instance_name = "${var.prefix}-cos"
cos_tags = var.resource_tags
bucket_name = "${var.prefix}-bucket"
retention_enabled = false # disable retention for test environments - enable for stage/prod
kms_encryption_enabled = false
}
##############################################################################
# Create Cloud Object Storage bucket using buckets submodule
##############################################################################
module "buckets" {
source = "../../modules/buckets"
bucket_configs = [
{
bucket_name = "${var.prefix}-bucket-module"
kms_encryption_enabled = false
region_location = var.region
resource_instance_id = module.cos.cos_instance_id
}
]
}