Issues interpolating org_id values in plan templates
tanjoht opened this issue · comments
As an operator, the org_id value should be obtained through the "keys" env variables? (use case: 1 set of "plan templates" for each of the different environments/orgs)
Error:
cf create-service mongodb-atlas-template replica-m10 atlas-replica-m10-test3
Creating service instance atlas-replica-m10-test3 in org test / space tanjoht as admin...
Service broker error: credentials for project ID "" not found
FAILED
Plan:
name: replica-m10
description: This is the Basic Plan
template for 1 project, 1 cluster, 1 dbuser, and 1 secure connection.
free: true
apiKey: {{ mustToJson (index .credentials.Orgs (default "default_org" .org_id)) }}
project:
name: {{ .instance_name }}
desc: Created from a template
cluster:
name: {{ .instance_name }}
providerBackupEnabled: {{ default "true" .backups }}
providerSettings:
providerName: {{ default "AZURE" .provider }}
instanceSizeName: {{ default "M10" .instance_size }}
regionName: {{ default "US_EAST_2" .region }}
labels:
- key: Infrastructure Tool
value: MongoDB Atlas Service Broker
databaseUsers:
- username: {{ default "test-user" .username }}
password: {{ default "test-password" .password }}
databaseName: {{ default "default" .auth_db }}
roles:- roleName: {{ default "readWrite" .role }}
databaseName: {{ default "default" .role_db }}
ipWhitelists:
- roleName: {{ default "readWrite" .role }}
- ipAddress: "0.0.0.0/1"
comment: "everything" - ipAddress: "128.0.0.0/1"
comment: "everything"
keys:
"orgs": {
"default_org": {
"publicKey": "x,
"privateKey": "x",
"id": "atlas-osb-api-key",
"desc": "API Key for Atlas OSB",
"roles": [
{ "orgId" : "x" }
]
},
Can you attach your broker app logs?
We will investigate-
Thanks.
@tanjoht - I checked the implementation and it seems the original code has some dependecies on the "keys" for the orgs and projects being the actual IDs.
We will keep this issue open and address it when our main go engineer returns from vacation.
So - to be clear - we will fix this, so that you do not need to have hard coded org ids in your templates for the BETA release (at least).
Thanks-
This should be next up to work on @vasilevp for the week Aug 10.
I think probably need to refactor the credentials/credentials.go
so that the keys for the projects
and the orgs
can be any string (well valid string, like "foo-bar-1234-zxy, etc"). The keys can be the actual _id
for the Project or Org, but just should not need to be the internal id. This is to facilitate uses referencing the key from their templates, it should be natural for humans to read and comprehend.