Open saevarb opened 4 months ago
I discovered that the ibm cloud cli can list bindings: ibmcloud ce binding list
. There is an ID in there, but following the documentation and constructing and id <project_id>/<binding_id>
using this ID returns an error during apply:
"Result": {
β "errors": [
β {
β "code": "parameter_invalid",
β "message": "Bad request - The parameter 'id' is invalid. reason: TOOLONG",
β "target": {
β "name": "id",
β "reason": "TOOLONG",
β "type": "parameter"
β }
β }
β ],
β "status_code": 400,
β "trace": "codeengine-api-61f504f2d86142afbf8c0bd2817c5502"
β },
Hi @saevarb Thanks you for bringing the lack of clarity in the docs to our attentions, we are opening a ticket to improve them based on your feedback.
As for your issue, creating a service binding is actually a 3 step process.
Create a code engine app/job
Create a service-access secret that references your other ibm cloud service (in your case a postgres instance). This secret will contain all connection information related to your service instance.
Create a binding with your Code Engine app/job (resource_type: app_v2
or job_v2
) and the service access secret. This binding will connect your app/job to the service-access secret, giving your app/job access to the credentials stored within, thus allowing a connection between your app/job and postgres instance.
@jaksart1 Thanks a lot for your quick response. That makes sense, but yes, would be super useful to have as part of the documentation.
Community Note
New or Affected Resource(s) or Datasource(s)
Description
I'm trying to use
ibm_code_engine_binding
to automate binding e.g. a postgres database to my code engine instances.The documentation for
component
states:component
: A reference to another componentOkay, so the database I want to bind to my code engine app, right?
name
: The name of the referenced component.So the name of my database.
resource_type
: The type of the referenced resourceAlright, and what are the valid values for this? I've tried
databases-for-postgresql
which does not work. In fact, this fails due to a regex validation error during apply(instead of during planning), and so does the same thing with underscores instead of dashes.This also leaves one asking: where do I actually specify which code engine app this resource is supposed to be bound to? The documentation examples further confuses by providing the following example
I can only assume
app_v2
refers to a code engine application, but of course this is not documented anywhere on this page, but I can confirm this by looking at other documentation.. but clearly this is meant to be a binding to a COS resource, but then where is any reference to said COS resource?As I've had to do before, I figured I'd try creating the binding manually, then import it and then look at the output from terraform. Unfortunately, the documentation for that states
But nowhere is it described where you can get a binding id, and I've not been able to find it anywhere, not on the code engine service binding page(in urls or otherwise) or on the database side.