-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatsonServiceDeployment.tf
More file actions
99 lines (86 loc) · 2.98 KB
/
watsonServiceDeployment.tf
File metadata and controls
99 lines (86 loc) · 2.98 KB
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
variable "org" {
type = "string"
description = "Your Bluemix ORG"
default = "CAM DevOps"
}
variable "space" {
type = "string"
description = "Your Bluemix Space"
default = "dev"
}
variable "servicename" {
type = "string"
description = "Specify the service name you want to create"
default = "tone_analyzer"
}
variable "plan" {
type = "string"
description = "Specify the corresponding plan for the service you selected"
default = "lite"
}
variable "region" {
type = "string"
description = "Bluemix region"
default = "us-south"
}
################################################
# Load org data
################################################
data "ibm_org" "orgData" {
org = "${var.org}"
}
################################################
# Load space data
################################################
data "ibm_space" "spaceData" {
space = "${var.space}"
org = "${data.ibm_org.orgData.org}"
}
################################################
# Load account data
################################################
data "ibm_account" "accountData" {
org_guid = "${data.ibm_org.orgData.id}"
}
################################################
# Create cloudant instance
################################################
resource "ibm_service_instance" "service" {
name = "${var.servicename}-${random_pet.service.id}"
space_guid = "${data.ibm_space.spaceData.id}"
service = "${var.servicename}"
plan = "${var.plan}"
}
################################################
# Generate access info
################################################
resource "ibm_service_key" "serviceKey" {
name = "${var.servicename}-${random_pet.service.id}"
service_instance_guid = "${ibm_service_instance.service.id}"
}
################################################
# Generate a name
################################################
resource "random_pet" "service" {
length = "2"
}
# Configure the IBM Cloud Provider
provider "ibm" {
# bluemix_api_key = "${var.ibm_bmx_api_key}"
region = "${var.region}"
}
################################################
# outputs
################################################
output "access_urls" {
value = "${lookup(ibm_service_key.serviceKey.credentials,"url")}"
}
output "access_password" {
value = "${lookup(ibm_service_key.serviceKey.credentials,"password")}"
}
output "access_username" {
value = "${lookup(ibm_service_key.serviceKey.credentials,"username")}"
}
output "IBM Cloud Dashboard" {
value = "https://console.bluemix.net/dashboard/apps/?search=tone"
}