-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.tf
109 lines (99 loc) · 3.9 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
module "pre-init-schematics" {
source = "./modules/pre-init"
count = (var.PRIVATE_SSH_KEY == "n.a" && var.BASTION_FLOATING_IP == "localhost" ? 0 : 1)
ID_RSA_FILE_PATH = var.ID_RSA_FILE_PATH
PRIVATE_SSH_KEY = var.PRIVATE_SSH_KEY
}
module "pre-init-cli" {
source = "./modules/pre-init/cli"
count = (var.PRIVATE_SSH_KEY == "n.a" && var.BASTION_FLOATING_IP == "localhost" ? 1 : 0)
ID_RSA_FILE_PATH = var.ID_RSA_FILE_PATH
KIT_SAPCAR_FILE = var.KIT_SAPCAR_FILE
KIT_SWPM_FILE = var.KIT_SWPM_FILE
KIT_SAPEXE_FILE = var.KIT_SAPEXE_FILE
KIT_SAPEXEDB_FILE = var.KIT_SAPEXEDB_FILE
KIT_IGSEXE_FILE = var.KIT_IGSEXE_FILE
KIT_IGSHELPER_FILE = var.KIT_IGSHELPER_FILE
KIT_SAPHOSTAGENT_FILE = var.KIT_SAPHOSTAGENT_FILE
KIT_HDBCLIENT_FILE = var.KIT_HDBCLIENT_FILE
KIT_S4HANA_EXPORT = var.KIT_S4HANA_EXPORT
}
module "precheck-ssh-exec" {
source = "./modules/precheck-ssh-exec"
count = (var.PRIVATE_SSH_KEY == "n.a" && var.BASTION_FLOATING_IP == "localhost" ? 0 : 1)
depends_on = [ module.pre-init-schematics ]
BASTION_FLOATING_IP = var.BASTION_FLOATING_IP
ID_RSA_FILE_PATH = var.ID_RSA_FILE_PATH
PRIVATE_SSH_KEY = var.PRIVATE_SSH_KEY
HOSTNAME = var.DB_HOSTNAME
SECURITY_GROUP = var.SECURITY_GROUP
}
module "vpc-subnet" {
source = "./modules/vpc/subnet"
depends_on = [ module.precheck-ssh-exec ]
ZONE = var.ZONE
VPC = var.VPC
SECURITY_GROUP = var.SECURITY_GROUP
SUBNET = var.SUBNET
}
module "db-vsi" {
source = "./modules/db-vsi"
depends_on = [ module.vpc-subnet ]
ZONE = var.ZONE
VPC = var.VPC
SECURITY_GROUP = var.SECURITY_GROUP
SUBNET = var.SUBNET
HOSTNAME = var.DB_HOSTNAME
PROFILE = var.DB_PROFILE
IMAGE = var.DB_IMAGE
RESOURCE_GROUP = var.RESOURCE_GROUP
SSH_KEYS = var.SSH_KEYS
count = lower(trimspace(var.HANA_SERVER_TYPE)) == "virtual" ? 1 : 0
}
module "db-bms" {
source = "./modules/db-bms"
depends_on = [ module.vpc-subnet ]
ZONE = var.ZONE
VPC = var.VPC
SECURITY_GROUP = var.SECURITY_GROUP
SUBNET = var.SUBNET
HOSTNAME = var.DB_HOSTNAME
PROFILE = var.DB_PROFILE
IMAGE = var.DB_IMAGE
RESOURCE_GROUP = var.RESOURCE_GROUP
SSH_KEYS = var.SSH_KEYS
count = lower(trimspace(var.HANA_SERVER_TYPE)) != "virtual" ? 1 : 0
}
module "app-vsi" {
source = "./modules/app-vsi"
depends_on = [ module.vpc-subnet ]
ZONE = var.ZONE
VPC = var.VPC
SECURITY_GROUP = var.SECURITY_GROUP
SUBNET = var.SUBNET
HOSTNAME = var.APP_HOSTNAME
PROFILE = var.APP_PROFILE
IMAGE = var.APP_IMAGE
RESOURCE_GROUP = var.RESOURCE_GROUP
SSH_KEYS = var.SSH_KEYS
}
module "app-ansible-exec-schematics" {
source = "./modules/ansible-exec"
depends_on = [ module.app-vsi, local_file.ansible_inventory, local_file.db_ansible_saphana-vars, local_file.app_ansible_saps4app-vars ]
count = (var.PRIVATE_SSH_KEY == "n.a" && var.BASTION_FLOATING_IP == "localhost" ? 0 : 1)
IP = "${lower(trimspace(var.HANA_SERVER_TYPE)) == "virtual" ? data.ibm_is_instance.db-vsi[0].primary_network_interface[0].primary_ip[0].address : data.ibm_is_bare_metal_server.db-bms[0].primary_network_interface[0].primary_ip[0].address}"
PLAYBOOK = "sap-s4hana.yml"
BASTION_FLOATING_IP = var.BASTION_FLOATING_IP
ID_RSA_FILE_PATH = var.ID_RSA_FILE_PATH
PRIVATE_SSH_KEY = var.PRIVATE_SSH_KEY
}
module "ansible-exec-cli" {
source = "./modules/ansible-exec/cli"
depends_on = [ module.app-vsi, local_file.ansible_inventory, local_file.db_ansible_saphana-vars, local_file.app_ansible_saps4app-vars ]
count = (var.PRIVATE_SSH_KEY == "n.a" && var.BASTION_FLOATING_IP == "localhost" ? 1 : 0)
IP = "${lower(trimspace(var.HANA_SERVER_TYPE)) == "virtual" ? data.ibm_is_instance.db-vsi[0].primary_network_interface[0].primary_ip[0].address : data.ibm_is_bare_metal_server.db-bms[0].primary_network_interface[0].primary_ip[0].address}"
ID_RSA_FILE_PATH = var.ID_RSA_FILE_PATH
SAP_MAIN_PASSWORD = var.SAP_MAIN_PASSWORD
HANA_MAIN_PASSWORD = var.HANA_MAIN_PASSWORD
PLAYBOOK = "sap-s4hana.yml"
}