-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
46 lines (39 loc) · 1.52 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
########################################################
# Create VM configured to access ICD database
########################################################
resource "ibm_compute_vm_instance" "webapp1" {
domain = var.domain
datacenter = var.datacenter
hostname = var.hostname
count = 1
os_reference_code = var.os-reference-code
flavor_key_name = var.flavor
local_disk = false
private_security_group_ids = [ibm_security_group.sg_private_lamp.id]
public_security_group_ids = [ibm_security_group.sg_public_lamp.id]
private_network_only = false
}
data "ibm_resource_group" "group" {
name = var.resource-group
}
resource "ibm_database" "test_acc" {
resource_group_id = data.ibm_resource_group.group.id
name = var.resource-instance-name
service = var.database-service-name
plan = var.database-service-plan
location = var.location
adminpassword = var.admin-password
whitelist {
address = "${ibm_compute_vm_instance.webapp1[0].ipv4_address}/32"
description = ibm_compute_vm_instance.webapp1[0].hostname
}
members_memory_allocation_mb = var.members-memory-allocation-mb
members_disk_allocation_mb = var.members-disk-allocation-mb
users {
name = var.db-user-name
password = var.db-user-password
}
}
output "ICD_Postgresql_database_connection_string" {
value = ibm_database.test_acc.connectionstrings[0].composed
}