pulumi-azure-native icon indicating copy to clipboard operation
pulumi-azure-native copied to clipboard

serviceComponentBind on DaprComponent undocumented

Open jhlabs opened this issue 1 year ago • 1 comments

What happened?

I am trying to setup a DaprComponent in Azure container apps by connecting it to an Azure Redis Dev Service. When I use Pulumi with the version v20230801preview of the Azure Native Provider, a property exists that is called serviceComponentBind which has a similar structure to the serviceBinds used to connect container apps to the dev services. However, when I try to set this to a valid serviceId I receive the following error:

autorest/azure: Service returned an error. Status=400 Code="Unknown" Message="Unknown service error" Details=[{"errors":{"$.properties.serviceComponentBind":["The JSON value could not be converted to Microsoft.ContainerApps.WebApi.Views.Version20230801preview.DaprComponentServiceBinding. Path: $.properties.serviceComponentBind | LineNumber: 0 | BytePositionInLine: 129."]},"status":400,"title":"One or more validation errors occurred.","traceId":"00-8b8d69d4558ebd7b9e19c0df126f255a-e5231690eadce5b2-01","type":"https://tools.ietf.org/html/rfc7231#section-6.5.1"}]

I also cannot find any documentation on this property, neither on the Pulumi nor Azure docs. It's as if it does not exist in the API. However, it seems that it would solve my problem of binding the dev service.

Example

import { DaprComponent } from '@pulumi/azure-native/app/v20230801preview';
import * as pulumi from '@pulumi/pulumi';

const infra = new pulumi.StackReference('infra-base/staging');
const redis = new pulumi.StackReference('redis/staging');

const environmentName = infra.requireOutput('environmentName');

const resourceGroupName = infra.requireOutput('resourceGroupName');

const redisId = redis.requireOutput('redisServiceId');

export const eventBroker = new DaprComponent('event-broker', {
	environmentName,
	resourceGroupName,
	componentName: 'pubsub',
	componentType: 'pubsub.redis',
	serviceComponentBind: [
		{
			name: 'redis',
			serviceId: redisId
		}
	],
	version: 'v1',
	scopes: ['app']
});

Output of pulumi about

CLI
Version 3.109.0 Go Version go1.22.0 Go Compiler gc

Plugins NAME VERSION nodejs unknown

Host
OS darwin Version 14.2.1 Arch arm64

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

jhlabs avatar Mar 14 '24 15:03 jhlabs

Hi @jhlabs, the property does indeed exist in the API (in newer versions like your 2023-08-01-preview). The elements of the array are defined as a triple of name, serviceId, and metadata.

    "DaprComponentServiceBinding": {
      "description": "Configuration to bind a Dapr Component to a dev ContainerApp Service",
      "type": "object",
      "properties": {
        "name": {
          "description": "Name of the service bind",
          "type": "string"
        },
        "serviceId": {
          "description": "Resource id of the target service",
          "type": "string"
        },
        "metadata": {
          "description": "Service bind metadata",
          "type": "array",
          "$ref": "#/definitions/DaprServiceBindMetadata"
        }
      }
    },

I don't really know Dapr but I suspect you're getting an error because of the missing metadata property. I believe it corresponds to this Redis binding documented in Dapr docs, requiring host and password.

Other than that, unfortunately we don't have any additional information about this property, we're bound by what the Azure spec provides us here.

thomas11 avatar Mar 27 '24 16:03 thomas11

Since we haven't heard back, I'll close the issue as non-actionable. If you have further details, feel free to let us know.

mikhailshilkov avatar May 08 '24 16:05 mikhailshilkov