forked from hol-workshop/migrate_to_atp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
152 lines (142 loc) · 7.01 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Migrate Postgresql to ATP lab materials
module "ogg_pgsql_swap_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_pgsql_swap_size_in_gbs
display_name = "${var.ogg_pgsql_bv_display_name} (Swap)"
}
module "ogg_pgsql_trails_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_pgsql_trails_size_in_gbs
display_name = "${var.ogg_pgsql_bv_display_name} (Trails)"
existing_volume_id = var.ogg_pgsql_trails_volume_id
}
module "ogg_pgsql_deployments_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_pgsql_deployments_size_in_gbs
display_name = "${var.ogg_pgsql_bv_display_name} (Deployments)"
existing_volume_id = var.ogg_pgsql_deployments_volume_id
}
module "ogg_pgsql_image" {
source = "./ogg_pgsqlimage"
compartment_ocid = var.image_compartment_id
market_image_id = local.mp_listing_resource_id
custom_image_name = "ogg-${var.ogg_pgsql_version}-${var.ogg_pgsql_edition}-${var.ogg_pgsql_dbms}"
}
module "source_pgsql" {
source = "./source_db"
compartment_id = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
ssh_public_key = file("~/.ssh/oci.pub")
boot_size_in_gbs = var.source_pgsql_boot_size_in_gbs
display_name = var.source_pgsql_display_name
hostname_label = var.source_pgsql_hostname_label
compute_shape = var.source_pgsql_compute_shape
image_id = var.source_postgre_image_ocid[var.region]
subnet_id = oci_core_subnet.holvcn_public_subnet.id
assign_public_ip = var.source_pgsql_assign_public_ip
}
module "ogg_pgsql_compute" {
source = "./ogg_pgsql"
compartment_id = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
ssh_public_key = file("~/.ssh/oci.pub")
boot_size_in_gbs = var.ogg_pgsql_boot_size_in_gbs
display_name = var.ogg_pgsql_display_name
hostname_label = var.ogg_pgsql_hostname_label
compute_shape = var.ogg_pgsql_compute_shape
image_id = module.ogg_pgsql_image.image_id
swap_volume_id = module.ogg_pgsql_swap_block_volume.volume_id
trails_volume_id = module.ogg_pgsql_trails_block_volume.volume_id
deployments_volume_id = module.ogg_pgsql_deployments_block_volume.volume_id
subnet_id = oci_core_subnet.holvcn_public_subnet.id
assign_public_ip = var.ogg_pgsql_assign_public_ip
source_db = module.source_pgsql.Source_PGSQLDB_Public_ip
}
module "ogg_micro_swap_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_micro_swap_size_in_gbs
display_name = "${var.ogg_micro_bv_display_name} (Swap)"
}
module "ogg_micro_trails_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_micro_trails_size_in_gbs
display_name = "${var.ogg_micro_bv_display_name} (Trails)"
existing_volume_id = var.ogg_micro_trails_volume_id
}
module "ogg_micro_deployments_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_micro_deployments_size_in_gbs
display_name = "${var.ogg_micro_bv_display_name} (Deployments)"
existing_volume_id = var.ogg_micro_deployments_volume_id
}
module "ogg_micro_cacheManager_block_volume" {
source = "./block_volume"
compartment_ocid = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
size_in_gbs = var.ogg_micro_cacheManager_size_in_gbs
display_name = "${var.ogg_micro_bv_display_name} (Cache Manager)"
existing_volume_id = var.ogg_micro_cacheManager_volume_id
}
module "ogg_micro_image" {
source = "./ogg_microimage"
compartment_id = var.image_compartment_id
market_image_id = local.mp_listing_resource_id2
custom_image_name = "ogg-${var.ogg_micro_version}-${var.ogg_micro_edition}-${var.ogg_micro_dbms}"
}
module "atp" {
source = "./atp"
compartment_id = var.compartment_ocid
display_name = var.atp_display_name
db_name = "hol${random_string.deploy_id.result}"
db_workload = var.atp_workload
is_free_tier = var.atp_is_free_tier
db_version = var.atp_db_version
cpu_core_count = var.atp_ocpu_count
data_storage_size_in_tbs = var.atp_storage_size
license_model = var.atp_license_model
generate_type = var.atp_wallet_generate_type
}
module "ogg_compute" {
depends_on = [module.atp]
source = "./ogg_micro"
deployments = var.deployments_json != "" ? var.deployments_json : var.deployment_2_name != "" && var.deployment_2_dbms != "" ? "[ {\"name\":\"${var.deployment_1_name}\",\"dbms\":\"${var.deployment_1_dbms}\"}, {\"name\":\"${var.deployment_2_name}\",\"dbms\":\"${var.deployment_2_dbms}\"} ]" : "[ {\"name\":\"${var.deployment_1_name}\",\"dbms\":\"${var.deployment_1_dbms}\"} ]"
deployment_2_wallet = module.atp.wallet
compartment_id = var.compartment_ocid
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
ssh_public_key = file("~/.ssh/oci.pub")
boot_size_in_gbs = var.ogg_micro_boot_size_in_gbs
display_name = var.ogg_micro_display_name
hostname_label = var.ogg_micro_hostname_label
compute_shape = var.ogg_micro_compute_shape
image_id = module.ogg_micro_image.image_id
swap_volume_id = module.ogg_micro_swap_block_volume.volume_id
trails_volume_id = module.ogg_micro_trails_block_volume.volume_id
deployments_volume_id = module.ogg_micro_deployments_block_volume.volume_id
cacheManager_volume_id = module.ogg_micro_cacheManager_block_volume.volume_id
subnet_id = oci_core_subnet.holvcn_public_subnet.id
assign_public_ip = var.ogg_micro_assign_public_ip
}
output "Source_PGSQLDB_Public_ip" {
value = module.source_pgsql.Source_PGSQLDB_Public_ip
}
output "ATP_generated_password" {
value = module.atp.ATP_generated_password
}
output "OGG_Microservices_Public_ip" {
value = module.ogg_compute.OGG_Microservices_Public_ip
}
output "OGG_PGSQL_Public_ip" {
value = module.ogg_pgsql_compute.OGG_PGSQL_Public_ip
}