File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1+ # create a database
2+ set -e
3+
4+ echo " Retrieving IAM tokens for Cloudant API key..."
5+ IAM_TOKENS=$( curl -X POST ' https://iam.cloud.ibm.com/identity/token' \
6+ -H ' Content-Type: application/x-www-form-urlencoded' \
7+ -d " grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$CLOUDANT_IAM_APIKEY " )
8+
9+ API_BEARER_TOKEN=$( echo $IAM_TOKENS | jq -r .access_token)
10+
11+ echo " Creating database..."
12+ curl -f -H " Authorization: Bearer $API_BEARER_TOKEN " -X PUT " $CLOUDANT_URL /$CLOUDANT_DATABASE "
Original file line number Diff line number Diff line change @@ -115,11 +115,15 @@ resource "ibm_resource_key" "RKcloudantManager" {
115115
116116 # create the database
117117 provisioner "local-exec" {
118- command = " curl -X PUT ${ ibm_resource_key . RKcloudantManager . credentials . url } /secure-file-storage-metadata"
118+ command = " ./create-database.sh"
119+ environment = {
120+ CLOUDANT_IAM_APIKEY = nonsensitive (ibm_resource_key. RKcloudantManager . credentials . apikey )
121+ CLOUDANT_URL = nonsensitive (ibm_resource_key. RKcloudantManager . credentials . url )
122+ CLOUDANT_DATABASE = " secure-file-storage-metadata"
123+ }
119124 }
120125}
121126
122-
123127# service access key for AppID
124128resource "ibm_resource_key" "RKappid" {
125129 name = " ${ var . basename } -accKey-appid"
Original file line number Diff line number Diff line change 11{
22 "name" : " schematics_secure-file-storage" ,
33 "type" : [
4- " terraform_v0.14 "
4+ " terraform_v1.0 "
55 ],
66 "description" : " Deploy services for solution tutorial on applying e2e security (secure file storage)" ,
77 "tags" : [
1414 },
1515 "template_data" : [{
1616 "folder" : " ." ,
17- "type" : " terraform_v0.14 " ,
17+ "type" : " terraform_v1.0 " ,
1818 "variablestore" : [{
1919 "name" : " project_name" ,
2020 "value" : " secure-file-storage" ,
You can’t perform that action at this time.
0 commit comments